video capture



analyze a video stream

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

%vid.FramesPerTrigger = 1;



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
Image_red = frame(:,1);

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

Contact us