Ask Your Question

How to get the right view disparity map with OpenCV 3.0

asked 2015-12-10 03:06:42 -0500

jess_c gravatar image

I want to get left and right view disparity map. I tried the disparity_filtering.cpp sample from OpenCV 3.0 on the aloeR.jpg and aloeL.jpg. I get a left raw disparity map. When I want to show the right raw disparity map, I only get black image (full zeros). I used getDisparityVis() as done with the left view. Why the image is black ? How can I get right view disparity map with few computation.

Other question : Is it possible to use WLS filter on the right view ?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-06-22 14:36:26 -0500

Dean gravatar image

I believe this is due to negative disparity values. If you look at the source code for createRightMatcher it is setting a negative minimum disparity since it now represents right to left disparity.

I got around this by using a scale factor of -1 in getDisparityVis.

I've also found good results by flipping the left and right images horizontally, using just the same left matcher to do disparity, then flipping the disparity map back. But for some reason the filter does not like this, it seems to break filtering I think because the images don't align as expected. I didn't get a chance to figure that one out yet.

Hope this helps.

edit flag offensive delete link more

answered 2016-01-25 02:41:52 -0500

These days I started to use OpenCV 3.1 with opencv_contrib and I encountered exactly the same problem as yours. Then I tried the following stereo pair instead: opencv_contrib-master/modules/ximgproc/tutorials/images/ambush_5_left.jpg & ambush_5_right.jpg. The result looks the same as what described in

All I can guess is maybe aloeL.jpg & aloeR.jpg are not "rectified" images, i.e., they are not ready for block matching, therefore the matching result is bad.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2015-12-10 03:06:42 -0500

Seen: 443 times

Last updated: Dec 10 '15