Ask Your Question
7

How to increase the quality of Disparity Map?

asked 2013-03-18 03:02:59 -0600

I am working on stereo images. After doing camera calibration and everything, I am trying to get a depth image. But depth image depends on the disparity map and I am not getting proper disparity map.

Here is a screenshot of my Disparity Map. (It shows only one image, but I have two images from two diff webcams separated by around 3cms)

image description

I am using StereoBM and following are the values that I have set.

StereoBM sbm;
sbm.state->SADWindowSize = 25;
sbm.state->numberOfDisparities = 64;
sbm.state->preFilterSize = 27;
sbm.state->preFilterCap = 63;
sbm.state->minDisparity = 0;
sbm.state->textureThreshold = 20;
sbm.state->uniquenessRatio = 9;
sbm.state->speckleWindowSize = 0;
sbm.state->speckleRange = 4;

I want Disparity Map generation to be real time. Graph Cut algorithm seems to take a lot of time. Is there any method by which I can increase the quality of Disparity Map?

edit retag flag offensive close merge delete

Comments

Martin Peris has a neat tool to adjust the states for the block method: http://blog.martinperis.com/2011/08/opencv-stereo-matching.html

Ralph058 gravatar imageRalph058 ( 2013-03-18 06:46:14 -0600 )edit

Actually, I have used that program to get these values. But can't figure out how to get better quality.

jayrambhia gravatar imagejayrambhia ( 2013-03-18 07:25:25 -0600 )edit
2

As a guess, I would use a lower window size and fewer disparities. The larger the window size, the fewer fine details. I use 5 to keep the processor time to a minimum and 7 looks a little better, but after that, it looks worse. The algorithm doesn't seem to work well if the number of disparities gets too high, in some cases.It will work better if you set the minimum number of disparities near the disparity at the range of your closest subject (it will be non-zero). There is a simple formula out there to calculate the disparity, but most authors want to get too esoteric. Solving this guy's range equation for disparity will work. https://code.google.com/p/sentience/wiki/StereoRanging

I think that the texture threshold looks too high. I will give you my numbers when I get to the office.

Ralph058 gravatar imageRalph058 ( 2013-03-18 10:02:32 -0600 )edit

@jayrambhia, did you end up finding a way to get better quality out of the disparity map?

lazd gravatar imagelazd ( 2013-05-31 16:53:36 -0600 )edit

yeah. I have added those parameters here. http://jayrambhia.com/blog/disparity-maps/

jayrambhia gravatar imagejayrambhia ( 2013-06-02 05:31:56 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-03-18 14:32:22 -0600

Ralph058 gravatar image

updated 2016-09-22 09:04:28 -0600

StereoBM sbm;
sbm.state->SADWindowSize = 5;
sbm.state->numberOfDisparities = 112;  //large baseline
sbm.state->preFilterSize = 5;
sbm.state->preFilterCap = 61;
sbm.state->minDisparity = -39;          // large (30cm) baseline and 36 pixel offset toward
                                        // centerline on each camera (72 pixel preset disparity)
sbm.state->textureThreshold = 507; //there appear to be multiple minima with this function
sbm.state->uniquenessRatio = 0;    //I used 5 with good results with other settings above
sbm.state->speckleWindowSize = 0;  //I used 2 ""
sbm.state->speckleRange = 1;       //I used 9 ""
edit flag offensive delete link more

Comments

Hello, I can't find a documentation explaining how to choose the correct values to insert in each variable. Can someone please help me?

Lu gravatar imageLu ( 2016-09-22 16:33:01 -0600 )edit

I'm looking for it too

torugo gravatar imagetorugo ( 2017-10-04 14:11:31 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2013-03-18 03:02:59 -0600

Seen: 14,067 times

Last updated: Sep 22 '16