Convert rotation vector and translation vector to 4x4 transformation matrix.
(rvec: np.ndarray, tvec: np.ndarray)
| 383 | |
| 384 | |
| 385 | def rvec_tvec_to_matrix(rvec: np.ndarray, tvec: np.ndarray) -> np.ndarray: |
| 386 | """Convert rotation vector and translation vector to 4x4 transformation matrix.""" |
| 387 | R, _ = cv2.Rodrigues(np.array(rvec).reshape(3, 1)) |
| 388 | T = np.eye(4) |
| 389 | T[:3, :3] = R |
| 390 | T[:3, 3] = np.array(tvec).flatten() |
| 391 | return T |
| 392 | |
| 393 | |
| 394 | def matrix_to_rvec_tvec(T: np.ndarray) -> tuple[np.ndarray, np.ndarray]: |
no test coverage detected