vision3d.transforms.functional#

Functional form of the 3D transforms in vision3d.transforms.

Functions

flip_3d(inpt, *, axis)

Flip a tensor along a 3D spatial axis.

flip_3d_bounding_boxes(boxes, *, format, axis)

Flip 3D bounding boxes along axis.

flip_3d_point_cloud(points, *, axis)

Flip point cloud coordinates along axis.

jitter_points(inpt, *, noise)

Dispatcher entry point for point jittering.

jitter_points_point_cloud(points, *, noise)

Add noise to point xyz coordinates.

register_kernel(functional, tv_tensor_cls, *)

Register a kernel for a functional and TVTensor type.

rotate_3d(inpt, *, rotation_matrix)

Rotate a tensor by a 3x3 rotation matrix.

rotate_3d_bounding_boxes(boxes, *, format, ...)

Rotate 3D bounding boxes by rotation_matrix.

rotate_3d_camera_extrinsics(extrinsics, *, ...)

Update camera extrinsics after rotating the lidar frame.

rotate_3d_point_cloud(points, *, rotation_matrix)

Rotate point cloud coordinates by rotation_matrix.

sample_points(inpt, *, indices)

Dispatcher entry point for point sampling.

sample_points_point_cloud(points, *, indices)

Select points by index.

scale_3d(inpt, *, factor)

Scale a tensor by a uniform factor.

scale_3d_bounding_boxes(boxes, *, format, factor)

Scale 3D bounding boxes by factor.

scale_3d_camera_extrinsics(extrinsics, *, factor)

Update camera extrinsics after scaling the lidar frame.

scale_3d_point_cloud(points, *, factor)

Scale point cloud coordinates by factor.

shuffle_points(inpt, *, perm)

Dispatcher entry point for point shuffling.

shuffle_points_point_cloud(points, *, perm)

Permute point order.

translate_3d(inpt, *, offset)

Translate a tensor by a 3D offset.

translate_3d_bounding_boxes(boxes, *, ...)

Translate 3D bounding boxes by offset.

translate_3d_camera_extrinsics(extrinsics, ...)

Update camera extrinsics after translating the lidar frame.

translate_3d_point_cloud(points, *, offset)

Translate point cloud coordinates by offset.

vision3d.transforms.functional.flip_3d(inpt, *, axis)[source]#

Flip a tensor along a 3D spatial axis.

This is the dispatcher entry point. Type-specific kernels are registered below.

Parameters:
  • inpt (Tensor) – Input tensor.

  • axis (str) – One of "x", "y", "z".

Returns:

Flipped tensor.

Return type:

Tensor

vision3d.transforms.functional.flip_3d_bounding_boxes(boxes, *, format, axis)[source]#

Flip 3D bounding boxes along axis.

Parameters:
  • boxes (Tensor) – Bounding box tensor [..., K].

  • format (BoundingBox3DFormat) – Format of the boxes.

  • axis (str) – One of "x", "y", "z".

Returns:

Flipped bounding boxes with the same shape.

Return type:

Tensor

vision3d.transforms.functional.flip_3d_point_cloud(points, *, axis)[source]#

Flip point cloud coordinates along axis.

Parameters:
  • points (Tensor) – Point cloud tensor [..., 3+C].

  • axis (str) – One of "x", "y", "z".

Returns:

Flipped point cloud with the same shape.

Return type:

Tensor

vision3d.transforms.functional.jitter_points(inpt, *, noise)[source]#

Dispatcher entry point for point jittering.

Returns:

Input unchanged (passthrough for non-point types).

Parameters:
Return type:

Tensor

vision3d.transforms.functional.jitter_points_point_cloud(points, *, noise)[source]#

Add noise to point xyz coordinates.

Parameters:
  • points (Tensor) – Point cloud [N, 3+C].

  • noise (Tensor) – Additive noise [N, 3].

Returns:

Jittered point cloud with the same shape. Non-xyz features are unchanged.

Return type:

Tensor

vision3d.transforms.functional.register_kernel(functional, tv_tensor_cls, *, tv_tensor_wrapper=True)[source]#

Register a kernel for a functional and TVTensor type.

Parameters:
  • functional (Callable[[...], Any]) – The functional to register a kernel for.

  • tv_tensor_cls (type[TVTensor]) – The TVTensor subclass this kernel handles.

  • tv_tensor_wrapper (bool) – If True (default), the kernel receives an unwrapped pure tensor and the output is automatically re-wrapped. If False, the kernel receives the full TVTensor and must handle wrap itself.

Returns:

Decorator that registers the kernel.

Return type:

Callable[[Callable[[…], Any]], Callable[[…], Any]]

vision3d.transforms.functional.rotate_3d(inpt, *, rotation_matrix)[source]#

Rotate a tensor by a 3x3 rotation matrix.

Dispatcher entry point. Type-specific kernels are registered below.

Parameters:
  • inpt (Tensor) – Input tensor.

  • rotation_matrix (Tensor) – [3, 3] rotation matrix.

Returns:

Rotated tensor.

Return type:

Tensor

vision3d.transforms.functional.rotate_3d_bounding_boxes(boxes, *, format, rotation_matrix)[source]#

Rotate 3D bounding boxes by rotation_matrix.

Only rotated formats are supported:

  • XYZLWHY: only Z-axis rotations (pure yaw).

  • XYZLWHYPR: arbitrary rotations.

Axis-aligned formats (XYZXYZ, XYZLWH) cannot represent rotation and will raise NotImplementedError.

Parameters:
  • boxes (Tensor) – Bounding box tensor [..., K].

  • format (BoundingBox3DFormat) – Format of the boxes.

  • rotation_matrix (Tensor) – [3, 3] rotation matrix.

Returns:

Rotated bounding boxes with the same shape.

Raises:
Return type:

Tensor

vision3d.transforms.functional.rotate_3d_camera_extrinsics(extrinsics, *, rotation_matrix)[source]#

Update camera extrinsics after rotating the lidar frame.

The lidar-to-camera extrinsic E satisfies p_cam = E @ p_lidar. After rotating the lidar frame by R, points become p' = R @ p, so E' = E @ R_inv to keep p_cam = E' @ p'.

Parameters:
  • extrinsics (Tensor) – Extrinsic matrices [..., 4, 4].

  • rotation_matrix (Tensor) – [3, 3] rotation matrix.

Returns:

Updated extrinsics with the same shape.

Return type:

Tensor

vision3d.transforms.functional.rotate_3d_point_cloud(points, *, rotation_matrix)[source]#

Rotate point cloud coordinates by rotation_matrix.

Parameters:
  • points (Tensor) – Point cloud tensor [..., 3+C].

  • rotation_matrix (Tensor) – [3, 3] rotation matrix.

Returns:

Rotated point cloud with the same shape.

Return type:

Tensor

vision3d.transforms.functional.sample_points(inpt, *, indices)[source]#

Dispatcher entry point for point sampling.

Returns:

Input unchanged (passthrough for non-point types).

Parameters:
Return type:

Tensor

vision3d.transforms.functional.sample_points_point_cloud(points, *, indices)[source]#

Select points by index.

Parameters:
  • points (Tensor) – Point cloud [N, 3+C].

  • indices (Tensor) – Selection indices [M]. May contain repeats for oversampling.

Returns:

Selected point cloud [M, 3+C].

Return type:

Tensor

vision3d.transforms.functional.scale_3d(inpt, *, factor)[source]#

Scale a tensor by a uniform factor.

Dispatcher entry point. Type-specific kernels are registered below.

Parameters:
  • inpt (Tensor) – Input tensor.

  • factor (float) – Scale factor.

Returns:

Scaled tensor.

Return type:

Tensor

vision3d.transforms.functional.scale_3d_bounding_boxes(boxes, *, format, factor)[source]#

Scale 3D bounding boxes by factor.

Scales both position and dimensions. Rotation angles are unchanged.

Parameters:
Returns:

Scaled bounding boxes with the same shape.

Return type:

Tensor

vision3d.transforms.functional.scale_3d_camera_extrinsics(extrinsics, *, factor)[source]#

Update camera extrinsics after scaling the lidar frame.

Parameters:
  • extrinsics (Tensor) – Extrinsic matrices [..., 4, 4].

  • factor (float) – Scale factor applied to the lidar frame.

Returns:

Updated extrinsics with the same shape.

Return type:

Tensor

vision3d.transforms.functional.scale_3d_point_cloud(points, *, factor)[source]#

Scale point cloud coordinates by factor.

Parameters:
  • points (Tensor) – Point cloud tensor [..., 3+C].

  • factor (float) – Scale factor.

Returns:

Scaled point cloud with the same shape.

Return type:

Tensor

vision3d.transforms.functional.shuffle_points(inpt, *, perm)[source]#

Dispatcher entry point for point shuffling.

Returns:

Input unchanged (passthrough for non-point types).

Parameters:
Return type:

Tensor

vision3d.transforms.functional.shuffle_points_point_cloud(points, *, perm)[source]#

Permute point order.

Parameters:
  • points (Tensor) – Point cloud [N, 3+C].

  • perm (Tensor) – Permutation indices [N].

Returns:

Permuted point cloud with the same shape.

Return type:

Tensor

vision3d.transforms.functional.translate_3d(inpt, *, offset)[source]#

Translate a tensor by a 3D offset.

Dispatcher entry point. Type-specific kernels are registered below.

Parameters:
  • inpt (Tensor) – Input tensor.

  • offset (Tensor) – Translation [3] as (tx, ty, tz).

Returns:

Translated tensor.

Return type:

Tensor

vision3d.transforms.functional.translate_3d_bounding_boxes(boxes, *, format, offset)[source]#

Translate 3D bounding boxes by offset.

Parameters:
  • boxes (Tensor) – Bounding box tensor [..., K].

  • format (BoundingBox3DFormat) – Format of the boxes.

  • offset (Tensor) – Translation [3] as (tx, ty, tz).

Returns:

Translated bounding boxes with the same shape.

Return type:

Tensor

vision3d.transforms.functional.translate_3d_camera_extrinsics(extrinsics, *, offset)[source]#

Update camera extrinsics after translating the lidar frame.

The lidar-to-camera extrinsic translation changes because the lidar origin moved by offset in the lidar frame.

Parameters:
  • extrinsics (Tensor) – Extrinsic matrices [..., 4, 4].

  • offset (Tensor) – Translation [3] as (tx, ty, tz) in lidar frame.

Returns:

Updated extrinsics with the same shape.

Return type:

Tensor

vision3d.transforms.functional.translate_3d_point_cloud(points, *, offset)[source]#

Translate point cloud coordinates by offset.

Parameters:
  • points (Tensor) – Point cloud tensor [..., 3+C].

  • offset (Tensor) – Translation [3] as (tx, ty, tz).

Returns:

Translated point cloud with the same shape.

Return type:

Tensor