Increasing camera capture resolution in OpenCV

Ashwin Nanjappa picture Ashwin Nanjappa · Aug 18, 2008 · Viewed 76.8k times · Source

In my C/C++ program, I'm using OpenCV to capture images from my webcam. The camera (Logitech QuickCam IM) can capture at resolutions 320x240, 640x480 and 1280x960. But, for some strange reason, OpenCV gives me images of resolution 320x240 only. Calls to change the resolution using cvSetCaptureProperty() with other resolution values just don't work. How do I capture images with the other resolutions possible with my webcam?

Answer

Grifo picture Grifo · Apr 3, 2009

I'm using openCV 1.1pre1 under Windows (videoinput library is used by default by this version of openCv under windows).

With these instructions I can set camera resolution. Note that I call the old cvCreateCameraCapture instead of cvCaptureFromCam.

capture = cvCreateCameraCapture(cameraIndex);

cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, 640 );

cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, 480 );


videoFrame = cvQueryFrame(capture);

I've tested it with Logitech, Trust and Philips webcams