Triangulate Chessboard gives weird results
Hi all,
So I'm trying to create a projection in 3D with use of stereo camera with use of Python.
I found the intrinsic camera calibration parameters, which seem good. Then I find the chessboard corners on both images with :
_, C1 = cv2.findChessboardCorners(img1, (6, 9), None)
.
I undistort the found corners with:
C1Norm = cv2.undistortPoints(C1, K1, D1)
And use those to find the essential matrix with:
E, mask = cv2.findEssentialMat(C1Norm, C2Norm, focal=1.00, pp=(0., 0.), method=cv2.RANSAC, prob=0.999)
.
And at last I find the rotation and translation between the cameras with:
M, R, t, mask = cv2.recoverPose(E, C1Norm, C2Norm)
.
Now with use of that I find the projection matrix of both cameras;
P1 = K1 * [I3 | 0]
and P2 = K2 * [R | t]
where K1 and K2 are the intrinsic camera parameters and I is an 3x3 identity matrix.
Last step now should be to triangulate. I use 4D = triangulatePoints(P1, P2, C1Trans, C2Trans)
which gives me the 4D coordinates.
However, when I plot this, my chessboard is all crooked and wrong. Has anyone any idea where something might go wrong?
Also, I know the dimensions of the chessboard, any idea how I can turn the homogeneous coordinates of the chessboard corners to cm?