How do you take a picture automatically that is connected to your computer through USB, using MATLAB code?

1 view (last 30 days)
I need my code to signal the camera to take a picture once an object is placed in the frame and then store the image in MATLAB.
[Merged information from duplicate question]
The model of the camera I want to access that is connected through USB is a "Windows Life Cam". I need this camera to take picture. My code is only pulling up the Web Cam that is permantly installed on the computer (that comes with the machine). Here is what I have:
vid = videoinput('winvideo', 2);
start(vid);
im = getdata(vid,2);
figure, imshow(im);
imwrite(im, 'myfirstimage.jpg');
Thanks.

Accepted Answer

Image Analyst
Image Analyst on 15 Oct 2012
Did you try the getsnapshot() function? Or did you run imaqtool to see what functions you need to run (there's more than just getsnapshot()).

More Answers (1)

Walter Roberson
Walter Roberson on 11 Oct 2012
Most cameras do not offer a mechanism for this. Some cameras do. What make and model of camera are you using?

Categories

Find more on MATLAB Support Package for IP Cameras in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!