• Post Reply Bookmark Topic Watch Topic
  • New Topic

capturing high-resolution video frames from a Logitech C920 WebCam

 
Joe Nikki
Greenhorn
Posts: 19
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JavaCV (opencv version 2.3.1) to capture video frames from a Logitech c920 web cam.
The Logitech Windows c920 application software records video at a resolution of 1280 x 720 pixels per frame and records snapshots at a resolution of 5168x 2907 pixels per image.
I wrote the attached program by modifying various examples from discussions around the web. The program is working but the frames I capture are only 640x480 pixels. How can I capture higher resolution frames?
(I have found the class "org.opencv.highgui.VideoCapture" , which I note has a method "set" including property identifiers CV_CAP_PROP_FRAME_WIDTH and CV_CAP_PROP_FRAME_HEIGHT but I don't understand how I would use this class in my application.)

Here is the output from System.out when I run the program:
***** VIDEOINPUT LIBRARY - 0.2000 - TFW2013 *****
SETUP: Setting up device 0
SETUP: Logitech HD Pro Webcam C920
SETUP: Couldn't find preview pin using SmartTee
SETUP: Default Format is set to 640 by 480
SETUP: trying requested format RGB24 @ 640 by 480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.

Thanks in advance for any suggestions.
Joe
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe, Welcome to CodeRanch!

All the FrameGrabber subclasses inherit setImageWidth/setImageHeight methods from it. See https://github.com/bytedeco/javacv/blob/master/src/main/java/org/bytedeco/javacv/FrameGrabber.java#L216.
Just have to call those methods before start().

Note that org.opencv.* packages are part of OpenCV java, not javacv. These are two different frameworks.
Both wrap native opencv, but the wrapping class names and some functionality are different.

Also, if VideoInputFrameGrabber doesn't work, try OpenCVFrameGrabber. They use different native technologies for capturing, IIRC.

 
Joe Nikki
Greenhorn
Posts: 19
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karthik
Thanks very much for your reply. I am able to capture the 1280x 720 (~1 megapixel) frames. I still have not been able to capture the 5168 x 2907 (15 megapixel) frames but because of your suggestions I will be able to experiment and take a look at the FrameGrabber source code and possibly see what is going on. If I get stuck I will post back here again and ask for more help. It occurs to me that when the Logitech software captures a 15 megapixel snapshot it may be doing something different from just saving one of the (~1 megapixel?) video frames?.
Again, I really appreciate your reply.
Joe
PS-I liked your simplified forum participation policy. ;-)
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're most welcome!

Joe Nikki wrote:It occurs to me that when the Logitech software captures a 15 megapixel snapshot it may be doing something different from just saving one of the (~1 megapixel?) video frames?.

Yes, it's quite possible its driver or its software is simply scaling up the raw images. I have one camera whose true resolution is 1280x720 but its associated software (and its marketing!) reports it as 3MP.
All cameras report their actual resolutions. If you're on Linux, run the "v4l-info" command line utility. It'll report the true resolutions of the camera. I'm not sure how to do this in Windows; probably the Device Manager reports this, because it's required by the UVC USB specification.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!