/stereopi-tutorial

StereoPi OpenCV depth map examples

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

StereoPi tutorial scripts

Set of Disparity Map tutorial scripts for StereoPi board with CM3/3+ inside.

Brief tutorial: article in our Blog

Was tested in the following environment:

Critical notice!

In the latest Raspbian kernels stereoscopic support has been occasionally broken by implementing new AWB algorithm. You can read some details here. Our Raspbian image provided has no such a problem, but you can get it after 'apt-get upgrade' or 'rpi-update'.

Current solution: after boot run once this command before accessing your cameras:

sudo vcdbg set awb_mode 0

This will turn AWB algo to the previous mode, and stereo works again untill next reboot. So run this command after reboot, or add it to your autorun script.

Ready-to-use Raspbian Image:

Download link 1 (Yandex Disk)

Download Link 2 (Google Drive)

Important notice for Linux users.

I'd like to thank tuxlifan user for this information!

WARNING for Linux users: please do NOT use unzip to extract the zip file but use "7z e stereopi-opencv-20190405.zip" instead.

Checksum for stereopi-opencv-20190405.zip file is: sha256: 6c7a5714db03aae07aeb009483f3fcd0fa43356280da071fdc3bad31dfe6f0c4 md5: fa82c9b997f6797c8445602b933b6ae4)

md5sum using unzip (and getting an error message about "Bad CRC"): 3ce7a63479ffa65fc923297d1fa01792 md5sum using 7z: 8dbe549e3a467a583a961bad85e45ca1

Brief scripts description:

Press 'Q' key in any script for exit, as we added key stroke processing. Do not kill it by Ctrl+C :)

1_test.py - starts camera preview, save captured image if 'Q' button pressed.

Video: https://www.youtube.com/watch?v=wllLrNUw3SE

2_chess_cycle.py - takes a series of photos for stereopair calibration, shows countdown timer. You need a printed chessboard with 9x6 parameters (file "pattern.png" included).

Video: https://youtu.be/1XCAlU3k-xs


3_pairs_cut.py - just cuts all captured photos to left and right images.

Video: https://youtu.be/95DWmPECbDc


4_calibration.py - calibrate StereoPi cameas setup using pairs from script 4.

Video: https://youtu.be/vtPhu23tKGo


5_dm_tune.py - script for fine tune of disparity map settings.

Video: https://youtu.be/Z4j3NrMyeGE


6_dm_video.py - builds disparity map in real time.

Video: https://youtu.be/f29arVstfZA