From 18c38ad6006d046dc1d841d6020c6fbe6ad34a94 Mon Sep 17 00:00:00 2001 From: David Novotny Date: Wed, 1 Feb 2023 05:05:23 -0800 Subject: [PATCH] Fix opencv camera convention docs Summary: see title Reviewed By: bottler Differential Revision: D42920739 fbshipit-source-id: 87f3d052657880b2ef58a1219bb7d4f283ab0830 --- pytorch3d/utils/camera_conversions.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/pytorch3d/utils/camera_conversions.py b/pytorch3d/utils/camera_conversions.py index 19ee6afbe..83ce2bb5f 100644 --- a/pytorch3d/utils/camera_conversions.py +++ b/pytorch3d/utils/camera_conversions.py @@ -42,12 +42,11 @@ def cameras_from_opencv_projection( followed by the homogenization of `x_screen_opencv`. Note: - The parameters `R, tvec, camera_matrix` correspond to the outputs of - `cv2.decomposeProjectionMatrix`. - - The `rvec` parameter of the `cv2.projectPoints` is an axis-angle vector - that can be converted to the rotation matrix `R` expected here by - calling the `so3_exp_map` function. + The parameters `R, tvec, camera_matrix` correspond to the inputs of + `cv2.projectPoints(x_world, rvec, tvec, camera_matrix, [])`, + where `rvec` is an axis-angle vector that can be obtained from + the rotation matrix `R` expected here by calling the `so3_log_map` function. + Correspondingly, `R` can be obtained from `rvec` by calling `so3_exp_map`. Args: R: A batch of rotation matrices of shape `(N, 3, 3)`. @@ -73,12 +72,11 @@ def opencv_from_cameras_projection( of `cameras_from_opencv_projection`. Note: - The outputs `R, tvec, camera_matrix` correspond to the outputs of - `cv2.decomposeProjectionMatrix`. - - The `rvec` parameter of the `cv2.projectPoints` is an axis-angle vector - that can be converted from the returned rotation matrix `R` here by - calling the `so3_log_map` function. + The outputs `R, tvec, camera_matrix` correspond to the inputs of + `cv2.projectPoints(x_world, rvec, tvec, camera_matrix, [])`, + where `rvec` is an axis-angle vector that can be obtained from + the rotation matrix `R` output here by calling the `so3_log_map` function. + Correspondingly, `R` can be obtained from `rvec` by calling `so3_exp_map`. Args: cameras: A batch of `N` cameras in the PyTorch3D convention.