I have read lots of questions both here on stackoverflow and on OpenCV Q/A, but still I can't solve my problem.
I need to estimate the world coordinate of my camera. This is my workflow:
First of all, I need to calibrate my camera. To speed up things, I'm using a virtual camera. Therefore I have rendered some images. This is an example:
I've rendered 10 of them. Since it a CG camera, I already know all its parameters, but the project will eventually use real camera, so I need to calibration process. To calibrate my camera, I'm using
cv2.calibrateCamera()
. This function gives me:camera matrix
distortions
rvecs
tvecs
Matrix camera is OK since its values match those of my virtual camera.
Now I'd like to see if I can estimate the position of the camera in the image D using
tvec
andrvec
related to image D. To do so, I'm doing:Get rotation matrix R with:
cv2.Rodrigues(rvec, R)
Get the position of the camera with:
C = - np.matmul(R.T, tvec)
Unfortunatly, the position C completely differs from the position of the camera in the 3D software.
Finally, I have no idea on how to use rvec
to estimate the rotation of the camera so that it sees the chessboard pattern in the same way the virtual camera does in the 3D software.