irtk.scene.PerspectiveCameraFull

class irtk.scene.PerspectiveCameraFull(fx: float, fy: float, cx: float, cy: float, to_world: torch.Tensor | ndarray | List | Tuple = torch.eye, near: float = 1e-06, far: float = 10000000.0)

A class representing a full perspective camera.

__init__(fx: float, fy: float, cx: float, cy: float, to_world: torch.Tensor | ndarray | List | Tuple = torch.eye, near: float = 1e-06, far: float = 10000000.0) None

Initializes a PerspectiveCameraFull object.

Parameters:
  • fx (float) – The focal length in the x axis.

  • fy (float) – The focal length in the y axis.

  • cx (float) – The principal point offset in the x axis.

  • cy (float) – The principal point offset in the y axis.

  • to_world (TensorLike) – The transformation matrix to world coordinates (float, shape (4, 4)).

  • near (float) – The near clipping plane.

  • far (float) – The far clipping plane.

classmethod from_lookat(fx: float, fy: float, cx: float, cy: float, origin: torch.Tensor | ndarray | List | Tuple, target: torch.Tensor | ndarray | List | Tuple, up: torch.Tensor | ndarray | List | Tuple, near: float = 1e-06, far: float = 10000000.0) PerspectiveCameraFull

Creates a PerspectiveCameraFull object from lookat parameters.

Parameters:
  • fx (float) – The focal length in the x axis.

  • fy (float) – The focal length in the y axis.

  • cx (float) – The principal point offset in the x axis.

  • cy (float) – The principal point offset in the y axis.

  • origin (TensorLike) – The origin of the camera (float, shape (3, )).

  • target (TensorLike) – The target point of the camera (float, shape (3, )).

  • up (TensorLike) – The up vector of the camera (float, shape (3, )).

  • near (float) – The near clipping plane.

  • far (float) – The far clipping plane.

Returns:

A PerspectiveCameraFull object.

Return type:

PerspectiveCameraFull

get_rays(samples: torch.Tensor, aspect_ratio: float) Tuple[torch.Tensor, torch.Tensor]

Generates rays from the camera.

Parameters:
  • samples (torch.Tensor) – The sample points.

  • aspect_ratio (float) – The aspect ratio of the camera.

Returns:

A tuple containing the ray origins and directions.

Return type:

Tuple[torch.Tensor, torch.Tensor]