1
0
forked from HQU-gxy/CVTH3PE

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.
This commit is contained in:
2025-04-24 19:00:05 +08:00
parent c3c93f6ca6
commit 95873a3e4e

View File

@ -155,6 +155,19 @@ def unproject_points_to_z_plane(
pose_matrix: Float[Array, "4 4"], pose_matrix: Float[Array, "4 4"],
z: float = 0.0, z: float = 0.0,
) -> Float[Array, "N 3"]: ) -> 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_normal = jnp.array([0.0, 0.0, 1.0])
plane_point = jnp.array([0.0, 0.0, z]) plane_point = jnp.array([0.0, 0.0, z])
return unproject_points_onto_plane( return unproject_points_onto_plane(
@ -374,7 +387,14 @@ class Camera:
self, points_2d: Num[Array, "N 2"], z: float = 0.0 self, points_2d: Num[Array, "N 2"], z: float = 0.0
) -> Num[Array, "N 3"]: ) -> 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( return unproject_points_to_z_plane(
points_2d, points_2d,