Optimized (very fast) stereo matching algorithms in Python. It includes implementations of Block Matching, Dynamic Programming, Semi-Global Matching, Semi-Global Block Matching and Belief Propagation.
This project is a Python port of Stereo Matching Algorithms in MATLAB.
- Block Matching (BM)
- Dynamic Programming (DP)
- Semi-Global Matching (SGM)
- Semi-Global Block Matching (SGBM)
- Belief Propagation (BP)
- Dynamic Programming with Left–Right Axes DSI
- Dynamic Programming with Left–Disparity Axes DSI
- Belief Propagation with accelerated message update schedule
- Belief Propagation with synchronous message update schedule
- Belief Propagation with synchronous message update schedule (alternative approach)
All algorithms are accelerated for performance using NumPy.
Download the project as ZIP file, unzip it, and run the scripts.
- NumPy
- Matplotlib
- OpenCV (
opencv-python)
The project contains eight Python scripts, each implementing a different stereo matching algorithm. The files left.png and right.png contain the stereo image pair used as input.
To use a different stereo pair, replace these two images with your own. In this case, you must also adjust the disparity levels parameter in the script you are running.
You may optionally modify other parameters as needed. If the input images contain little or no noise, it is recommended not to use the Gaussian filter.
Below are the disparity maps produced by the different algorithms when using the Tsukuba stereo pair.
The two different approaches to Belief Propagation produce the same result.
- Stereo Matching Algorithms in MATLAB
- Block Matching for Stereo Matching
- Stereo Matching using Dynamic Programming (Left-Right Axes)
- Stereo Matching using Dynamic Programming (Left-Disparity Axes)
- Semi-Global Matching
- Semi-Global Block Matching
- Stereo Matching using Belief Propagation (Accelerated)
- Stereo Matching using Belief Propagation (Synchronous)
- Stereo Matching using Belief Propagation (Synchronous) - a different aproach
This project is licensed under the MIT License. See the LICENSE file for details.








