Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Retrieving image from webcam (very slow)

Subject: Retrieving image from webcam (very slow)

From: Bluebird

Date: 6 Aug, 2010 20:10:26

Message: 1 of 3

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

Subject: Retrieving image from webcam (very slow)

From: Michael

Date: 7 Aug, 2010 00:50:22

Message: 2 of 3

help snapshot

"Bluebird " <wlouis@ryerson.ca> wrote in message <i3hq7i$232$1@fred.mathworks.com>...
> 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

Subject: Retrieving image from webcam (very slow)

From: Bluebird

Date: 9 Aug, 2010 13:05:20

Message: 3 of 3

Thank you Michael. Can you please elaborate more? i couldn't run it using snapshot !

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us