I would like to find the camera position based on the marker and use it as a ground truth. I use the following code to find the pose with solvepnp.
retval, rvec, tvec, inliers = cv2.solvePnPRansac(objPoints, imgPoints, K, None, None, None, False ,method)
K
is the camera matrix , imgpoints
is the corners, objpoints
is the model points. Based on these values, I calculated the camera position using the following code,
gt_camPos = np.dot(-np.transpose(rot_mat), tvec)
I have used the above camera position as the ground truth. I have a QR code which is attached next to the marker. I computed the camera position using the QR Code as well as using the same method. However, both camera positions deviate a lot. why is that so? Is there a way to create proper ground truth for camera position?