Introduction

Stereovision project was created to use a stereo camera pair to reconstruct a 3D scene with help of OpenCV.

The program allows to apply and tune the stereo vision capabilities of OpenCV. It is possible to rectify the cameras, create a disparity map and test depth map creation. The source of the data may be a static stereo image or a camera pair directly. The program is controlled with parameters placed in the config file. It runs in 4 modes:

  • Capturing chessboard images from the stereo camera pair - needed for rectification.
  • Preparing the rectification, it uses the chessboard images captured during the first phase.
  • Scene reconstruction from a stereo image pair.
  • Scene reconstruction from a stereo camera pair.

Hardware

To use program you need a stereo camera pair. I used two USB webcams that was glued to a stable basic as it is visible in the image below. The camera model is Canon Live! Cam Sync HD VF0770 (about 15&euro / 20$ each one) mainly to be sure that Raspberry Pi supports it as a part of other project. The problem was pretty large noise what impacted the depth reconstruction. More advanced hardware should give better results.

The distance between cameras was about 8cm. It is not necessary to put them ideally aligned, it is a task for rectification stage.

Stereo Vision

Example results

Below some captured screens of the program usage:

Left after rectification Right after rectification

Rectified left and right

Stereo Vision Stereo Vision

Tuning

Links

Source code at github

Youtuve movie