Ask Your Question

Disparity on Vertical stereo

asked 2013-10-29 11:58:20 -0600

Alexandre Bizeau gravatar image

updated 2013-10-29 13:40:36 -0600

I use OpenCV 2.4.6 to rectify my stereo system.

The parameter matrix obtained after the stereoCalibrate and stereoRectify show that my system is vertical stereo, so the epipole line are vertical.

I don't know if that change something for the stereoBM/stereoSGBM algorithms but I don't have a good disparity map. I want to know what can I do to expect to have a nice disparity map with some uniform region.

My image are high-resolution 3000x4000 and well rectify. But when using stereoBM/SGBM to obtain my disparity map, the result are bad.So when I reproject, I have a bad point cloud. (I'm using PCL pcd_viewer). When I do stereoCalibrate, d = 4.15, so I think that mean it's the average pixel error of my calibration.

So their my result, this is an example of rectification.

image description

And this is an example of the disparity map obtain after that, so when I use reprojectImageTo3D(), I have a pretty bad cloud that look like a prism.

image description

So the question is: How can I use stereoBM/SGBM with vertical system to get a good result on disparity map and after be able to reproject it to get the cloud ?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-10-30 03:30:34 -0600

dave89 gravatar image

I see thet this post is old, but I write a reply for someone that has the same problem. I'm not an expert in computer vision, but I'm studing opencv for my master degree thesis.

The stereoBM doesn't support vertical epipolar lines; you can try to flip the images so that the lines become horizontal

edit flag offensive delete link more


How did you flip the images? I dont get it... :/ Tried cv::flip and keeping now cv::transcoder etc.

mojovski gravatar imagemojovski ( 2015-12-03 17:05:43 -0600 )edit

answered 2019-04-29 15:56:58 -0600

This is really old, but since I have stumbled upon here, I am adding the answer just in case someone else come looking.

You need to _rotate_ the images to ensure disparities are horizontal. 90 degree counter-clockwise rotation will be required for above case. Earlier answer mentions flipping the images, but the actual operation that you need is rotation (flip() is used in the process).

Assuming Mat imgL and imgR are the input images, rotate them as follows: Mat imgL_rotated, imgR_rotated; cv::flip(imgL.t(), imgL_rotated, 0); // Transpose and flip for 270 rotation cv::flip(imgR.t(), imgR_rotated, 0);

The output will be stored in img*_rotated Mats.

edit flag offensive delete link more

Question Tools


Asked: 2013-10-29 11:58:20 -0600

Seen: 2,510 times

Last updated: Apr 29 '19