vis4d.vis.pointcloud.scene

Data structures to store 3D data.

Classes

BoundingBoxData(corners, color, class_, ...)

Stores bounding box data for visualization.

PointcloudData(xyz[, colors, classes, instances])

Stores pointcloud data for visualization.

Scene3D()

Stores the data for a 3D scene.

class BoundingBoxData(corners, color, class_, instance, score)[source]

Stores bounding box data for visualization.

corners

Corners of the bounding box shape [8, 3].

Type:

NDArrayFloat

color

Colors of the bounding box shape [3].

Type:

NDArrayFloat

class

Class id of the bounding box. Defaults to None.

Type:

int | None

instance

Instance id of the bounding box. Defaults to None.

Type:

int | None

score

Score of the bounding box. Defaults to None.

Type:

float | None

transform(transform)[source]

Transforms the bounding box.

Parameters:

transform (NDArrayFloat) – Transformation matrix shape [4,4] that transforms points from the current local frame to a fixed global frame.

Returns:

Returns a new bounding box with the transformed

points.

Return type:

BoundingBoxData

class PointcloudData(xyz, colors=None, classes=None, instances=None)[source]

Stores pointcloud data for visualization.

xyz

Point Coordinates shape [n_pts,3].

colors

Point Colors shape [n_pts, 3] or None.

classes

Class ids shape [n_pts] or None.

instances

Instance ids shape [n_pts] or None.

num_points

Total number of points.

num_classes

Total number of classes.

num_instances

Total number of unique class, instance combinations.

Creates a new pointcloud.

Parameters:
  • xyz (ArrayLike) – Coordinates for each point shape [n_pts, 3]

  • colors (ArrayLike | None, optional) – Colors for each point encoded as rgb [n_pts, 3] in the range (0,255). Defaults to None.

  • classes (ArrayLike | None, optional) – Class id for each point shape [n_pts]. Defaults to None.

  • instances (ArrayLike | None, optional) – Instance id for each point. shape [n_pts]. Defaults to None.

transform(transform)[source]

Transforms the pointcloud.

Parameters:

transform (NDArrayFloat) – Transformation matrix shape [4,4] that transforms points from the current local frame to a fixed global frame.

Returns:

Returns a new pointcloud with the transformed

points.

Return type:

PointcloudData

class Scene3D[source]

Stores the data for a 3D scene.

This Scene3D object can be used to be visualized by any 3D viewer.

pointclouds

Stores all pointclouds that have been registered for this scene so far.

Type:

list[PointcloudData]

pointclouds

Stores a transformation matrix (SE3, shape (4,4)) for each pointcloud.

Type:

list[NDArrayFloat]

Creates a new, empty scene.

add_bounding_box(corners, color, class_, instance, score, transform=None)[source]

Adds a bounding box to the 3D Scene.

Parameters:
  • corners (ArrayLike) – Corners of the bounding box shape [8, 3].

  • color (ArrayLike | None) – Color of the bounding box shape [3].

  • class (int | None) – Class id of the bounding box. Defaults to None.

  • instance (int | None) – Instance id of the bounding box. Defaults to None.

  • score (float | None) – Score of the bounding box. Defaults to None.

  • transform (ArrayLike | None) – Transformation matrix shape [4,4] that transforms points from the current local frame to a fixed global frame.

Returns:

Returns ‘self’ to chain calls.

Return type:

Scene3D

add_pointcloud(xyz, colors=None, classes=None, instances=None, transform=None)[source]

Adds a pointcloud to the 3D Scene.

Parameters:
  • xyz (ArrayLike) – Coordinates for each point shape [n_pts, 3] in the current local frame.

  • colors (ArrayLike | None, optional) – Colors for each point encoded as rgb [n_pts, 3] in the range (0,255) or (0,1). Defaults to None.

  • classes (ArrayLike | None, optional) – Class id for each point shape [n_pts]. Defaults to None.

  • instances (ArrayLike | None, optional) – Instance id for each point. shape [n_pts]. Defaults to None.

  • transform (ArrayLike | None, optional) – Transformation matrix shape [4,4] that transforms points from the current local frame to a fixed global frame. Defaults to None which is the identity matrix.

Returns:

Returns ‘self’ to chain calls.

Return type:

Scene3D

property bounding_boxes: list[BoundingBoxData]

Returns all bounding boxes in the scene.

Returns:

List of all bounding boxes in the scene.

Return type:

list[BoundingBoxData]

property points: list[PointcloudData]

Returns all points of all pointclouds in the scene.

Returns:

Data information for all points in the scene.

Providing information about the points, colors, classes and instances.

Return type:

List[PointcloudData]