Ask Your Question
0

what's the coordinate relations between disparity image and the rectified images(the left or right view).

asked 2016-03-16 08:54:23 -0600

german_iris gravatar image

updated 2017-10-04 13:11:18 -0600

what's the coordinate relations between disparity image and the rectified images(the left or right view)?

I use the following block-matching functions,and the parametes are as follow.

//computer stereo correspondence using the semi-global 
//block matching algorithm
Ptr<StereoSGBM> sgbm = StereoSGBM::create(0, 16, 3);
int numberOfDisparities = ((imageSize.width / 8) + 15) & -16;
sgbm->setPreFilterCap(63);
int sgbmWinSize = 9;
sgbm->setBlockSize(sgbmWinSize);
int cn = gviewLeft.channels();
sgbm->setP1(8 * cn*sgbmWinSize*sgbmWinSize);
sgbm->setP2(32 * cn*sgbmWinSize*sgbmWinSize);
sgbm->setMinDisparity(0);
sgbm->setNumDisparities(numberOfDisparities);
sgbm->setUniquenessRatio(10);
sgbm->setSpeckleWindowSize(100);
sgbm->setSpeckleRange(32);
sgbm->setDisp12MaxDiff(1);
sgbm->setMode(1);

And I get a diaparity image successfuly image description

And the stereo rectification result is as follow image description

I want to re-construction the 3d surface. But which pixel in the original images corresponds to the disparity values whose coordinates are (x,y)?

to express my question clearly, let me say something more about it. if I get a disparity value whose corrdinates are(x,y)(I uploaded a simple illustration to express this intuitively), how can I find the corresponding pixel in the stereo rectified images(the left or the right).

image description

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-03-16 09:43:25 -0600

Oguzhan gravatar image

Disparity map is calculated w.r.t left image, i.e the (x,y) pixel in disparity map corresponds the (x,y) pixel in left image. On the other hand, the pixel in the right which corresponds to that pixel is not accessible in OpenCV's Semi Global Block Matching algorithm as far as I know. You need to go deeper in the source code.

edit flag offensive delete link more

Comments

thx. I campared the two images. it seems that you are right.

german_iris gravatar imagegerman_iris ( 2016-03-18 09:49:31 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-03-16 08:54:23 -0600

Seen: 998 times

Last updated: Mar 16 '16