I'm able to calculate the camera calibration using OpenCV in Python. However, what I really need is the projection matrix. Looking at the equations from the docs, it looks like this is P = K[R|T]
where K is the intrinsic matrix, R is the rotation matrix, and T is the translation vector. This is the code that I made to compute the projection matrix:
ret, matrix, distCoef, rvecs, tvecs = cv2.calibrateCamera([world_points], [corners], gray.shape[::-1], flags=cv2.CALIB_USE_INTRINSIC_GUESS)
K = matrix
R = cv2.Rodrigues(rvecs[0])[0]
T = tvecs[0]
RT = np.concatenate((R,T),axis=1)
P = np.dot(K, RT)
Is this correct? To my understanding, I should be able to check it by doing P * [x; y; z; 1] where (x,y,z) is a world point, and the output ought to be the corresponding pixel coordinate. I tried this, but the outputs look very wrong. Does this mean it was a bad calibration, or did I construct P incorrectly?