vis4d.op.box.box3d

Utility functions for 3D bounding boxes.

Functions

boxes3d_in_image(box_corners, ...)

Check if a 3D bounding box is (partially) in an image.

boxes3d_to_corners(boxes3d, axis_mode)

Convert a Tensor of 3D boxes to its respective corner points.

transform_boxes3d(boxes3d, transform_matrix, ...)

Transform 3D boxes using given transform matrix.

boxes3d_in_image(box_corners, cam_intrinsics, image_hw)[source]

Check if a 3D bounding box is (partially) in an image.

Parameters:
  • box_corners (Tensor) – [N, 8, 3] Tensor of 3D boxes corners. In OpenCV coordinate frame.

  • cam_intrinsics (Tensor) – [3, 3] Camera matrix.

  • image_hw (tuple[int, int]) – image height / width.

Returns:

[N,] boolean values.

Return type:

Tensor

boxes3d_to_corners(boxes3d, axis_mode)[source]

Convert a Tensor of 3D boxes to its respective corner points.

Parameters:
  • boxes3d (Tensor) – Box parameters. Tensor of shape [N, 10].

  • axis_mode (AxisMode) – Coordinate system convention.

Returns:

[N, 8, 3] 3D bounding box corner coordinates, in this order:

(back)

  1. +———+. (7) | ` . | ` . | (4) +—+—–+ (5) | | | |

  1. +—–+—+. (3)| ` . | ` . | (0) ` +———+ (1)

    (front)

Return type:

Tensor

transform_boxes3d(boxes3d, transform_matrix, source_axis_mode, target_axis_mode, only_yaw=True)[source]

Transform 3D boxes using given transform matrix.

Parameters:
  • boxes3d (Tensor) – [N, 10] Tensor of 3D boxes.

  • transform_matrix (Tensor) – [4, 4] Transform matrix.

  • source_axis_mode (AxisMode) – Source coordinate system convention of the boxes.

  • target_axis_mode (AxisMode) – Target coordinate system convention of the boxes.

  • only_yaw (bool) – Whether to only care about yaw rotation.

Return type:

Tensor