Occasionally corrupted images with Multicam V2.2

I have a Raspberry Pi 3a with the Multicam 2.2. I have 3 cameras connected to ports A, B and C. I need to take pictures from each of them with very low frequency, but need the full resolution and control over exposure. Typically everything works well, but once every 10 images or so the image from camera A comes out wrong, like the image below.

The code I use is below.

Is there anything I can do to fix it?

i2c = “/usr/sbin/i2cset -y 1 0x70 0x00 0x04”
os.system(i2c)
gp.output(7, False)
gp.output(11, False)
gp.output(12, True)
time.sleep(1)
with PiCamera() as camera:
camera.annotate_background = picamera.Color(‘black’)
camera.annotate_text = datetime.datetime.now().strftime(’%Y-%m-%d %H:%M:%S’)
camera.resolution = (3280,2464)
print(“Starting camera 1 warmup preview”)
camera.start_preview()
time.sleep(5)
print("Camera 1 Exposure Parameters: Speed: “, camera.exposure_speed, " AWB: “, camera.awb_gains);
speed = camera.exposure_speed;
awb = camera.awb_gains;
camera.exposure_mode = ‘off’
camera.awb_mode = ‘off’
camera.shutter_speed = speed
camera.awb_gains = awb
camera.capture(”{0}-1.jpg”.format(name))

i2c = “/usr/sbin/i2cset -y 1 0x70 0x00 0x05”
os.system(i2c)
gp.output(7, True)
gp.output(11, False)
gp.output(12, True)
time.sleep(1)
with PiCamera() as camera:
camera.annotate_background = picamera.Color(‘black’)
camera.annotate_text = datetime.datetime.now().strftime(’%Y-%m-%d %H:%M:%S’)
camera.resolution = (3280,2464)
camera.exposure_mode = ‘off’
camera.awb_mode = ‘off’
camera.shutter_speed = speed
camera.awb_gains = awb
print("Camera 2 Exposure Parameters: Speed: “, camera.exposure_speed, " AWB: “, camera.awb_gains);
camera.capture(”{0}-2.jpg”.format(name))

i2c = “/usr/sbin/i2cset -y 1 0x70 0x00 0x06”
os.system(i2c)
time.sleep(1)
gp.output(7, False)
gp.output(11, True)
gp.output(12, False)
with PiCamera() as camera:
camera.annotate_background = picamera.Color(‘black’)
camera.annotate_text = datetime.datetime.now().strftime(’%Y-%m-%d %H:%M:%S’)
camera.resolution = (3280,2464)
camera.exposure_mode = ‘off’
camera.awb_mode = ‘off’
camera.shutter_speed = speed
camera.awb_gains = awb
print("Camera 3 Exposure Parameters: Speed: “, camera.exposure_speed, " AWB: “, camera.awb_gains);
camera.capture(”{0}-3.jpg”.format(name))

Corrupted Image

Strange! The code seems no problems. Don’t worry and I will tell our engineer to test it tomorrow.

Thank you!

For now, I work around it by running the full camera A capture sequence twice (i2c, gpio, capture) and just throwing away the first result. The next captures after the first one are all good consistently (I am now up to 9 captures: 3 cameras, each taking 3 pictures to produce HDR).

Still, this is inelegant and a proper solution would be great.

Hello,

Because the hardware clock is not absolutely synchronized, we can’t ensure the start time of next frame. So if we take pictures continuously, the wrong picture will appear.

The best way is to throw the first result.