How can I continuously capture images from a webcam?
I want to experiment with object recognition (by maybe using java media framework).
I was thinking of creating two threads
one thread:
- Node 1: capture live image
- Node 2: save image as "1.jpg"
- Node 3: wait 5 seconds
- Node 4: repeat...
other thread:
- Node 1: wait until image is captured
- Node 2: using the "1.jpg" get colors from every pixle
- Node 3: save data in arrays
- Node 4: repeat...
http://grack.com/downloads/school/enel619.10/report/java_media_framework.html
Using the Player with Swing
The Player can be easily used in a Swing application as well. The following code creates a Swing-based TV capture program with the video output displayed in the entire window:
I have used JMF on a videoconference application and it worked well on two laptops: one with integrated webcam and another with an old USB webcam. It requires JMF being installed and configured before-hand, but once you're done you can access the hardware via Java code fairly easily.
This kind of goes off of gt_ebuddy's answer using JavaCV, but my video output is at a much higher quality then his answer. I've also added some other random improvements (such as closing down the program when ESC and CTRL+C are pressed, and making sure to close down the resources the program uses properly).
I used Webcam Capture API...u can download from this http://webcam-capture.sarxos.pl/
FMJ can do this, as can the supporting library it uses, LTI-CIVIL. Both are on sourceforge.
JMyron is very simple for use. http://webcamxtra.sourceforge.net/