PointcloudFigure¶
- class PointcloudFigure[source]¶
Bases:
supervisely.video_annotation.video_figure.VideoFigure
PointcloudFigure object for
PointcloudAnnotation
.PointcloudFigure
object is immutable.- Parameters
- parent_object : PointcloudObject
PointcloudObject object.
- geometry : Geometry
Label
geometry
.- frame_index : int
Index of Frame to which PointcloudFigure belongs.
- key : KeyIdMap, optional
KeyIdMap object.
- class_id : int, optional
ID of
PointcloudObject
to which PointcloudFigure belongs.- labeler_login : str, optional
Login of the user who created PointcloudFigure.
- updated_at : str, optional
Date and Time when PointcloudFigure was modified last. Date Format: Year:Month:Day:Hour:Minute:Seconds. Example: ‘2021-01-22T19:37:50.158Z’.
- created_at : str, optional
Date and Time when PointcloudFigure was created. Date Format is the same as in “updated_at” parameter.
- Usage example
import supervisely as sly from supervisely.geometry.cuboid_3d import Cuboid3d, Vector3d obj_class_car = sly.ObjClass('car', Cuboid3d) pointcloud_obj_car = sly.PointcloudObject(obj_class_car) position, rotation, dimension = Vector3d(-3.4, 28.9, -0.7), Vector3d(0., 0, -0.03), Vector3d(1.8, 3.9, 1.6) cuboid = Cuboid3d(position, rotation, dimension) frame_index = 10 figure = sly.PointcloudFigure(pointcloud_obj_car, cuboid, frame_index=frame_index) print(figure.to_json()) # Output: { # "geometry": { # "dimensions": { "x": 1.8, "y": 3.9, "z": 1.6 }, # "position": { "x": -3.4, "y": 28.9, "z": -0.7 }, # "rotation": { "x": 0.0, "y": 0, "z": -0.03 } # }, # "geometryType": "cuboid_3d", # "key": "4beae1be12624b70ad533c8be7477605", # "objectKey": "c1e1965efc0d4ae9b0b39367b04d637a" # }
Methods
Makes a copy of PointcloudFigure with new fields, if fields are given, otherwise it will use fields of the original PointcloudFigure.
Convert a json dict to PointcloudFigure.
Get metadata for the video figure.
Figure key.
Convert the VideoFigure to a json dict.
Not supported for pointcloud.
Attributes
Frame index of the current VideoFigure.
Geometry of the current VideoFigure.
PointcloudObject of current PointcloudFigure.
Not supported for pointcloud.
-
clone(parent_object=
None
, geometry=None
, frame_index=None
, key=None
, class_id=None
, labeler_login=None
, updated_at=None
, created_at=None
)[source]¶ Makes a copy of PointcloudFigure with new fields, if fields are given, otherwise it will use fields of the original PointcloudFigure.
- Parameters
- parent_object : PointcloudObject, optional
PointcloudObject
object.- geometry : Geometry, optional
Label
geometry
.- frame_index : int, optional
Index of Frame to which PointcloudFigure belongs.
- key : KeyIdMap, optional
KeyIdMap object.
- class_id : int, optional
ID of
ObjClass
to which PointcloudFigure belongs.- labeler_login : str, optional
Login of the user who created PointcloudFigure.
- updated_at : str, optional
Date and Time when PointcloudFigure was modified last. Date Format: Year:Month:Day:Hour:Minute:Seconds. Example: ‘2021-01-22T19:37:50.158Z’.
- created_at : str, optional
Date and Time when PointcloudFigure was created. Date Format is the same as in “updated_at” parameter.
- Returns
PointcloudFigure object
- Return type
- Usage example
import supervisely as sly from supervisely.geometry.cuboid_3d import Cuboid3d, Vector3d obj_class_car = sly.ObjClass('car', Cuboid3d) pointcloud_obj_car = sly.PointcloudObject(obj_class_car) position, rotation, dimension = Vector3d(-3.4, 28.9, -0.7), Vector3d(0., 0, -0.03), Vector3d(1.8, 3.9, 1.6) cuboid = Cuboid3d(position, rotation, dimension) frame_index = 10 figure = sly.PointcloudFigure(pointcloud_obj_car, cuboid, frame_index=frame_index) # Remember that PointcloudFigure object is immutable, and we need to assign new instance of PointcloudFigure to a new variable pointcloud_figure_clone = figure.clone(parent_object=pointcloud_obj_car, frame_index=11) print(pointcloud_figure_clone.to_json()) # Output: { # "geometry": { # "dimensions": { "x": 1.8, "y": 3.9, "z": 1.6 }, # "position": { "x": -3.4, "y": 28.9, "z": -0.7 }, # "rotation": { "x": 0.0, "y": 0, "z": -0.03 } # }, # "geometryType": "cuboid_3d", # "key": "4beae1be12624b70ad533c8be7477605", # "objectKey": "c1e1965efc0d4ae9b0b39367b04d637a" # }
-
classmethod from_json(data, objects, frame_index=
None
, key_id_map=None
)[source]¶ Convert a json dict to PointcloudFigure. Read more about Supervisely format.
- Parameters
- data : dict
Dict in json format.
- objects : PointcloudObjectCollection
PointcloudObjectCollection object.
- frame_index : int
Index of Frame to which PointcloudFigure belongs.
- key_id_map : KeyIdMap, optional
KeyIdMap object.
- Raises
RuntimeError
, if point cloudobject ID and pointcloud object key are None, if pointcloud object key and key_id_map are None, if pointcloud object with given id not found in key_id_map- Returns
PointcloudFigure object
- Return type
- Usage example
import supervisely as sly from supervisely.geometry.cuboid_3d import Cuboid3d, Vector3d obj_class_car = sly.ObjClass('car', Cuboid3d) pointcloud_obj_car = sly.PointcloudObject(obj_class_car) position, rotation, dimension = Vector3d(-3.4, 28.9, -0.7), Vector3d(0., 0, -0.03), Vector3d(1.8, 3.9, 1.6) cuboid = Cuboid3d(position, rotation, dimension) frame_index = 10 figure = sly.PointcloudFigure(pointcloud_obj_car, cuboid, frame_index=frame_index) pointcloud_figure_json = figure.to_json(save_meta=True) new_video_figure = sly.VideoFigure.from_json( pointcloud_figure_json, sly.PointcloudObjectCollection([pointcloud_obj_car]), frame_index )
- get_meta()¶
Get metadata for the video figure.
- Returns
Dictionary with metadata for the video figure.
- Return type
Dict[str, int]
- Usage example
import supervisely as sly obj_class_car = sly.ObjClass('car', sly.Rectangle) video_obj_car = sly.VideoObject(obj_class_car) fr_index = 7 geometry = sly.Rectangle(0, 0, 100, 100) video_figure_car = sly.VideoFigure(video_obj_car, geometry, fr_index) print(video_figure_car.get_meta()) # {'frame': 7}
- key()¶
Figure key.
- Returns
Figure key.
- Return type
UUID
- Usage example
key = video_figure_car.key print(key) # 158e6cf4f4ac4c639fc6994aad127c16
-
to_json(key_id_map=
None
, save_meta=False
)¶ Convert the VideoFigure to a json dict. Read more about Supervisely format.
- Parameters
- Returns
Json format as a dict
- Return type
- Usage example
import supervisely as sly obj_class_car = sly.ObjClass('car', sly.Rectangle) video_obj_car = sly.VideoObject(obj_class_car) fr_index = 7 geometry = sly.Rectangle(0, 0, 100, 100) video_figure_car = sly.VideoFigure(video_obj_car, geometry, fr_index) video_figure_json = video_figure_car.to_json(save_meta=True) print(video_figure_json) # Output: { # "key": "591d0511ba28462c8cd657691743359c", # "objectKey": "e061bc50bd464c23a008b712d195570a", # "geometryType": "rectangle", # "geometry": { # "points": { # "exterior": [ # [ # 0, # 0 # ], # [ # 100, # 100 # ] # ], # "interior": [] # } # }, # "meta": { # "frame": 7 # } # }
- property frame_index¶
Frame index of the current VideoFigure.
- Returns
Index of Frame to which VideoFigure belongs
- Return type
- Usage example
fr_index = video_figure_car.frame_index print(fr_index) # 7
- property geometry¶
Geometry of the current VideoFigure.
- Returns
Geometry object
- Return type
Geometry
- Usage example
geometry = video_figure_car.geometry print(geometry.to_json()) # Output: { # "points": { # "exterior": [ # [ # 0, # 0 # ], # [ # 100, # 100 # ] # ], # "interior": [] # } # }
- property parent_object¶
PointcloudObject of current PointcloudFigure.
- Returns
PointcloudObject object
- Return type
PointcloudObject
- Usage example
pointcloud_obj_car = pointcloud_figure_car.parent_object print(pointcloud_obj_car.to_json()) # Output: { # "key": "d573c6f081544e3da20022d932b259c1", # "classTitle": "car", # "tags": [] # }