H = K[R|t] where H (3*3) is homographic matrix, R is Rotation matrix, K is matrix of camera's intrinsic parameters and t is translation vector.
I have calculated K using chess board pattern as follows
ret, K, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, chess_gray.shape[::-1],None,None)
Homograpy matrix H is calculated as
pts_src = np.float32(pts_src)
pts_dst = np.float32(pts_dst)
H, status = cv2.findHomography(pts_src, pts_dst)
How to decompose R and t from H and K using
cv2.decomposeHomograpyMat(H,K,....)
How to write other inputs and outputs of above functions?
Assuming H as homography matrix and K as camera matrix the Python code is:
num, Rs, Ts, Ns = cv2.decomposeHomographyMat(H, K)
num possible solutions will be returned.
Rs contains a list of the rotation matrix.
Ts contains a list of the translation vector.
Ns contains a list of the normal vector of the plane.
For further informations take a look into the official documentation:
OpenCV 3.4 - decomposeHomographyMat()