1

I'm using Open CV 2.4.6 with C++ (with Python sometimes too but it is irrelevant). I would like to know if there is a simple way to get all the available frame sizes from a capture device?

For example, my webcam can provide 640x480, 320x240 and 160x120. Suppose that I don't know about these frame sizes a priori... Is it possible to get a vector or an iterator, or something like this that could give me these values?

In other words, I don't want to get the current frame size (which is easy to obtain) but the sizes I could set the device to.

Thanks!

dom_beau
  • 2,437
  • 3
  • 30
  • 59

1 Answers1

1

When you retrieve a frame from a camera, it is the maximum size that that camera can give. If you want a smaller image, you have to specify it when you get the image, and opencv will resize it for you. A normal camera has one sensor of one size, and it sends one kind of image to the computer. What opencv does with it thereafter is up to you to specify.

William
  • 26
  • 5
  • Hello William! I tough the hardware itself could be set to smaller framesize (hardware binning or hardware decimation) to save time (say increase frame rate). So What does framerate change do? Changes in the integration time? – dom_beau Nov 20 '13 at 02:36
  • You are right, I stand corrected. I am not an expert on cameras and maybe should not have been so hasty to reply. As far as opencv is concerned, I don't believe that there is a way to get the information you need. I am using the opencv reference manual found [here] (http://docs.opencv.org/opencv2refman.pdf), the VideoCapture::get description on page 352 does not specify any handle for that information. – William Nov 20 '13 at 03:03
  • You're right. I use OpenCV for a long time now but I never faced this requirement. So I found nothing about it and it is why I asked the question. Hope someone else has an idea...? – dom_beau Nov 20 '13 at 03:34
  • 1
    Also the default frame-size returned is not necessarily the largest one and is probably defined by the camera driver not opencv. – littleimp Nov 20 '13 at 12:54
  • @littleimp that is probably true, my comments regarding cameras were based on limited experience and as it turns out were wrong. As far as I can tell, openCV is more of an image processing library and not a camera interaction program, as evidenced by lack of support for such things as white balance, wide dynamic range etc. Perhaps a commercially available program for camera interaction could be set up between the camera and openCV, although complexity and/or speed cost may be an issue. Also a C++ program interacting directly with the camera drivers could be written. – William Nov 20 '13 at 13:08