video capture

by

 

analyze a video stream

sample_my_video.m
clc; close all;
%vid = videoinput('winvideo', 1, 'YUY2_320x240');
%src = getselectedsource(vid);

%vid.FramesPerTrigger = 1;

%preview(vid);

%stoppreview(vid);

obj = videoinput('winvideo', 2, 'YUY2_320x240'); % creates a video object
preview(obj); % previews video
pause(2); % wait for video to get stabilized
frame = getsnapshot(obj); % capture snapshot and save as matrix
image(frame); % display matrix as image, imshow can also be used
%-----------processing-------------------
Image_red = frame(:,1);

closepreview(obj); % closes preview window
delete(obj); % delete video object after use

Contact us