vision3d.viz#
Optional 3D visualization utilities.
Requires the viz dependency group:
pip install vision3d[viz]
Functions
|
Build a 2D camera-panel grid from a dataset's rig metadata. |
|
Build a fusion-sample layout with a 3D view above a camera grid. |
|
Build a 3D view of the world entity tree. |
|
Log 3D bounding boxes to Rerun. |
|
Log all camera images with optional pinhole projection to Rerun. |
|
Log a point cloud to Rerun. |
|
Log a full sample dict to Rerun. |
- vision3d.viz.camera_grid(camera_names, grid=None, *, entity_prefix='world/cam', overlay_entity='world/boxes')[source]#
Build a 2D camera-panel grid from a dataset’s rig metadata.
Each cell in
gridis an index intocamera_names. Entity origins followlog_cameras’{entity_prefix}_{i}convention so this helper pairs directly withvision3d.viz.log_cameras().Panels are emitted row-major into a
Gridwithgrid_columnsset to the widest row.- Parameters:
camera_names (Sequence[str]) – Per-camera display names indexed by tensor position.
grid (Sequence[Sequence[int]] | None) – Row-major grid of indices into
camera_names.Noneif the dataset hasn’t declared a rig layout. Falls back to a single row in tensor order.entity_prefix (str) – Prefix for camera entity origins (e.g.
"world/cam"->/world/cam_0,/world/cam_1…).overlay_entity (str | None) – Entity to overlay as wireframe boxes on every camera panel (e.g.
"world/boxes"). PassNoneto skip the overlay.
- Returns:
A
Gridcontaining oneSpatial2DViewper declared camera.- Raises:
ValueError – If any index is out of range for
camera_names.- Return type:
- vision3d.viz.fusion_layout(camera_names, grid=None, *, entity_prefix='world', row_shares=(3, 2), name=None)[source]#
Build a fusion-sample layout with a 3D view above a camera grid.
Composes
lidar_view()andcamera_grid()under matching entity prefixes that align withvision3d.viz.log_sample()’s defaults (world/cam_*for cameras,world/boxesfor the overlay).- Parameters:
camera_names (Sequence[str]) – Per-camera display names indexed by tensor position.
grid (Sequence[Sequence[int]] | None) – Row-major grid of indices into
camera_names. Seecamera_grid().entity_prefix (str) – Root entity prefix; the 3D view roots at
/{entity_prefix}, cameras at/{entity_prefix}/cam_*, box overlay at/{entity_prefix}/boxes.row_shares (Sequence[int]) – Vertical split ratio between the 3D view and camera grid.
name (str | None) – Optional display name.
- Returns:
A
Verticalcontainer stacking the 3D view and camera grid.- Return type:
- vision3d.viz.lidar_view(*, entity_prefix='world', name='3D')[source]#
Build a 3D view of the world entity tree.
The view captures everything under
/{entity_prefix}, typically the lidar point cloud, 3D boxes, and any logged camera frustums. Pairs withvision3d.viz.log_point_cloud()andvision3d.viz.log_sample().- Parameters:
- Returns:
A
Spatial3DViewrooted at/{entity_prefix}.- Return type:
- vision3d.viz.log_boxes_3d(entity, boxes, *, labels=None, class_ids=None, label_to_id=None, log_heading=True)[source]#
Log 3D bounding boxes to Rerun.
Logs boxes as
rr.Boxes3Dand optionally heading arrows asrr.Arrows3Don a/headingsub-entity.- Parameters:
entity (str) – Rerun entity path (e.g.
"world/boxes").boxes (BoundingBoxes3D) – Bounding boxes in any supported format.
labels (list[str] | None) – Per-box label strings for display.
class_ids (list[int] | None) – Per-box class IDs for coloring via AnnotationContext.
label_to_id (dict[str, int] | None) – Mapping from class name to class ID. When provided, an
rr.AnnotationContextis logged statically on the entity soclass_idsresolve to consistent colors and display names across frames.log_heading (bool) – If True and boxes have rotation, log heading arrows.
- Return type:
None
- vision3d.viz.log_cameras(entity_prefix, images, intrinsics=None, extrinsics=None, *, jpeg_quality=None)[source]#
Log all camera images with optional pinhole projection to Rerun.
Each camera is logged to
{entity_prefix}_{i}.- Parameters:
entity_prefix (str) – Rerun entity path prefix (e.g.
"world/cam").images (CameraImages | Tensor) – Camera images
[N_cams, C, H, W].intrinsics (CameraIntrinsics | Tensor | None) – Intrinsic matrices
[N_cams, 3, 3].extrinsics (CameraExtrinsics | Tensor | None) – Extrinsic matrices
[N_cams, 4, 4](lidar-to-camera).jpeg_quality (int | None) – If set, JPEG-encode each image at this quality (0-100) before logging.
None(default) logs uncompressed.
- Return type:
None
- vision3d.viz.log_point_cloud(entity, points, *, color_by_distance=True)[source]#
Log a point cloud to Rerun.
- Parameters:
entity (str) – Rerun entity path (e.g.
"world/lidar").points (PointCloud3D | Tensor) – Point cloud
[N, 3+C]. First 3 columns are xyz.color_by_distance (bool) – Color points by distance from origin.
- Return type:
None
- vision3d.viz.log_sample(inputs, targets=None, *, entity_prefix='world', label_to_id=None, jpeg_quality=None)[source]#
Log a full sample dict to Rerun.
Convenience function that dispatches to type-specific loggers.
- Parameters:
inputs (SampleInputs) – Dict with
"points","images","extrinsics","intrinsics"keys.targets (SampleTargets | None) – Optional dict with
"boxes","labels"keys.entity_prefix (str) – Rerun entity path prefix.
label_to_id (dict[str, int] | None) – Mapping from class name to class ID for consistent coloring. Build this across all frames before logging.
jpeg_quality (int | None) – If set, JPEG-encode camera images at this quality (0-100) before logging. See
log_cameras().
- Return type:
None