Ask Your Question

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

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

And the stereo rectification result is as follow

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).

edit retag close merge delete

1 answer

Sort by ยป oldest newest most voted

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.

more

Comments

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

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

Stats

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

Seen: 953 times

Last updated: Mar 16 '16