🛠 Vision stéréo : deux caméras CSI sur un CM3

Raspberry Pi Compute Module 3 (CM3 / CM3L) · avance · Schéma : deux caméras Raspberry Pi reliées aux deux connecteurs CSI du CM3 sur carte CMIO3 — CSI 4 voies (caméra gauche) et CSI 2 voies (caméra droite) — avec la note « pas de genlock : dérive de quelques millisecondes ».

Objectives

Leverage one of the Compute Module format's key advantages: two simultaneous CSI interfaces (one 4-lane + one 2-lane) for stereo or multi-camera vision on a single module. The CM3 manages both cameras via the Pi 3 firmware, using the command raspistill -n <number>. A critical point documented by the Raspberry Pi firmware engineer on the launch blog: camera modules expose no genlock signal — hardware synchronization is impossible, and drift between the two streams is measured in milliseconds, uncorrectable in hardware.

Hardware

Complete code

# config.txt : activer le support multi-caméras (firmware Pi 3)
sudo tee -a /boot/firmware/config.txt <<'EOF'
start_x=1
camera_auto_detect=1
EOF
sudo reboot

vcgencmd get_camera        # attendu : supported=2 detected=2

# Capture sur les deux caméras (capteur 0 = CSI 4 voies, 1 = CSI 2 voies)
raspistill -n 0 -o gauche.jpg -t 500 -w 1280 -h 720 &
raspistill -n 1 -o droite.jpg -t 500 -w 1280 -h 720
wait

# Horodater chaque trame pour mesurer la dérive de synchronisation
python3 - <<'EOF'
import subprocess, time
for n in (0, 1):
    t0 = time.time
    subprocess.run(['raspistill', '-n', str(n), '-o', 'cam%d.jpg' % n, '-t', '1'])
    print('cam%d capture finie a +%.0f ms' % (n, (time.time-t0)*1000))
EOF

Expected verification

vcgencmd get_camera returns supported=2 detected=2; two JPEGs are produced. The small timestamping script reveals discrepancies of a few milliseconds between the two captures: this is the expected drift, without genlock. For correct stereo, plan for a static scene or a software alignment algorithm using image correlation.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials