# Perspective Camera¶

project_points(point_3d: torch.Tensor, camera_matrix: torch.Tensor) → torch.Tensor[source]

Projects a 3d point onto the 2d camera plane.

Parameters
• point3d (torch.Tensor) – tensor containing the 3d points to be projected to the camera plane. The shape of the tensor can be $$(*, 3)$$.

• camera_matrix (torch.Tensor) – tensor containing the intrinsics camera matrix. The tensor shape must be Bx4x4.

Returns

array of (u, v) cam coordinates with shape $$(*, 2)$$.

Return type

torch.Tensor

unproject_points(point_2d: torch.Tensor, depth: torch.Tensor, camera_matrix: torch.Tensor, normalize: bool = False) → torch.Tensor[source]

Unprojects a 2d point in 3d.

Transform coordinates in the pixel frame to the camera frame.

Parameters
• point2d (torch.Tensor) – tensor containing the 2d to be projected to world coordinates. The shape of the tensor can be $$(*, 2)$$.

• depth (torch.Tensor) – tensor containing the depth value of each 2d points. The tensor shape must be equal to point2d $$(*, 1)$$.

• camera_matrix (torch.Tensor) – tensor containing the intrinsics camera matrix. The tensor shape must be Bx4x4.

• normalize (bool, optional) – whether to normalize the pointcloud. This must be set to True when the depth is represented as the Euclidean ray length from the camera position. Default is False.

Returns

tensor of (x, y, z) world coordinates with shape $$(*, 3)$$.

Return type

torch.Tensor