MCPcopy Create free account
hub / github.com/Improbable-AI/VisionProTeleop / rvec_tvec_to_matrix

Function rvec_tvec_to_matrix

scripts/stereo_calibration.py:385–391  ·  view source on GitHub ↗

Convert rotation vector and translation vector to 4x4 transformation matrix.

(rvec: np.ndarray, tvec: np.ndarray)

Source from the content-addressed store, hash-verified

383
384
385def 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
394def matrix_to_rvec_tvec(T: np.ndarray) -> tuple[np.ndarray, np.ndarray]:

Callers 5

joint_calibration_costFunction · 0.85
joint_stereo_residualsFunction · 0.85
ray_stereo_residualsFunction · 0.85
calibrate_joint_stereoFunction · 0.85
calibrate_jointFunction · 0.85

Calls 2

reshapeMethod · 0.45
eyeMethod · 0.45

Tested by

no test coverage detected