According to the Picamera Documentation in part 3.5 of the basic recipes section:
You may wish to capture a sequence of images all of which look the
same in terms of brightness, color, and contrast (this can be useful
in timelapse photography, for example). Various attributes need to be
used in order to ensure consistency across multiple shots.
Specifically, you need to ensure that the camera’s exposure time,
white balance, and gains are all fixed:
To fix exposure time, set the shutter_speed
attribute to a reasonable
value. Optionally, set iso
to a fixed value. To fix exposure gains,
let analog_gain
and digital_gain
settle on reasonable values, then set
exposure_mode to 'off'
. To fix white balance, set the awb_mode
to
'off'
, then set awb_gains
to a (red, blue) tuple of gains.
It can be difficult to know what appropriate values might be for these
attributes. For iso
, a simple rule of thumb is that 100 and 200 are
reasonable values for daytime, while 400 and 800 are better for low
light. To determine a reasonable value for shutter_speed
you can query
the exposure_speed
attribute. For exposure gains, it’s usually enough
to wait until analog_gain
is greater than 1 before exposure_mode
is
set to 'off'
. Finally, to determine reasonable values for awb_gains
simply query the property while awb_mode
is set to something other
than 'off'
. Again, this will tell you the camera’s white balance gains
as determined by the auto-white-balance algorithm.
The following script provides a brief example of configuring these
settings:
from time import sleep
from picamera import PiCamera
camera = PiCamera(resolution=(1280, 720), framerate=30)
# Set ISO to the desired value
camera.iso = 100
# Wait for the automatic gain control to settle
sleep(2)
# Now fix the values
camera.shutter_speed = camera.exposure_speed
camera.exposure_mode = 'off'
g = camera.awb_gains
camera.awb_mode = 'off'
camera.awb_gains = g
# Finally, take several photos with the fixed settings
camera.capture_sequence(['image%02d.jpg' % i for i in range(10)])
du normal_capture.png
anddu array_capture.png