Transform the input points using the provided relative transformations, then project them using the provided intrinsics. After transformation, the points are assumed to be in camera space.
(
xyz: Float[Tensor, "*#batch 3"],
relative_transformations: Float[Tensor, "*#batch 4 4"],
intrinsics: Float[Tensor, "*#batch 3 3"],
)
| 114 | |
| 115 | |
| 116 | def reproject_points( |
| 117 | xyz: Float[Tensor, "*#batch 3"], |
| 118 | relative_transformations: Float[Tensor, "*#batch 4 4"], |
| 119 | intrinsics: Float[Tensor, "*#batch 3 3"], |
| 120 | ) -> Float[Tensor, "*#batch 2"]: |
| 121 | """Transform the input points using the provided relative transformations, then |
| 122 | project them using the provided intrinsics. After transformation, the points are |
| 123 | assumed to be in camera space. |
| 124 | """ |
| 125 | |
| 126 | # Transform the 3D locations into the target view's camera space. |
| 127 | xyz = einsum( |
| 128 | relative_transformations, |
| 129 | homogenize_points(xyz), |
| 130 | "... i j, ... j -> ... i", |
| 131 | )[..., :3] |
| 132 | |
| 133 | # Project the 3D locations in the target view's camera space. |
| 134 | return project_camera_space(xyz, intrinsics) |
| 135 | |
| 136 | |
| 137 | # Given data with leading (batch, frame) dimensions, these helper functions select the |
no test coverage detected