2

I am trying to take photos with my web cam, and I'm having some difficulty trying to find a solution in java.

I've successfully set up FMJ and have my streaming video, but I want to take a photo, not video frame-grab. My web cam says it's 1.3MP, and 640 x 480 is a whopping 0.3MP!

So to clarify - I want to:

  1. Stream video to my display from my web cam (so I can see what I'm doing)
  2. When I press enter
    1. Stop capturing video
    2. Take full resolution photo (an image; not part of a low-res stream)
    3. Return to step 1 (streaming video to display)
Stephen
  • 19,488
  • 10
  • 62
  • 83
  • not sure but hear is the link I have found and may helpful http://stackoverflow.com/questions/276292/capturing-image-from-webcam-in-java – Avil Nov 03 '11 at 12:19

2 Answers2

0

You should use Java Media Framework (JMF). It exposes fully functional API for image and movie processing.

AlexR
  • 114,158
  • 16
  • 130
  • 208
  • Really? This is the first I've seen anybody recommend JMF over FMJ (which is fully JMF compatible anyhow). Can you point me to some api that will capture 1 image instead of opening some sort of stream? – Stephen Nov 03 '11 at 12:18
0

Picture Transfer Protocol is the way to go for high res. (I don't yet know what preview functionality is provided; perhaps JMF is used there...?)

If your web cam driver is good/recent (mine isn't), then you'll be able to see it in Window's "Scanners and Cameras" view. These devices are available under WIA (Windows Image Acquisition) technology. (I'm intending to use Jacob to talk to the windows libs).

For linuxes, there's a linking ptp page over at sourceforge. Note that it indicates that jphoto is obselete, but cameraptp over at google code extends it as recently as Feb 2011.

Stephen
  • 19,488
  • 10
  • 62
  • 83