From 95873a3e4e9a497c94056df952c3b71c4fc192da Mon Sep 17 00:00:00 2001 From: crosstyan Date: Thu, 24 Apr 2025 19:00:05 +0800 Subject: [PATCH] feat: Improve documentation for unprojection functions in camera module - Enhanced docstrings for `unproject_points_to_z_plane` and the corresponding method in the `Camera` class to provide detailed descriptions of arguments and return values. - Clarified the purpose and usage of the unprojection functionalities, improving overall code readability and usability. --- app/camera/__init__.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/app/camera/__init__.py b/app/camera/__init__.py index 84ee773..174b682 100644 --- a/app/camera/__init__.py +++ b/app/camera/__init__.py @@ -155,6 +155,19 @@ def unproject_points_to_z_plane( pose_matrix: Float[Array, "4 4"], z: float = 0.0, ) -> Float[Array, "N 3"]: + """ + Un-project 2D points to 3D points on a plane at z = constant. + + Args: + points_2d: 2D points in pixel coordinates + K: Camera intrinsic matrix + dist_coeffs: Distortion coefficients + pose_matrix: Camera-to-World (C2W) transformation matrix + z: z-coordinate of the plane (default: 0.0, i.e. ground/horizon/floor plane) + + Returns: + [..., 3] world-space intersection points + """ plane_normal = jnp.array([0.0, 0.0, 1.0]) plane_point = jnp.array([0.0, 0.0, z]) return unproject_points_onto_plane( @@ -374,7 +387,14 @@ class Camera: self, points_2d: Num[Array, "N 2"], z: float = 0.0 ) -> Num[Array, "N 3"]: """ - Unproject 2D points to 3D points on a plane at z = constant. + Un-project 2D points to 3D points on a plane at z = constant. + + Args: + points_2d: 2D points in pixel coordinates + z: z-coordinate of the plane (default: 0.0, i.e. ground/horizon/floor plane) + + Returns: + [..., 3] world-space intersection points """ return unproject_points_to_z_plane( points_2d,