Ask Your Question

Stereo_match.cpp to generate point cloud data

asked 2013-02-19 14:14:05 -0600

JosephWang gravatar image

updated 2013-02-19 14:47:27 -0600

berak gravatar image

I am using OpenCV 2.4.3 version. When I tried to use stereo_match.cpp to generate point cloud data from a pair of rectified stereo images, the function reprojectImageTo3D generated weird results. The point cloud data looks like a "cone" instead of the real shape of an object. Does anyone have the same experience? Are there other ways to generate 3D point cloud data from a pair of rectified stereo images in OpenCV?

Thank you,

edit retag flag offensive close merge delete


yea, same here.. if you take a closer look, it's more a pyramid( think frustum ) than a cone.

using better cameras and trying harder with the calibration (and the rigging of the cameras !) helped in the end.

also, there's a lot of things, that can go wrong in the blockmatching step.

i know it's not what you want in the end, but if you build a pointcloud just from x,y,depth (skipping the reproject step), at least you can look at what came out of the bm. (like a cube)

good luck!

berak gravatar imageberak ( 2013-02-19 14:31:57 -0600 )edit

I can generated a nice disparity image with intrinsics and extrinsics matrices if skipping the reproject step. However, if I incluesd the reproject step, it does give me a pyramid. Does this mean that my calibration wasn't quite right?

JosephWang gravatar imageJosephWang ( 2013-02-21 16:03:24 -0600 )edit

yea, at least it does not feel like a total failure this way ;) and yes, it's most probably the calibration, that's responsible for the 'overshooting' of the reprojection (it's supposed to apply a bit of frustum pyramid, but if it's done right, you should never even see any of it).

Also, related to the calibration, make shure , your cams stay as 'rigid' as possible after that, if you ever change the focus, their distance/direction, or even if your neighbour sneezes, you'll have to do it all again!

berak gravatar imageberak ( 2013-02-21 17:06:41 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-02-20 12:13:38 -0600

Did you try the sample with ''default'' images (aloeL.jpg and aloeR.jpg) provided with OpenCV? The python sample is generating a ply points cloud, that you can see with meshlab for example. If you have the same results, I agree with @berak that the calibration of camera is probably your issue.

edit flag offensive delete link more


I have tried this, but the 3D image is not well constructed. :(

MahamKhan gravatar imageMahamKhan ( 2013-11-01 06:09:10 -0600 )edit

Question Tools



Asked: 2013-02-19 14:14:05 -0600

Seen: 3,064 times

Last updated: Feb 20 '13