Pointcloud Annotation

class supervisely_lib.pointcloud_annotation.pointcloud_annotation.PointcloudAnnotation(objects=None, figures=None, tags=None, description='', key=None)[source]

Bases: supervisely_lib.video_annotation.video_annotation.VideoAnnotation

This is a class for creating and using PointcloudAnnotation

property img_size

Size of the image (height, width).

Returns

Image size

Return type

Tuple[int, int]

Usage example
height, width = 500, 700
frames_count = 1
video_ann = sly.VideoAnnotation((height, width), frames_count)
print(video_ann.img_size)
# Output: (500, 700)
property frames_count

Number of frames.

Returns

Frames count

Return type

int

Usage example
height, width = 500, 700
frames_count = 15
video_ann = sly.VideoAnnotation((height, width), frames_count)
print(video_ann.frames_count)
# Output: 15
property figures

VideoAnnotation figures.

Returns

List of VideoFigures from all frames in VideoAnnotation

Return type

List[VideoFigure]

Usage example
height, width = 500, 700
frames_count = 1
obj_class_car = sly.ObjClass('car', sly.Rectangle)
video_obj_car = sly.VideoObject(obj_class_car)
objects = sly.VideoObjectCollection([video_obj_car])
fr_index = 7
geometry = sly.Rectangle(0, 0, 100, 100)
video_figure_car = sly.VideoFigure(video_obj_car, geometry, fr_index)
frame = sly.Frame(fr_index, figures=[video_figure_car])
frames = sly.FrameCollection([frame])

video_ann = sly.VideoAnnotation((height, width), frames_count, objects, frames)
print(len(video_ann.figures)) # 1
validate_figures_bounds()[source]

Checks if image contains figures from all frames in collection.

Raises

OutOfImageBoundsExtension, if figure is out of image bounds

Returns

None

Return type

NoneType

Usage Example
height, width = 50, 700
frames_count = 1
obj_class_car = sly.ObjClass('car', sly.Rectangle)
video_obj_car = sly.VideoObject(obj_class_car)
objects = sly.VideoObjectCollection([video_obj_car])
fr_index = 7
geometry = sly.Rectangle(0, 0, 100, 100)
video_figure_car = sly.VideoFigure(video_obj_car, geometry, fr_index)
frame = sly.Frame(fr_index, figures=[video_figure_car])
frames = sly.FrameCollection([frame])

video_ann = sly.VideoAnnotation((height, width), frames_count, objects, frames)
video_ann.validate_figures_bounds()
# raise OutOfImageBoundsExtension("Figure is out of image bounds")
to_json(key_id_map: Optional[supervisely_lib.video_annotation.key_id_map.KeyIdMap] = None)[source]

The function to_json convert PointcloudAnnotation to json format :param key_id_map: KeyIdMap class object :return: PointcloudAnnotation in json format

classmethod from_json(data, project_meta, key_id_map: Optional[supervisely_lib.video_annotation.key_id_map.KeyIdMap] = None)[source]
Parameters
  • data – input PointcloudAnnotation in json format

  • project_meta – ProjectMeta class object

  • key_id_map – KeyIdMap class object

Returns

PointcloudAnnotation class object

clone(objects=None, figures=None, tags=None, description=None)[source]
Parameters
  • objects – VideoObjectCollection

  • figures – list of figures

  • tags – VideoTagCollection

  • description – str

Returns

PointcloudAnnotation class object