4

I'm using the two OpenCV functions mentioned above to retrieve frames from my webcam. No additional properties are set, just running with default parameters.

While reading frames in a loop I can see that the image changes, brightness and contrast seem to be adjusted automatically. It definitely seems to be a operation of OpenCV because the image captured by the camera is not changed and lit constantly.

So how can I disable this automated correction? I could not find a property that seems to be able to do that job.

Elmi
  • 5,899
  • 15
  • 72
  • 143

2 Answers2

3

You should try to play around with these three parameters:

CV_CAP_PROP_BRIGHTNESS Brightness of the image (only for cameras) CV_CAP_PROP_CONTRAST Contrast of the image (only for cameras) CV_CAP_PROP_SATURATION Saturation of the image (only for cameras)

Try to set them all to 50. Also (if it won't help) try to change another camera capture parameters from documentation.

ArtemStorozhuk
  • 8,715
  • 4
  • 35
  • 53
  • That brings up an other question where I never found a solution for: what is the valid range for these values? 0..100? – Elmi Nov 13 '12 at 07:25
  • From opencv source (linux) I found that default range values are [0..255]. But before setting parameter they get this range from camera driver - so it depends on your environment. And which parameters have you tried? – ArtemStorozhuk Nov 13 '12 at 13:13
  • I tried to set 50, 5 and 1 for these properties - but all resulted in a way too bright image that was completely unusable. So I decided to let the camera do its auto-correction and to perform my own brightness/saturation/gamma/RGB correction afterwards. Same situation with CV_CAP_PROP_FRAME_WIDTH/_HEIGHT, I set the native resolution of the camera of 1280x960 but still get only 640x480 images back. So that does not seem to work as expected at least with v4l. – Elmi Nov 13 '12 at 21:19
0

To answer that for my own: OpenCV is buggy or outdated here.

  • it seems to be impossible to get images in native resolution of the camera, they're always 640x480; also forcing it to an other value by setting width and height properties does not change anything
  • it seems to be impossible to disable the automatic image correction, the properties mentioned above seem not to work
  • the brightness/contrast properties doesn't seem to work as well - or at least I could not find any good values for it or the automatic image correction always overrides them

To sum it up: I'd not recommend to use OpenCV for some more enhanced image capturing.

Elmi
  • 5,899
  • 15
  • 72
  • 143