Taking Pictures with a Webcam?

I'm building a simple application that will use my webcam to take a
picture every 2 minutes and save it as a JPEG (or PNG) to the SD card.
I thought this would be simple, but the hardest part is finding a
program to take a picture with the webcam AND will work on the Beagle
Board.

I've tried Motion, but it does way more than I need (i.e. motion
detection) and seems to be buggy; perhaps it's too processor intensive
or something. For some reason it will take the first picture and then
all others will just be a copy of the first. Then the USB hub is
automatically reconnected a couple of times. Very strange.

Is there any good tool that I can use from the command line that will
simply take a picture and save it as a JPEG or PNG?

Could I use OpenCV for this? If so, are there any good examples?

Thanks!
Jeremy

mplayer is both able to read from a webcam and to save to a series of
PNGs; I'm not sure what options are better to save an image every 2
minutes (as opposed to one for each frame) but googling gave e.g.
these results

http://www.infohit.net/blog/post/taking-snapshots-from-a-webcam-under-linux.html

http://mydebian.blogdns.org/?p=120

vidcat
See http://www.elinux.org/BeagleBoard/James#vidcat

FM

I’m building a simple application that will use my webcam to take a
picture every 2 minutes and save it as a JPEG (or PNG) to the SD card.
I thought this would be simple, but the hardest part is finding a
program to take a picture with the webcam AND will work on the Beagle
Board.

I’ve tried Motion, but it does way more than I need (i.e. motion
detection) and seems to be buggy; perhaps it’s too processor intensive
or something. For some reason it will take the first picture and then
all others will just be a copy of the first. Then the USB hub is
automatically reconnected a couple of times. Very strange.

Is there any good tool that I can use from the command line that will
simply take a picture and save it as a JPEG or PNG?

Hi Jeremy:
Reading BeagleBoard forum on the possibility to take photos with the plate every 2 minutes, found some application?.
We are working in a hot air balloon and we would like the BeagleBoard in the journey doing this task.
From already thank you very much
Carlos

ffmpeg can do this, it shouldn't be difficult to build for beagleboard.

e.g. for 1 frame every 50 seconds:

ffmpeg -f v4l2 -i /dev/video0 -r 0.02 cam-%05d.png

s/png/jpg/ for jpeg, And obviously you can save it in piles of video formats as well. Depending on your camera, i suspect jpeg or mjpeg (mov) format would be the lightest load for decent quality.

This was with 1.0 - some older version on my machine didn't like fps < 1.

You can also just grab 1 frame, and put the rest in a script:

ffmpeg -f v4l2 -i /dev/video0 -vframes 1 capture.jpeg

  Michael

I think it would be possible to use gstreamer to do that too.