Skip to content

yuhsienchiang/semi-global-matching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stereo Disparity: Semi-Global-Matching and Normalized Cross-Correlation

Stereo matching is the problem of finding correspondences between two images that are taken simultaneously from two cameras that are mounted so that they are parallel and separated along their x-axis. The output of stereo matching is a disparity image that, for every pixel in the left image (x), indicates how many pixels to the left its correspondence (x’) is in the right image, giving the disparity (x-x’).

The primary objective of this project is to address the stereo disparity problem by integrating the Normalized Cross-Correlation (NCC) algorithm with the Semi-Global Matching (SGM) algorithm. In addition to this integration, this project focuses on optimising the performance of these algorithms.

One aspect of optimisation involves re-formulating the NCC function for improved efficiency. Furthermore, I implement caching mechanisms to store reused data, thereby reducing computational overhead. For accelerating the SGM algorithm, I employ tensor operations in NumPy rather than conventional pixel-by-pixel iteration. This approach significantly enhances the computational efficiency of the algorithm.

Results

Left Image Right Image
Original
NCC Disparity
SGM Disparity

Runtime Improvement

Standard NCC Accelerated NCC
Runtime 517.14 (s) 255.15 (s)

Usage

The main code is in semi_global_match.ipynb

Dependencies

The project uses python==3.12.2, and the dependencies can be installed by running:

pip install -r requirements.txt

Credits

  • Yu Hsien Chiang, Thomas Chen

References

About

Stereo disparity estimation by Normalized Cross Correlation, SGM algorithms, and performance optimization.

Topics

Resources

Stars

Watchers

Forks