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. It is shown here: (imgur.com/XETnDZB)
Then i caluclated a disparity map from the 2 rectified images. The result is looking quite good.
It is shown here: (imgur.com/nP08XN9)
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. It is shown here: (imgur.com/LNkrf7j) and (imgur.com/bE7Mfk9)
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);