Computer stereo vision is the extraction of 3D information from digital images, such as obtained by a CCD camera. By comparing information about a scene from two vantage points, 3D information can be extracted by examination of the relative positions of objects in the two panels. This is similar to the biological process Stereopsis.
Stereo means solid and opsis means sight. Left and right images are shifted by some amount,this shift is disparity. This best disparity is used to obtain distances of object from camera,via depth maps.
Before finding the disparity, a matching is done between the two images, so that the similarities are found out, then the left out differences are nothing but disparities.
Well I present to you the code to find depth map using Stereo_BM through OpenCV.
Download the code here: https://github.com/abhi-kumar/OPENCV_MISC/blob/master/stereoBM.cpp
Compilation and usage:
open and terminal,move to the downloaded file’s location and type
a)chmod +x stereoBM.cpp
b)g++ -ggdb `pkg-config –cflags opencv` -o `basename stereoBM.cpp .cpp` stereoBM.cpp `pkg-config –libs opencv`
You can adjust the parameters in the image window.
You will get three windows like this :
Thank you 🙂