This is a C++ application for 3D image reconstruction from two images using stereo vision technique. Stereo pair was obtained with two low resolution web cameras.
stereo-vision-3D-reconstruction.mp4
- Two webcams or stereo camera
- openCV 3.4.0 (with
contrib
module) - A chessboard pattern
pattern.png
which you can download from here
- Print the chessboard pattern and paste it on a hard surface or display it on your phone or tablet. The print/image needs to be as straight as possible!
- Capture multiple images of the chessboard pattern from the different views (as you can see here) for calibration using
takeChessboardImages()
function fromcamera_calibrator.cpp
. - I have included one stereo pair. You need to make your own with the cameras you calibrated. Create a stereo pair using
takeStereoPair()
fromcamera_calibrator.cpp
. - Finally, reconstruct the scene with
ReconstructPointCloud()
fromcamera_calibrator.cpp
.
* blendPictures()
is a helper function to ease the process of aligning the cameras for the stereo pair capture. It is not needed for reconstruction.
* opencv_world340d.dll
is compiled binary for Visual Studio 2017 32-bit. If you have some other IDE, you need to compile your own binary from source.
- Most of the theory behind the code is explained in 3-D Reconstruction with Vision by Venkatesh Tata
- Article about Viz from openCV contrib module: Viz - New 3D visualization module in the OpenCV library
- Instruction how to make your own binary: Build opencv 3.4 under windows 10 with contrib library, Git Source ,CMAKE ,Visual Studio 2017
- If you are interested in details about matrices for calibration, triangulation, etc. there is a great lecture by Cyrill Stachniss: Photogrammetry