How to reduce delay in video processing?

1 view (last 30 days)
Manu
Manu on 3 Apr 2014
Edited: Manu on 3 Apr 2014
Hi, I wrote a program to acquire video from my web cam and process each frames using MATLAB. Also I tried to preview the processed image. But problem is, there is high delay between two consecutive frames. Is it due to my program? Can anyone help me? The program is given below. In program I didn't process frames only just previewing. But I want to process each frames and preview then as video.
% Create video input object.
vid=videoinput('winvideo',1,'YUY2_640x480');
% Set video input object properties for this application.
% Note that example uses both SET method and dot notation method.
set(vid,'TriggerRepeat',100);
vid.FrameGrabInterval = 1;
% Set value of a video source object property.
vid_src = getselectedsource(vid);
set(vid_src,'Tag','motion detection setup');
set(vid,'ReturnedColorSpace','rgb');
%to convert yuy2 image to rgb
% Create a figure window.
figure;
% Start acquiring frames.
start(vid)
while(vid.FramesAvailable <100)
data = getdata(vid);
imshow(data(:,:,:,2));
drawnow
% update figure window
%
end
stop(vid)

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!