Relation of parameters such as CAP_PROP_EXPOSRE and CAP_PROP_BRIGHTNESS

Hi,
We use OpenCV to control some cameras. We set the CAP_PROP_EXPOSURE to a value so that our tracking systems works correctly.

Now we need to be sure that when connecting a new camera of the same brand and type it gives the same result. Is setting the Exposure enough? Or should we also set CAP_PROP_BRIGHTNESS? And maybe CAP_PROP_GAIN?

I understand what setting the exposure does. But what does setting brightness do? I just want the raw sensor information. No processing. Isn’t the exposure all that determines the sensor output values (when lens and light conditions are the same)?

So how to be sure we get the same results with a new camera.

exposure is proportional to the physical amount of light per single exposure. or it should be. it’s a combination of exposure time and aperture (if aperture can be affected)

“brightness” is some ancient concept from the 90s that merely adds a fixed number to every pixel.

gain is a factor multiplied onto raw sensor values before they are gamma-compressed.

you should set everything that may be affected by automatic adjustments. “brightness” is not, but gain and exposure and white balance are.

So I should set brightness to 0 and gain to 1 if I want no influence of those?
(it is a gray scale sensor, so white balance will do nothing)

Exposure is the value I store and set each time the camera is started.

leave them at default values. their scale may be implementation-defined. if brightness ranges from 0 to 255, its “resting” default might be 127 or 128, or it might range from -128 to +127, so its default might be 0. similar ideas for the gain. “unity” gain may be 1, or 10, or 100, or 128, or… nobody can say.

just look for properties that contain the word “auto”, and set those to 0.

even while auto-things do their autoing, you can look at the properties each auto-thing affects. watch those values change as you change the scene’s illumination.

My advice would be to get your system working in a way that you are happy with, and then query all of the settings that could have any effect on the image. Record these values and then make a function that sets all of the settings to the values you recorded, including the ones that were default values. Call this function whenever you open / initialize the camera.

I have had problems relying on the default values in the past. I’m not sure why, but sometimes it seems that the settings “stick” and something other than the default value is active immediately after initialization.

The ones that come to mind:
Brightness
Gain
Sharpness
Power line frequency
Gamma
White balance
Exposure mode (disable auto exposure)
Exposure value

Basically anything and everything that you think could possibly affect the image. Maybe it’s just a quirk with the cameras I use, but relying on default values for settings I “don’t care about” has caused some pain.