paralleldomain.model.annotation

class AnnotationTypes

Allows to get type-safe access to annotation type related information, e.g., annotation data or class maps.

BoundingBoxes2D
Type

Type[paralleldomain.model.annotation.bounding_box_2d.BoundingBoxes2D]

BoundingBoxes3D
Type

Type[paralleldomain.model.annotation.bounding_box_3d.BoundingBoxes3D]

SemanticSegmentation2D
Type

Type[paralleldomain.model.annotation.semantic_segmentation_2d.SemanticSegmentation2D]

InstanceSegmentation2D
Type

Type[paralleldomain.model.annotation.instance_segmentation_2d.InstanceSegmentation2D]

SemanticSegmentation3D
Type

Type[paralleldomain.model.annotation.semantic_segmentation_3d.SemanticSegmentation3D]

InstanceSegmentation3D
Type

Type[paralleldomain.model.annotation.instance_segmentation_3d.InstanceSegmentation3D]

OpticalFlow
Type

Type[paralleldomain.model.annotation.optical_flow.OpticalFlow]

Depth
Type

Type[paralleldomain.model.annotation.depth.Depth]

SurfaceNormals3D
Type

Type[paralleldomain.model.annotation.surface_normals_3d.SurfaceNormals3D]

SurfaceNormals2D
Type

Type[paralleldomain.model.annotation.surface_normals_2d.SurfaceNormals2D]

SceneFlow
Type

Type[paralleldomain.model.annotation.scene_flow.SceneFlow]

MaterialProperties2D
Type

Type[paralleldomain.model.annotation.material_properties_2d.MaterialProperties2D]

MaterialProperties3D
Type

Type[paralleldomain.model.annotation.material_properties_3d.MaterialProperties3D]

Albedo2D
Type

Type[paralleldomain.model.annotation.albedo_2d.Albedo2D]

Points2D
Type

Type[paralleldomain.model.annotation.point_2d.Points2D]

Polygons2D
Type

Type[paralleldomain.model.annotation.polygon_2d.Polygons2D]

Polylines2D
Type

Type[paralleldomain.model.annotation.polyline_2d.Polylines2D]

Examples

Access 2D Bounding Box annotations for a camera frame:

camera_frame: SensorFrame = ...  # get any camera's SensorFrame

from paralleldomain.model.annotation import AnnotationTypes

boxes_2d = camera_frame.get_annotations(AnnotationTypes.BoundingBoxes2D)
for b in boxes_2d.boxes:
    print(b.class_id, b.instance_id)

Access class map for an annotation type in a scene:

scene: Scene = ...  # get a Scene instance

from paralleldomain.model.annotation import AnnotationTypes

class_map = scene.get_class_map(AnnotationTypes.SemanticSegmentation2D)
for id, class_detail in class_map.items():
    print(id, class_detail.name)
class BoundingBox2D(x, y, width, height, class_id, instance_id, attributes=<factory>)

Represents a 2D Bounding Box annotation including geometry.

Parameters
x

Top-Left corner in image pixels coordinates along x-axis

Type

paralleldomain.model.geometry.bounding_box_2d.T

y

Top-Left corner in image pixels coordinates along y-axis

Type

paralleldomain.model.geometry.bounding_box_2d.T

width

Width of box in pixel along x-axis

Type

paralleldomain.model.geometry.bounding_box_2d.T

height

Height of box in pixel along y-axis

Type

paralleldomain.model.geometry.bounding_box_2d.T

class_id

Class ID of annotated object. Can be used to lookup more details in ClassMap.

Type

int

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D.

Type

int

attributes

Dictionary of arbitrary object attributes.

Type

Dict[str, Any]

property area

Returns area of 2D Bounding Box in square pixel.

property edges: numpy.ndarray

Returns the 2D edges of a bounding box.

Edges are returned in order of connecting the vertices in the following order:

  • [0, 1]

  • [1, 2]

  • [2, 3]

  • [3, 0]

0--------1
|        |
|        | right
|        |
3--------2
  bottom
Return type

ndarray

include_point(point, inline=False)

Extends the dimensions of the box to include the specified point.

Parameters
  • point (paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.bounding_box_2d.T]) – Instance of Point2DGeometry which needs to be included in updated bounding box.

  • inline (bool) – When set, do not return a copy of the object but update the current object. Default: False.

Returns

A copy of the current object with extended dimensions, if inline is set. Otherwise, returns None.

Return type

Optional[BoundingBox2DBaseGeometry[TypeVar(T, int, float)]]

include_points(points, inline=False)

Extends the dimensions of the box to include the specified point.

Parameters
  • points (List[paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.bounding_box_2d.T]]) – List of Point2DGeometry which need to be included in updated bounding box.

  • inline (bool) – When set, do not return a copy of the object but update the current object. Default: False.

Returns

A copy of the current object with extended dimensions, if inline is set. Otherwise, returns None.

Return type

Optional[BoundingBox2DBaseGeometry[TypeVar(T, int, float)]]

classmethod merge_boxes(target_box, source_box)

Takes two 2D box geometries as input and merges both into a new box geometry. The resulting box geometry has dimensions from target_box and source_box merged into it.

Return type

BoundingBox2DBaseGeometry[TypeVar(T, int, float)]

Parameters
property vertices: numpy.ndarray

Returns the 2D vertices of a bounding box.

Vertices are returned in the following order:

0--------1
|        |
|        | right
|        |
3--------2
  bottom
Return type

ndarray

class BoundingBoxes2D(boxes)

Collection of 2D Bounding Boxes.

Parameters

boxes (List[paralleldomain.model.annotation.bounding_box_2d.BoundingBox2D]) – boxes

Return type

None

boxes

Unordered list of BoundingBox2D instances

Type

List[paralleldomain.model.annotation.bounding_box_2d.BoundingBox2D]

get_box_by_instance_id(instance_id)

Returns the box with matching instance ID.

Parameters

instance_id (int) – Instance ID of box that should be returned.

Returns

Matching box instance. If none found, returns None.

Return type

Optional[BoundingBox2D]

get_boxes_by_attribute_key(attr_key)

Returns all boxes having a certain attribute, independent of value.

Parameters

attr_key (str) – Name of attribute.

Returns

List of box instances that have the specified attribute.

Return type

List[BoundingBox2D]

get_boxes_by_attribute_value(attr_key, attr_value)

Returns all boxes having the specified attribute and value.

Parameters
  • attr_key (str) – Name of attribute.

  • attr_value (Any) – Value of attribute.

Returns

List of box instances that have the specified attribute and value.

Return type

List[BoundingBox2D]

get_boxes_by_attribute_values(attr_key, attr_values)

Returns all boxes having the specified attribute and any of the values.

Parameters
  • attr_key (str) – Name of attribute.

  • attr_values (List[Any]) – Allowed values of attribute.

Returns

List of box instances that have the specified attribute and any of the values.

Return type

List[BoundingBox2D]

get_boxes_by_class_id(class_id)

Returns all boxes having a the specified class ID.

Parameters

class_id (int) – Class ID.

Returns

List of box instances that are of the specified class.

Return type

List[BoundingBox2D]

get_boxes_by_class_ids(class_ids)

Returns all boxes having any of the specified class IDs.

Parameters

class_ids (List[int]) – Class IDs.

Returns

List of box instances that are of any of the specified classes.

Return type

List[BoundingBox2D]

static merge_boxes(target_box, source_box)

Takes two 2D boxes as input and merges both into a new box. The resulting box has the exact same properties as target_box, but with extended source_box dimensions merged into it.

Return type

BoundingBox2D

Parameters
class BoundingBox3D(pose, width, height, length, class_id, instance_id, num_points, attributes=<factory>)

Represents a 3D Bounding Box geometry.

Parameters
pose

6D Pose for box in 3D sensor space.

Type

paralleldomain.utilities.transformation.Transformation

length

Length of box in meter along x-axis.

Type

paralleldomain.model.geometry.bounding_box_3d.T

width

Width of box in meter along y-axis.

Type

paralleldomain.model.geometry.bounding_box_3d.T

height

Height of box in meter along z-axis.

Type

paralleldomain.model.geometry.bounding_box_3d.T

class_id

Class ID of annotated object. Can be used to lookup more details in ClassMap.

Type

int

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D.

Type

int

num_points

Number of LiDAR points of related Sensor.

Type

int

attributes

Dictionary of arbitrary object attributes.

Type

Dict[str, Any]

property edges: numpy.ndarray

Returns the 3D edges of a bounding box.

Edges are returned in order of connecting the vertices in the following order:

  • [0, 1]

  • [1, 2]

  • [2, 3]

  • [3, 0]

  • [4, 5]

  • [5, 6]

  • [6, 7]

  • [7, 4]

  • [2, 6]

  • [7, 3]

  • [1, 5]

  • [4, 0]

   5--------6
  /|   top /|
 / |      / |
1--------2  |
|  4-----|--7
| /      | /
|/       |/ left
0--------3
  front
Return type

ndarray

property faces: numpy.ndarray

Returns the 3D faces of a bounding box.

Faces are returned in order of connecting the vertices in the following order:

  • [0, 1, 2, 3] (front)

  • [4, 5, 6, 7] (back)

  • [3, 2, 6, 7] (left)

  • [0, 1, 5, 4] (right)

  • [6, 2, 1, 5] (top)

  • [7, 3, 0, 4] (bottom)

   5--------6
  /|   top /|
 / |      / |
1--------2  |
|  4-----|--7
| /      | /
|/       |/ left
0--------3
  front
Return type

ndarray

classmethod merge_boxes(target_box, source_box)

Takes two 3D box geometries as input and merges both into a new box geometry. The resulting box geometry has dimensions from target_box and source_box merged into it.

Return type

BoundingBox3DBaseGeometry[TypeVar(T, int, float)]

Parameters
property vertices: numpy.ndarray

Returns the 3D vertices of a bounding box.

Vertices are returned in the following order:

   5--------6
  /|   top /|
 / |      / |
1--------2  |
|  4-----|--7
| /      | /
|/       |/ left
0--------3
  front
Return type

ndarray

property volume: paralleldomain.model.geometry.bounding_box_3d.T

Returns volume of 3D Bounding Box in cubic meter.

Return type

TypeVar(T, int, float)

class BoundingBoxes3D(boxes)

Collection of 3D Bounding Boxes

Parameters

boxes (List[paralleldomain.model.annotation.bounding_box_3d.BoundingBox3D]) – boxes

Return type

None

boxes

Unordered list of BoundingBox3D instances

Type

List[paralleldomain.model.annotation.bounding_box_3d.BoundingBox3D]

get_box_by_instance_id(instance_id)

Returns the box with matching instance ID.

Parameters

instance_id (int) – Instance ID of box that should be returned.

Returns

Matching box instance. If none found, returns None.

Return type

Optional[BoundingBox3D]

get_boxes_by_attribute_key(attr_key)

Returns all boxes having a certain attribute, independent of value.

Parameters

attr_key (str) – Name of attribute.

Returns

List of box instances that have the specified attribute.

Return type

List[BoundingBox3D]

get_boxes_by_attribute_value(attr_key, attr_value)

Returns all boxes having the specified attribute and value.

Parameters
  • attr_key (str) – Name of attribute.

  • attr_value (Any) – Value of attribute.

Returns

List of box instances that have the specified attribute and value.

Return type

List[BoundingBox3D]

get_boxes_by_attribute_values(attr_key, attr_values)

Returns all boxes having the specified attribute and any of the values.

Parameters
  • attr_key (str) – Name of attribute.

  • attr_values (List[Any]) – Allowed values of attribute.

Returns

List of box instances that have the specified attribute and any of the values.

Return type

List[BoundingBox3D]

get_boxes_by_class_id(class_id)

Returns all boxes having a the specified class ID.

Parameters

class_id (int) – Class ID.

Returns

List of box instances that are of the specified class.

Return type

List[BoundingBox3D]

get_boxes_by_class_ids(class_ids)

Returns all boxes having any of the specified class IDs.

Parameters

class_ids (List[int]) – Class IDs.

Returns

List of box instances that are of any of the specified classes.

Return type

List[BoundingBox3D]

static merge_boxes(target_box, source_box)

Takes two 3D boxes as input and merges both into a new box. The resulting box has the exact same properties as target_box, but with extended source_box dimensions merged into it.

Return type

BoundingBox3D

Parameters
class Depth(depth)

Represents a Depth mask for a camera image.

Parameters

depth (numpy.ndarray) – depth

Return type

None

depth

Matrix of shape (H X W x 1), , where H is the height and W is the width of corresponding camera image. The third axis contains the depth distance for each pixel as int in meter.

Type

numpy.ndarray

class InstanceSegmentation2D(instance_ids)

Represents a 2D Instance Segmentation mask for a camera image.

Parameters

instance_ids (numpy.ndarray) – instance_ids

Return type

None

instance_ids

Matrix of shape (H x W x 1), where H is the height and W is the width of corresponding camera image. The third axis contains the instance ID for each pixel as int.

Type

numpy.ndarray

get_instance(instance_id)

Returns a bool mask where instance is present.

Parameters

instance_id (int) – ID of instance to be masked

Returns

Mask of same shape as class_ids and bool values. True where pixel matches instance, False where it doesn’t.

Return type

ndarray

get_instances(instance_ids)

Returns a bool mask where instances are present.

Parameters

instance_ids (List[int]) – IDs of instances to be masked

Returns

Mask of same shape as class_ids and bool values. True where pixel matches one of the instances, False where it doesn’t.

Return type

ndarray

property rgb_encoded: numpy.ndarray

Outputs instance_ids mask as RGB matrix with shape (H x W x 3), with R being the lowest and B being the highest 8 bit.

Return type

ndarray

class InstanceSegmentation3D(instance_ids)

Represents a 3D Instance Segmentation mask for a point cloud.

Parameters

instance_ids (numpy.ndarray) – instance_ids

Return type

None

instance_ids

2D Matrix of size (N x 1), where N is the length of the corresponding point cloud. The second axis contains the instance ID for each point as int.

Type

numpy.ndarray

class OpticalFlow(vectors)

Represents an Optical Flow mask for a camera image.

Parameters

vectors (numpy.ndarray) – vectors

Return type

None

vectors

Matrix of shape (H X W x 2), , where H is the height and W is the width of corresponding camera image. The third axis contains the x and y offset to the pixels coordinate on the next image.

Type

numpy.ndarray

Example

Using the Optical Flow vector mask in combination with Image.coordinates allows for a fast retrieval of absolute pixel coordinates.

camera_frame: SensorFrame = ...  # get any camera's SensorFrame

flow = camera_frame.get_annotations(AnnotationTypes.OpticalFlow)
rgb = camera_frame.image.rgb
next_image = np.zeros_like(rgb)
coordinates = camera_frame.image.coordinates
next_frame_coords = coordinates + np.round(flow.vectors).astype(int)[...,[1,0]]

for y in range(rgb.shape[0]):
    for x in range(rgb.shape[1]):
        next_coord = next_frame_coords[y, x]
        if 0 <= next_coord[0] < rgb.shape[0] and 0 <= next_coord[1] < rgb.shape[1]:
            next_image[next_coord[0], next_coord[1], :] = rgb[y, x, :]

import cv2
cv2.imshow("window_name", cv2.cvtColor(
        src=next_image,
        code=cv2.COLOR_RGBA2BGRA,
))
cv2.waitKey()
class Point2D(x, y, class_id, instance_id=-1, attributes=<factory>)

Represents a 2D Point.

Parameters
x

coordinate along x-axis in image pixels

Type

paralleldomain.model.geometry.point_2d.T

y

coordinate along y-axis in image pixels

Type

paralleldomain.model.geometry.point_2d.T

class_id

Class ID of the point. Can be used to lookup more details in ClassMap.

Type

int

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D. If unknown defaults to -1.

Type

int

attributes

Dictionary of arbitrary object attributes.

Type

Dict[str, Any]

to_numpy()

Returns the coordinates as a numpy array with shape (1 x 2).

class Points2D(points)

Collection of 2D Points

Parameters

points (List[paralleldomain.model.annotation.point_2d.Point2D]) – points

Return type

None

points

Unordered list of Point2D instances

Type

List[paralleldomain.model.annotation.point_2d.Point2D]

class Point3D(x, y, z, class_id, instance_id=-1, attributes=<factory>)

Represents a 3D Point.

Parameters
x

coordinate along x-axis in image pixels

Type

paralleldomain.model.geometry.point_3d.T

y

coordinate along y-axis in image pixels

Type

paralleldomain.model.geometry.point_3d.T

class_id

Class ID of the point. Can be used to lookup more details in ClassMap.

Type

int

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation3D or InstanceSegmentation3D. If unknown defaults to -1.

Type

int

attributes

Dictionary of arbitrary object attributes.

Type

Dict[str, Any]

to_numpy()

Returns the coordinates as a numpy array with shape (1 x 3).

class Points3D(points)

Collection of 3D Points

Parameters

points (List[paralleldomain.model.annotation.point_3d.Point3D]) – points

Return type

None

points

Unordered list of Point3D instances

Type

List[paralleldomain.model.annotation.point_3d.Point3D]

class PointCachePointsDecoderProtocol(*args, **kwargs)
class PointCache(instance_id, components)

Represents a 3D Bounding Box geometry.

Parameters
  • instance_id (int) – instance_id

  • components (List[paralleldomain.model.annotation.point_cache.PointCacheComponent]) – components

Return type

None

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., BoundingBox3D or InstanceSegmentation3D.

Type

int

components

The point cache component containing the point cloud.

Type

List[paralleldomain.model.annotation.point_cache.PointCacheComponent]

class PointCaches(caches)

Represents a 3D Bounding Box geometry.

Parameters
Return type

None

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., BoundingBox3D or InstanceSegmentation3D.

components

The point cache component containing the point cloud.

class Polygon2D(lines, class_id, instance_id=-1, attributes=<factory>)

A closed polygon made a collection of 2D Lines.

Parameters
lines

Ordered list of Line2D instances

Type

List[paralleldomain.model.geometry.polyline_2d.Line2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]]

class_id

Class ID of the polygon. Can be used to lookup more details in ClassMap.

Type

int

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D. If unknown defaults to -1.

Type

int

attributes

Dictionary of arbitrary object attributes.

Type

Dict[str, Any]

property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 2).

class Polygons2D(polygons)

Collection of 2D Polygons

Parameters

polygons (List[paralleldomain.model.annotation.polygon_2d.Polygon2D]) – polygons

Return type

None

polygons

Ordered list of Polygon2D instances

Type

List[paralleldomain.model.annotation.polygon_2d.Polygon2D]

class Polygon3D(lines, class_id, instance_id=-1, attributes=<factory>)

A closed polygon made a collection of 3D Lines.

Parameters
lines

Ordered list of Line3D instances

Type

List[paralleldomain.model.geometry.polyline_3d.Line3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]]

class_id

Class ID of the polygon. Can be used to lookup more details in ClassMap.

Type

int

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation3D or InstanceSegmentation3D. If unknown defaults to -1.

Type

int

attributes

Dictionary of arbitrary object attributes.

Type

Dict[str, Any]

property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 3).

class Polygons3D(polygons)

Collection of 3D Polygons

Parameters

polygons (List[paralleldomain.model.annotation.polygon_3d.Polygon3D]) – polygons

Return type

None

polygons

Ordered list of Polygon3D instances

Type

List[paralleldomain.model.annotation.polygon_3d.Polygon3D]

class Line2D(start, end, class_id, directed=False, instance_id=-1, attributes=<factory>)

Represents a 2D Line.

Parameters
start

the 2D start point of the line in image coordinates

Type

paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]

end

the 2D end point of the line in image coordinates

Type

paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]

directed

whether the line is directed from start to end (if False the line is bi-directional)

Type

bool

class_id

Class ID of the line. Can be used to lookup more details in ClassMap.

Type

int

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D. If unknown defaults to -1.

Type

int

attributes

Dictionary of arbitrary object attributes.

Type

Dict[str, Any]

property direction: paralleldomain.model.geometry.point_2d.Point2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]

Returns the directional vector of the line.

Return type

Point2DBaseGeometry[TypeVar(T, int, float)]

intersects_at(other)

Returns the point at which the two lines intersect and a bool value that indicated if the intersection point is within the line segments. Returns None if the lines are parallel. See: https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect

Return type

Tuple[Optional[Point2DBaseGeometry[TypeVar(T, int, float)]], bool, bool]

Parameters

other (paralleldomain.model.geometry.polyline_2d.Line2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]) –

property length: float

Returns the length of the line.

Return type

float

property slope: float

Returns the slope of the line. Returns np.inf for vertical lines.

Return type

float

to_numpy()

Returns the start and end coordinates as a numpy array with shape (2 x 2).

class Polyline2D(lines, class_id, instance_id=-1, attributes=<factory>)

A polyline made of a collection of 2D Lines

Parameters
lines

Ordered list of Line2D instances

Type

List[paralleldomain.model.geometry.polyline_2d.Line2DBaseGeometry[paralleldomain.model.geometry.polyline_2d.T]]

class_id

Class ID of the polyline. Can be used to lookup more details in ClassMap.

Type

int

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation2D or InstanceSegmentation3D. If unknown defaults to -1.

Type

int

attributes

Dictionary of arbitrary object attributes.

Type

Dict[str, Any]

property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 2).

class Polylines2D(polylines)

Collection of 2D Polylines

Parameters

polylines (List[paralleldomain.model.annotation.polyline_2d.Polyline2D]) – polylines

Return type

None

polylines

Ordered list of Polyline2D instances

Type

List[paralleldomain.model.annotation.polyline_2d.Polyline2D]

class Line3D(start, end, class_id, directed=False, instance_id=-1, attributes=<factory>)

Represents a 3D Line.

Parameters
start

the 3D start point of the line in image coordinates

Type

paralleldomain.model.geometry.point_3d.Point3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]

end

the 3D end point of the line in image coordinates

Type

paralleldomain.model.geometry.point_3d.Point3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]

directed

whether the line is directed from start to end (if False the line is bi-directional)

Type

bool

class_id

Class ID of the line. Can be used to lookup more details in ClassMap.

Type

int

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation3D or InstanceSegmentation3D. If unknown defaults to -1.

Type

int

attributes

Dictionary of arbitrary object attributes.

Type

Dict[str, Any]

property direction: paralleldomain.model.geometry.point_3d.Point3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]

Returns the directional vector of the line.

Return type

Point3DBaseGeometry[TypeVar(T, int, float)]

property length: float

Returns the length of the line.

Return type

float

to_numpy()

Returns the start and end coordinates as a numpy array with shape (2 x 3).

class Polyline3D(lines, class_id, instance_id=-1, attributes=<factory>)

A polyline made of a collection of 3D Lines

Parameters
lines

Ordered list of Line3D instances

Type

List[paralleldomain.model.geometry.polyline_3d.Line3DBaseGeometry[paralleldomain.model.geometry.polyline_3d.T]]

class_id

Class ID of the polyline. Can be used to lookup more details in ClassMap.

Type

int

instance_id

Instance ID of annotated object. Can be used to cross-reference with other instance annotation types, e.g., InstanceSegmentation3D or InstanceSegmentation3D. If unknown defaults to -1.

Type

int

attributes

Dictionary of arbitrary object attributes.

Type

Dict[str, Any]

property length

Returns the length of the line.

to_numpy()

Returns all ordered vertices as a numpy array of shape (N x 3).

class Polylines3D(polylines)

Collection of 3D Polylines

Parameters

polylines (List[paralleldomain.model.annotation.polyline_3d.Polyline3D]) – polylines

Return type

None

polylines

Ordered list of Polyline3D instances

Type

List[paralleldomain.model.annotation.polyline_3d.Polyline3D]

class SceneFlow(vectors)

Represents an Scene Flow mask for a point cloud.

Parameters

vectors (numpy.ndarray) – vectors

Return type

None

vectors

Matrix of shape (N x 3), , where N is the number of points of the corresponding point cloud. The second axis contains the x, y and z offset to the position the sampled point will be at in the next frame. Note: This exact position might not be sampled by a Lidar in the next frame!

Type

numpy.ndarray

Example

Using the Scene Flow vector mask in combination with PointCloud.xyz to get a view of the next frame.

lidar_frame: LidarSensorFrame = ...  # get any lidars's SensorFrame

flow = lidar_frame.get_annotations(AnnotationTypes.SceneFlow)
xyz = lidar_frame.point_cloud.xyz
next_frame_xyz = xyz + flow.vectors

import open3d as o3d
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(next_frame_xyz)
o3d.visualization.draw_geometries([pcd])
class SemanticSegmentation2D(class_ids)

Represents a 2D Semantic Segmentation mask for a camera image.

Parameters

class_ids (numpy.ndarray) – class_ids

Return type

None

class_ids

Matrix of shape (H x W x 1), where H is height and W is width of corresponding camera image. The third axis contains the class ID for each pixel as int.

Type

numpy.ndarray

get_class_mask(class_id)

Returns a bool mask where class is present.

Parameters

class_id (int) – ID of class to be masked

Returns

Mask of same shape as class_ids and bool values. True where pixel matches class, False where it doesn’t.

Return type

ndarray

get_classes_mask(class_ids)

Returns a bool mask where classes are present.

Parameters

class_ids (List[int]) – IDs of classes to be masked

Returns

Mask of same shape as class_ids and bool values. True where pixel matches one of the classes, False where it doesn’t.

Return type

ndarray

property rgb_encoded: numpy.ndarray

Outputs class_ids mask as RGB-encoded image matrix with shape (H x W x 3), with R (index: 0) being the lowest and B (index: 2) being the highest 8 bit.

Return type

ndarray

class SemanticSegmentation3D(class_ids)

Represents a 3D Semantic Segmentation mask for a point cloud.

Parameters

class_ids (numpy.ndarray) – class_ids

Return type

None

class_ids

Matrix of shape (N x 1), where N is the length of the corresponding point cloud. The second axis contains the class ID for each point as int.

Type

numpy.ndarray

class SurfaceNormals2D(normals)

Represents a mask of surface normals for a camera image.

Parameters

normals (numpy.ndarray) – vectors

Return type

None

normals

Matrix of shape (H X W x 3), , where H is the height and W is the width of corresponding camera image. The third axis contains the x, y and z normal direction of the surface sampled by the pixel in the camera coordinate system.

Type

numpy.ndarray

class SurfaceNormals3D(normals)

Represents a mask of surface normals for a point cloud.

Parameters

normals (numpy.ndarray) – vectors

Return type

None

normals

Matrix of shape (N x 3), , where N is the number of points of the corresponding point cloud. The second axis contains the x, y and z normal direction of the surface the corresponding point was sampled from.

Type

numpy.ndarray

Example

Using the Surface Normal mask in combination with PointCloud.xyz to visualize the normals of each point.

lidar_frame: LidarSensorFrame = ...  # get any lidars's SensorFrame

sur_normals = lidar_frame.get_annotations(AnnotationTypes.SurfaceNormals3D)
xyz = lidar_frame.point_cloud.xyz
normal_points = xyz + sur_normals.normals
normal_line_points = np.concatenate([xyz, normal_points], axis=-1).reshape((2 * len(xyz), 3))
line_connections = np.arange(2 * len(xyz)).reshape((-1, 2))

import open3d as o3d
pcd = o3d.geometry.PointCloud()
pcd.points = o3d.utility.Vector3dVector(xyz)

colors = [[1, 0, 0] for i in range(len(line_connections))]
line_set = o3d.geometry.LineSet(
    points=o3d.utility.Vector3dVector(normal_line_points),
    lines=o3d.utility.Vector2iVector(line_connections),
)
line_set.colors = o3d.utility.Vector3dVector(colors)

o3d.visualization.draw_geometries([pcd, line_set])
class MaterialProperties2D

Not Implemented yet!

Return type

None

class MaterialProperties3D(material_ids, roughness=None, metallic=None, specular=None, emissive=None, opacity=None, flags=None)

Represents a 3D Material Segmentation mask for a point cloud.

Parameters
  • material_ids (numpy.ndarray) – material_ids

  • roughness (Optional[numpy.ndarray]) – roughness

  • metallic (Optional[numpy.ndarray]) – metallic

  • specular (Optional[numpy.ndarray]) – specular

  • emissive (Optional[numpy.ndarray]) – emissive

  • opacity (Optional[numpy.ndarray]) – opacity

  • flags (Optional[numpy.ndarray]) – flags

Return type

None

material_ids

Matrix of shape (N x 1), where N is the length of the corresponding point cloud. The second axis contains the material ID for each point as int.

Type

numpy.ndarray

roughness

Matrix of shape (N x 1), where N is the length of the corresponding point cloud. The second axis contains the material’s roughness value for each point as float.

Type

Optional[numpy.ndarray]

specular

Matrix of shape (N x 1), where N is the length of the corresponding point cloud. The second axis contains the material’s specular value for each point as float.

Type

Optional[numpy.ndarray]

emissive

Matrix of shape (N x 1), where N is the length of the corresponding point cloud. The second axis contains the material’s emissive value for each point as float.

Type

Optional[numpy.ndarray]

opacity

Matrix of shape (N x 1), where N is the length of the corresponding point cloud. The second axis contains the material’s opacity value for each point as float.

Type

Optional[numpy.ndarray]

flag

Matrix of shape (N x 1), where N is the length of the corresponding point cloud. The second axis contains special flags for each point encoded as float.