Wednesday, July 20, 2011

Simple video collection in matlab using image processing toolbox

function data = videocollect(collecttime)
%Author: Lightcogitation
%Copyright 7/20/11 Lightcogitation

% Create video input object.
vid = videoinput('winvideo',1);

set(vid,'TriggerRepeat',Inf);
vid.FrameGrabInterval = 1; %Grab every frame at 30 frames per second
preview(vid); %so we can see what we are grabbing
start(vid);
pause(collecttime);
stop(vid);
data = getdata(vid);
closepreview(vid)
delete(vid);

No comments:

Post a Comment