Skip to content

An implementation of the block matching stereo vision algorithm.

License

Notifications You must be signed in to change notification settings

MohEsmail143/stereo-vision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stereo Vision

This project implements the block matching stereo vision algorithm. Two images Il and Ir (a left and a right image) are taken as input and the horizontal disparity (ie., shift) of pixels along each scanline is calculated. This is the so-called baseline stereo case, where the images are taken with a forward-facing camera, and the translation between cameras is along the horizontal axis.

Left and Right Original Images

Block Matching

The first way to get the disparity is by matching each pixel in the left image to a pixel in the right image. Since there is no rectification needed, the row in the left image is matched with its equivalent in the right image. Disparity is calculated in two ways:

  • once using the cost as the Sum of Absolute Differences (SAD).
  • another time using Sum of Squared Differences (SSD).

Do this for windows of size w where w = 1, 5 and 9. You will produce 6 maps: 2 maps for each window size, once using SAD and the other using SSD. The resulting image is a greyscale, where the lighter pixels are meant to be closer to the camera than the darker ones.

Disparity Images

This project was developed as part of the course Computer Vision in the Fall 2022 semester at the Faculty of Engineering, Alexandria University, under the Computer and Communications Engineering department, supervised by Dr. Marwan Torki.

Prerequisites

This project was developed in the following environment:

  • Jupyter Notebook
  • Miniconda
  • Python 3.11.5

Installing

1- Clone the repository to your local machine:

git clone https://github.com/MohEsmail143/stereo-vision.git

2- Open Jupyter notebook.

3- Check out the the Jupyter notebook stereo_vision_block_matching.ipynb.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.