pycvcam.core.Extrinsic.compute_rays#

Extrinsic.compute_rays(normalized_points, *, transpose=False, _skip=False, **kwargs)[source]#

Compute the rays emitted from the camera to the scene.

The rays are the concatenation of the normalized_points converted in the world coordinates and the direction of the rays.

Parameters:
  • normalized_points (ArrayLike) – The normalized points in the camera coordinate system. Shape (…, 2).

  • transpose (bool, optional) – If True, the input and output arrays are transposed to shape (2, …) and (6, …), respectively. Default is False.

  • _skip (bool, optional) – If True, skip the checks and transformations. Default is False.

  • kwargs (dict) – Additional arguments to be passed to the transformation method.

Returns:

The rays in the world coordinate system. The shape is (…, 6), where the last dimension represents the origin and direction of the rays.

Return type:

Rays

Examples

result = compute_rays(normalized_points)
rays = result.rays  # (..., 6)

# The last dimension is the ray structure: (origin_x, origin_y, origin_z, direction_x, direction_y, direction_z)
# Where the coordinates of the origin and the direction are in the world coordinate system.

result.origins  # (..., 3)  # The origins of the rays in the world coordinate system
result.directions  # (..., 3)  # The directions of the rays in the world coordinate system