@@ -33,7 +33,7 @@ def from_array(cls, intrinsics: Array):
3333 def as_array (self ):
3434 """Returns intrinsics as a float array."""
3535 return jnp .array (self )
36-
36+
3737 def downscale (self , factor ):
3838 return Intrinsics (
3939 self .width // factor ,
@@ -122,7 +122,9 @@ def camera_from_depth(z: DepthImage, intrinsics) -> CameraCoordinates:
122122unproject_depth = camera_from_depth
123123
124124
125- def screen_from_camera (xyz : CameraCoordinates , intrinsics , culling = False ) -> ScreenCoordinates :
125+ def screen_from_camera (
126+ xyz : CameraCoordinates , intrinsics , culling = False
127+ ) -> ScreenCoordinates :
126128 """
127129 Maps to sensor coordintaes `uv` from camera coordinates `xyz`, which are
128130 defined by $(u,v) = (u'/z,v'/z)$, where
@@ -159,10 +161,12 @@ def screen_from_world(x, cam, intr, culling=False):
159161 """Maps to screen coordintaes `uv` from world coordinates `xyz`."""
160162 return screen_from_camera (cam .inv ().apply (x ), intr , culling = culling )
161163
164+
162165def world_from_screen (uv , cam , intr ):
163166 """Maps to world coordintaes `xyz` from screen coords `uv`."""
164167 return cam .apply (camera_from_screen (uv , intr ))
165168
169+
166170def camera_matrix_from_intrinsics (intr : Intrinsics ) -> CameraMatrix3x3 :
167171 """
168172 Returns a 3x3 camera matrix following the OpenCV convention, ie.
@@ -219,6 +223,7 @@ def homogeneous_coordinates(xs, z=jnp.array(1.0)):
219223 """
220224 return jnp .concatenate ([xs , jnp .ones_like (xs [..., :1 ])], axis = - 1 ) * z [..., None ]
221225
226+
222227homogeneous = homogeneous_coordinates
223228
224229
0 commit comments