Wrong Point Cloud
Hello, i used two images from the same calibrated camera two obtain a point cloud.
First i rectified these images. The result is looking quite good.
Then i caluclated a disparity map from the 2 rectified images. The result is looking quite good.
Then i tried to calculate the point cloud using the reprojectImageTo3d()
-function and a self-constructed reprojection matrix Q, but the result is looking bad now.
My code snippet to calculate the point cloud is the following:
Mat XYZ(image_disparity.size(), CV_32FC3);
Q = (Mat_<double>(4, 4) << 1, 0, 0, -1520.69,
0, 1, 0, -1006.81,
0, 0, 0, -2759.48,
0, 0, 1, 0);
reprojectImageTo3D(image_disparity, XYZ, Q);
All the images of the workflow are here:
yea, that's admittedly terrible hard to get right. even with the correct Q matrix, it would only look ok from a certain viewpoint.
if you're just curious, how good disparity is, - maybe try to use (x,y,disparity/16) instead of reprojectImageTo3D(). it'll give you a "cube" , not a "pyramid" view, but imho, it's sometimes better this way.
oh, btw, did the "other" formula from the opencv3 book fare any better ?
I'm facing same problem. Epipolar line are wrong and disparity is bad...and my camera are basic webcam then color are differents
@berak: you can see the results at my link :D The formula is used is kind of the combination from your link and the opencv3 book.
@LBerger: Did you rectify both images? it doesn't look so...
@mirnyy Oops I forgot I have updated video (just press w in program)
What program do you mean?
@LBerger: That looks like a really messy disparity map.
@mirnyy: What's your z scale? It looks like the z is very exaggerated. I can't really tell for certain though.
@Tetragramm I'm agree. I think that image are not well rectified algorithm cannot find good disparities
@Tetragramm: What do you mean with "z scale"? I just used the Matrix Q like i wrote in my post...