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

Function unproject

flowmap/model/projection.py:76–90  ·  view source on GitHub ↗

Unproject 2D camera coordinates with the given Z values.

(
    coordinates: Float[Tensor, "*#batch dim"],
    z: Float[Tensor, "*#batch"],
    intrinsics: Float[Tensor, "*#batch dim+1 dim+1"],
)

Source from the content-addressed store, hash-verified

74
75
76def unproject(
77 coordinates: Float[Tensor, "*#batch dim"],
78 z: Float[Tensor, "*#batch"],
79 intrinsics: Float[Tensor, "*#batch dim+1 dim+1"],
80) -> Float[Tensor, "*batch dim+1"]:
81 """Unproject 2D camera coordinates with the given Z values."""
82
83 # Apply the inverse intrinsics to the coordinates.
84 coordinates = homogenize_points(coordinates)
85 ray_directions = einsum(
86 intrinsics.inverse(), coordinates, "... i j, ... j -> ... i"
87 )
88
89 # Apply the supplied depth values.
90 return ray_directions * z[..., None]
91
92
93def sample_image_grid(

Callers 5

get_frustumsFunction · 0.90
load_birdsFunction · 0.90
forwardMethod · 0.85
forwardMethod · 0.85
export_to_colmapFunction · 0.85

Calls 1

homogenize_pointsFunction · 0.85

Tested by

no test coverage detected