Opencv – Increasing camera capture resolution in OpenCV


In my C/C++ program, I'm using OpenCV to capture images from my webcam. The camera (Logitech QuickCam IM) can capture at resolutions 320×240, 640×480 and 1280×960. But, for some strange reason, OpenCV gives me images of resolution 320×240 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?

Best Solution

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