July 28, 2015
Fixing incorrect Raspberry Pi Cam auto exposure
Are your pictures coming out too bright or dark under reasonable lighting conditions? Check your timeout value (the -t
parameter in raspistill -t 100 -o cam.jpg
.
I took a bunch of pictures using raspistill -t 100
and didn’t understand why they were overexposed on an average, sunny day. I tried different metering, exposure, and exposure compensation modes, but none of them consistently improved the image. I didn’t realize what was happening until I tried running raspivid
and watched the camera adjust its own exposure for the first few seconds.
Under normal usage, raspistill
turns on the camera and prepares it to take a picture. With -t 100ms
it only waits 100ms to take a photo, which isn’t enough time to adjust the exposure. I found the camera needs at least 1000ms to get close, and about 2000ms to settle on something good. Increasing the timeout to 2000ms solved the issue for me. Delaying taking the photo by 2000ms was not an issue in my use case.
If you can’t wait 2 seconds, look into Signal Mode (--signal
), which lets you turn the camera on early, and then trigger taking a picture at the right moment with another command rather than relying on a timer. The time between turning on and triggering the photo may be enough for the camera to adjust its exposure.