MCPcopy Create free account
hub / github.com/dcharatan/flowmap / reproject_points

Function reproject_points

flowmap/model/projection.py:116–134  ·  view source on GitHub ↗

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"],
)

Source from the content-addressed store, hash-verified

114
115
116def 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

Callers 3

compute_forward_flowFunction · 0.85
compute_backward_flowFunction · 0.85
compute_track_flowFunction · 0.85

Calls 2

homogenize_pointsFunction · 0.85
project_camera_spaceFunction · 0.85

Tested by

no test coverage detected