MCPcopy Create free account
hub / github.com/colmap/colmap / get_virtual_camera_rays

Function get_virtual_camera_rays

python/examples/panorama_sfm.py:112–123  ·  view source on GitHub ↗
(
    camera: pycolmap.Camera,
)

Source from the content-addressed store, hash-verified

110
111
112def get_virtual_camera_rays(
113 camera: pycolmap.Camera,
114) -> npt.NDArray[np.floating]:
115 size = (camera.width, camera.height)
116 x, y = np.indices(size).astype(np.float32)
117 xy: NDArrayNx2 = np.column_stack([x.ravel(), y.ravel()])
118 # The center of the upper left most pixel has coordinate (0.5, 0.5)
119 xy += 0.5
120 xy_norm: NDArrayNx2 = camera.cam_from_img(image_points=xy)
121 rays = np.concatenate([xy_norm, np.ones_like(xy_norm[:, :1])], -1)
122 rays /= np.linalg.norm(rays, axis=-1, keepdims=True)
123 return rays
124
125
126def spherical_img_from_cam(

Callers 1

processMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected