Important Bits

Fixing incorrect Raspberry Pi Cam auto exposure

July 28, 2015

Are your pictures coming out too bright or dark under reasonable lighting conditions? Check your timeout value (the -t parameters in raspistill -t 100 -o cam.jpg.

I took a bunch of pictures using raspistill -t 100 and didn’t understand why they were coming out over exposed 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 raspivid and watched the camera adjust itself for the first few seconds within turning on.

Under normal usage, raspistill turns on the camera and prepares it to take a picture. After 100ms, it hasn’t had enough time to adjust the exposure. I find it needs at least a 1000ms to get it close, and about 2000ms to settle the correct value. 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 for the timeout, look into Signal Mode, which would let you turn the camera on early, and then trigger taking a picture with another command. The time between those two commands maybe enough for the camera to adjust its exposure.

Adam Sullovey

Written by Adam Sullovey, powered by Gatsby.
Find me on codepen, github, or at Toronto meetups.