code to read image from webcam

hai frnds!!
i'm naveen.. i'm doing a face recognition project as major final year project in b.tech,i've been using the following code to acquire image through webcam but it shows a blank image in output...can any one help me? thanks
the code is:
vid = videoinput('winvideo');
preview(vid);
start(vid);
im=getdata(vid); % im = getsnapshot(vid); alternative use
figure,imshow(im);
plz suggest coorect code..

1 Kommentar

Partha Ghosh
Partha Ghosh am 8 Nov. 2012
Bearbeitet: Walter Roberson am 8 Nov. 2012
im=getdata(vid);
When you do this it returns you a set of images in my case 10 RGB images hence you should use
imshow(im(:,:,:,i))
where I is the index of the image

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 25 Nov. 2011

0 Stimmen

Can you see the image when you use imaqtool?

Gefragt:

am 25 Nov. 2011

Community Treasure Hunt

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

Start Hunting!

Translated by