stereoRectify, projectPoints, triangulatePoints
Hi, I am simulating 3D->2D->3D process. first, i project worldPoint to two camera points(left and right) then, use stereoRectify caculates the P1, and P2 finally use P1, P2 and two camera points to caculate the worldPointEst again.
If the the rvecL is 0 degree in all direction, WorldPoint=WorldPointEst
However, if i add any degree in x or y direction, WorldPoint != WorldPointEst (surpposed to be the same)
Any help for this? Thanks in advanced
----------------------------------------code sample---------------------------------------------------
projectPoints(worldPoint, rvecL, tvecL, cameraMatrix_L, distCoeffs_L, imagePoint_L);
projectPoints(worldPoint, rvecR, tvecR, cameraMatrix_R, distCoeffs_R, imagePoint_R);
stereoRectify(cameraMatrix_L, distCoeffs_L, cameraMatrix_R, distCoeffs_R, cv::Size(640,480), R_rotation_Matrix_rev, R_translation, R1, R2, P1, P2, Q);
for(int i =0; i<imagePoint_L.size(); i++)
{
triangulatePoints(P1, P2, Mat(imagePoint_L[i]), Mat(imagePoint_R[i]), worldPointEst);
}
Does anybody know how to simulate the rotation of right camera from left camera?
Could you state your origin in world coordinates? I think that stereoRectify creates coordinate system with the origin between the cameras (so returning two non zero rotation matrices). That means that results could be right, but in another coordinate system.
Try to do the process again with the worldPointEst -> 2D -> 3D. Let me know about the results I am really curious :)
EDIT: don't forget that triangulatePoints returns homogenous coordinates