My aim is to enforce a short exposure time (of 10000 us) to freeze the motion of fast objects when detecting (with frame differencing) them in an environment with changing lights. Thus, I need exposure control while white balance and gain are still automatic, just like in any camera “S” (shutter speed) control mode.
I thought it would be enough to do:
sensor.set_auto_exposure(False,
exposure_us = 10000)
and then the camera would automatically adjust the gain to keep obtaining a bright enough image in all conditions, since white balance and gain are automatic by default?
However, when doing this, the somehow the image keeps being dark, and I don’t want to set a manual gain dB value due to the changing light. Is it the night_mode that causes problems?
I determined the gain ceiling from the maximum gain_dB I could set the sensor to manually when auto_gain is False (~ 36 dB).
For custom_exposure values between 10 000 and 160 000, I get very dark pictures. Starting from 170 000 us, the picture suddenly brightens up.
However, even though I tried all increments of 10 000 us in that range, when I reach the 170 ms threshold, the camera does not even go to its maximum gain_ceiling value that is possible, it only goes up to ~ 23 dB.
My non-expert interpretation is that the sensor does to even try to match the standard brightness when it is too hopelessly dark (below 170 ms exposure time in my special scene). It only tries to match the standard brightness when it has a chance to reach the standard brightness, BUT it does not even make use of its maximum gain_dB of 36 dB even though the gain_ceiling was set above that (at 37 dB).
Is something wrong? Could it be related to night mode? How can I make the camera brighten the picture as much as it can to reach a standard brightness, and make use of its maximum gain level with auto_gain?
What sensor are you using? What camera model? We support a lot of different camera sensors… the code for our driver and the sensor datasheet is online. I’ll send you the link and you can look if I missed anything on the control.
Also, you can manually edit registers using sensor.__write_reg()/sensor.__read_reg().