Ask Your Question

in stereo matching is the disparity always to the left?

asked 2013-03-12 08:15:58 -0500

osmander gravatar image

updated 2013-03-12 08:26:55 -0500


I am trying to use stereo matching implementations of OpenCV. (StereoBM,StereoSGBM). But i am having some problems. The resulting disparity maps are always crop from one side.

OpenCV assumes that the disparity between a pair of rectified stereo image is always to left (is this correct?). I have some pairs where the disparity is both to the right and to the left. For the upper part of images, it is to the right then around middle it becomes almost zero and it switches towards left.

Therefore i have to assign a large disparity interval. This results in crop disparity images. Do you have any idea how to apply StereoBM or StereoSGBM for images like the ones i have?


edit retag flag offensive close merge delete


Can you post some of the image pairs?

Victor1234 gravatar imageVictor1234 ( 2013-03-13 07:10:47 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2013-03-14 12:56:49 -0500

xaffeine gravatar image

updated 2013-03-14 12:57:21 -0500

Yes, the correspondence functions assume the first image is from the left camera and the second one is from the right. If you want the opposite, you can flip the input images and then flip the results.

The situation you describe sounds very unusual, though. Are you using a pair of actual cameras and have you done calibration and rectification?

edit flag offensive delete link more

answered 2013-05-17 12:14:12 -0500

chris_chris gravatar image

I don't understand clearly what you explain. But I think, the disparity can be derived only for the overlapping area. Or sometimes in the BM algorithm you have to play with the parameters to get the correct disparity map.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-03-12 08:15:58 -0500

Seen: 1,090 times

Last updated: May 17 '13