From: Bluebird on
I need to extract and process images from a webcam. The follwoing code does work however it is very slow (i.e. takes 0.67 to retrieve an image from the camera), the code which i found online is :

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
vid = videoinput('winvideo',1,'YUY2_320x240');
% Set video input object properties for this application.
% Note that example uses both SET method and dot notation method.
set(vid,'TriggerRepeat',Inf);
set(vid,'ReturnedColorSpace','ycbcr');
start(vid);
while(vid.FramesAcquired<=100) % Stop after 100 frames
imgycbcr = getdata(vid); %Store image (This step takes 0.67 to process)
% Do whatever process
end
stop(vid)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Can anybody please help me in making it faster or at least advice me about different command other than getdata() ?

Thank you