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

Function project

flowmap/model/projection.py:61–73  ·  view source on GitHub ↗
(
    points: Float[Tensor, "*#batch dim"],
    extrinsics: Float[Tensor, "*#batch dim+1 dim+1"],
    intrinsics: Float[Tensor, "*#batch dim dim"],
    epsilon: float = 1e-5,
)

Source from the content-addressed store, hash-verified

59
60
61def project(
62 points: Float[Tensor, "*#batch dim"],
63 extrinsics: Float[Tensor, "*#batch dim+1 dim+1"],
64 intrinsics: Float[Tensor, "*#batch dim dim"],
65 epsilon: float = 1e-5,
66) -> tuple[
67 Float[Tensor, "*batch dim-1"], # xy coordinates
68 Bool[Tensor, " *batch"], # whether points are in front of the camera
69]:
70 points = homogenize_points(points)
71 points = transform_world2cam(points, extrinsics)[..., :-1]
72 in_front_of_camera = points[..., -1] >= 0
73 return project_camera_space(points, intrinsics, epsilon=epsilon), in_front_of_camera
74
75
76def unproject(

Callers

nothing calls this directly

Calls 3

homogenize_pointsFunction · 0.85
transform_world2camFunction · 0.85
project_camera_spaceFunction · 0.85

Tested by

no test coverage detected