-1

I capture some image data from a HD cam using OpenCV and this code (relevant snippets only):

data->capture =cvCaptureFromCAM(data->config.device); // open the device
...
IplImage *grabFrame=cvQueryFrame(data->capture);

Using this code I always get a grabFrame with a size of 640x480 while the camera supports 1920x1080. When I do something like that after initialisation:

cvSetCaptureProperty(data->capture,CV_CAP_PROP_FRAME_WIDTH,1920);
cvSetCaptureProperty(data->capture,CV_CAP_PROP_FRAME_HEIGHT,1080);

I get results in real HD resolution - but blurred images, means it is only upscaled from 640x480 to HD resolution. So: how can I force OpenCV to really use the fill native resolution?

It does not seem to be a driver/HW problem since it happens on Windows and Linux - and when I try any other application on these systems I get the full, native resolution as expected.

Thanks!

Elmi
  • 5,899
  • 15
  • 72
  • 143

2 Answers2

0

1. From (old) opencv C documentation :

The function cvSetCaptureProperty() sets the specified property of video capturing.     
Currently the function supports only video files: CV_CAP_PROP_POS_MSEC, CV_CAP_PROP_POS_FRAMES, CV_CAP_PROP_POS_AVI_RATIO.

2. You can try to compile opencv with openNI since VideoCapture class make use of it for setting capture device options.

Eric
  • 2,301
  • 3
  • 23
  • 30
  • Using cvSetCaptureProperty() was just a test - I'd be happy to just get the default video size size out of it - without setting any properties. In my case default would be HD resolution and everything would be fine... – Elmi Apr 02 '13 at 16:34
  • Have you check that your camera is in this list ? http://opencv.willowgarage.com/wiki/Welcome/OS You could try to update driver and see if it solve the pb. – Eric Apr 03 '13 at 08:37
  • But the camera shouldn't be the problem .. Could you try this `cvSetCaptureProperty(data->capture,CV_CAP_PROP_FRAME_WIDTH,1919);` and report what append ? – Eric Apr 03 '13 at 08:43
  • Why should that list of supported HW be important? OpenCV *should* use Video4Linux / DirectShow to retrieve the images while everything hardware-dependent should be done by underlying drivers. Drivers itself should be fine too since other software uses the correct resolution. I tried to set the size to 1919 as suggested - at least for Linux it does not make any difference. I'll do another test with Windows. – Elmi Apr 03 '13 at 15:37
0

It helped me:

static const int MAX_WIDTH_RESOLUTION = 7680;
static const int MAX_HEIGHT_RESOLUTION = 4800;

cvCreateCameraCapture(...);
cvSetCaptureProperty(pCam, CV_CAP_PROP_FRAME_WIDTH, MAX_WIDTH_RESOLUTION);
cvSetCaptureProperty(pCam, CV_CAP_PROP_FRAME_HEIGHT, MAX_HEIGHT_RESOLUTION);
cvQueryFrame(...);

With two different webcams i've got 1900x1080 and 1280x960 frames.