vision3d.transforms.functional#
Functional form of the 3D transforms in vision3d.transforms.
Functions
|
Update |
|
Update |
|
Flip a tensor along a 3D spatial axis. |
|
Flip 3D bounding boxes along |
|
Flip point cloud coordinates along |
|
Dispatcher entry point for point jittering. |
|
Add noise to point xyz coordinates. |
|
Update |
|
Register a kernel for a functional and TVTensor type. |
|
Update |
|
Update |
|
Rotate a tensor by a 3x3 rotation matrix. |
|
Rotate 3D bounding boxes by |
|
Update camera extrinsics after rotating the lidar frame. |
|
Rotate point cloud coordinates by |
|
Dispatcher entry point for point sampling. |
|
Select points by index. |
|
Scale a tensor by a uniform factor. |
|
Scale 3D bounding boxes by |
|
Update camera extrinsics after scaling the lidar frame. |
|
Scale point cloud coordinates by |
|
Dispatcher entry point for point shuffling. |
|
Permute point order. |
|
Translate a tensor by a 3D offset. |
|
Translate 3D bounding boxes by |
|
Update camera extrinsics after translating the lidar frame. |
|
Translate point cloud coordinates by |
- vision3d.transforms.functional.center_crop_camera_intrinsics(inpt, output_size)[source]#
Update
CameraIntrinsicsfor a center crop of the corresponding image.- Parameters:
inpt (CameraIntrinsics) – The intrinsics to update.
output_size (list[int]) – Target
(h, w)after the center crop.
- Returns:
Updated intrinsics with
image_sizeset tooutput_size.- Return type:
- vision3d.transforms.functional.crop_camera_intrinsics(inpt, top, left, height, width)[source]#
Update
CameraIntrinsicsfor a crop of the corresponding image.Shifts the principal point so projection through the updated intrinsics matches projection through the original intrinsics on the cropped image.
- Parameters:
inpt (CameraIntrinsics) – The intrinsics to update.
top (int) – Top edge of the crop in pixels.
left (int) – Left edge of the crop in pixels.
height (int) – Crop height in pixels.
width (int) – Crop width in pixels.
- Returns:
Updated intrinsics with
image_sizeset to(height, width).- Return type:
- 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.
- 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:
- vision3d.transforms.functional.flip_3d_point_cloud(points, *, axis)[source]#
Flip point cloud coordinates along
axis.
- vision3d.transforms.functional.jitter_points(inpt, *, noise)[source]#
Dispatcher entry point for point jittering.
- vision3d.transforms.functional.jitter_points_point_cloud(points, *, noise)[source]#
Add noise to point xyz coordinates.
- vision3d.transforms.functional.pad_camera_intrinsics(inpt, padding, **kwargs)[source]#
Update
CameraIntrinsicsfor a pad of the corresponding image.Shifts the principal point by the top-left pad and grows
image_sizeto include the padded borders.- Parameters:
inpt (CameraIntrinsics) – The intrinsics to update.
padding (int | list[int]) – Padding spec as accepted by
torchvision.transforms.v2.functional.pad().kwargs (Any) – Unused; accepted for signature compatibility with
torchvision.transforms.v2.functional.pad().
- Returns:
Updated intrinsics with the padded
image_size.- Return type:
- 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:
- vision3d.transforms.functional.resize_camera_intrinsics(inpt, size, max_size=None, **kwargs)[source]#
Update
CameraIntrinsicsfor a resize of the corresponding image.Scales the focal lengths, skew, and principal point so projection through the updated intrinsics matches projection through the original intrinsics on the resized image.
- Parameters:
inpt (CameraIntrinsics) – The intrinsics to update.
max_size (int | None) – Optional cap on the longer edge.
kwargs (Any) – Unused; accepted for signature compatibility with
torchvision.transforms.v2.functional.resize().
- Returns:
Updated intrinsics with the new
image_size.- Return type:
- vision3d.transforms.functional.resized_crop_camera_intrinsics(inpt, top, left, height, width, size, **kwargs)[source]#
Update
CameraIntrinsicsfor a crop followed by a resize.- Parameters:
inpt (CameraIntrinsics) – The intrinsics to update.
top (int) – Top edge of the crop in pixels.
left (int) – Left edge of the crop in pixels.
height (int) – Crop height in pixels.
width (int) – Crop width in pixels.
kwargs (Any) – Unused; accepted for signature compatibility with
torchvision.transforms.v2.functional.resized_crop().
- Returns:
Updated intrinsics with
image_sizeset tosize.- Return type:
- 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.
- 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 raiseNotImplementedError.- 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:
NotImplementedError – If
formatis axis-aligned.ValueError – If
formatisXYZLWHYand rotation is not pure yaw.
- Return type:
- vision3d.transforms.functional.rotate_3d_camera_extrinsics(extrinsics, *, rotation_matrix)[source]#
Update camera extrinsics after rotating the lidar frame.
The lidar-to-camera extrinsic
Esatisfiesp_cam = E @ p_lidar. After rotating the lidar frame byR, points becomep' = R @ p, soE' = E @ R_invto keepp_cam = E' @ p'.
- vision3d.transforms.functional.rotate_3d_point_cloud(points, *, rotation_matrix)[source]#
Rotate point cloud coordinates by
rotation_matrix.
- vision3d.transforms.functional.sample_points(inpt, *, indices)[source]#
Dispatcher entry point for point sampling.
- vision3d.transforms.functional.sample_points_point_cloud(points, *, indices)[source]#
Select points by index.
- vision3d.transforms.functional.scale_3d(inpt, *, factor)[source]#
Scale a tensor by a uniform factor.
Dispatcher entry point. Type-specific kernels are registered below.
- 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:
boxes (Tensor) – Bounding box tensor
[..., K].format (BoundingBox3DFormat) – Format of the boxes.
factor (float) – Scale factor.
- Returns:
Scaled bounding boxes with the same shape.
- Return type:
- vision3d.transforms.functional.scale_3d_camera_extrinsics(extrinsics, *, factor)[source]#
Update camera extrinsics after scaling the lidar frame.
- vision3d.transforms.functional.scale_3d_point_cloud(points, *, factor)[source]#
Scale point cloud coordinates by
factor.
- vision3d.transforms.functional.shuffle_points(inpt, *, perm)[source]#
Dispatcher entry point for point shuffling.
- vision3d.transforms.functional.shuffle_points_point_cloud(points, *, perm)[source]#
Permute point order.
- vision3d.transforms.functional.translate_3d(inpt, *, offset)[source]#
Translate a tensor by a 3D offset.
Dispatcher entry point. Type-specific kernels are registered below.
- 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:
- 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
offsetin the lidar frame.