Cuboid3d¶
-
class Cuboid3d(position, rotation, dimensions, sly_id=
None, class_id=None, labeler_login=None, updated_at=None, created_at=None)[source]¶ Bases:
Geometry3D cuboid with position, rotation, and dimensions (Vector3d). Immutable.
Cuboid3d is a geometry for a single
Label.Cuboid3dobject is immutable.- Parameters:
- position¶
Vector3d.
- rotation¶
Vector3d.
- dimensions¶
Vector3d.
- sly_id : int, optional¶
Cuboid3d ID in Supervisely server.
- class_id : int, optional¶
ID of ObjClass to which Cuboid3d belongs.
- labeler_login : str, optional¶
Login of the user who created Cuboid3d.
- updated_at : str, optional¶
Date and Time when Cuboid3d 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 Cuboid3d was created. Date Format is the same as in “updated_at” parameter.
Methods
Returns the allowed transforms for the Geometry.
Clone from GEOMETRYYY
Convert geometry config from json format
Convert geometry config to json format
Convert geometry to another geometry shape.
Crop the geometry with given rectangle.
Draws the figure contour on a given bitmap canvas :param bitmap: np.ndarray :param color: [R, G, B] :param thickness: (int) :param config: drawing config specific to a concrete subclass, e.g. per edge colors.
Converts a JSON object to a Cuboid3d.
Returns the name of the geometry.
Returns 2D boolean mask of the geometry.
Get the name of the geometry.
Crops object like "crop" method, but return results with coordinates relative to rect :param rect: Rectangle for crop.
Rotates around image center -> New Geometry :param rotator: Class for image rotation.
Scales around origin with a given factor.
Converts the Cuboid3d to a JSON object.
Validate geometry.
Attributes
Copy of the dimensions of the Cuboid3d.
Copy of the position of the Cuboid3d.
Copy of the rotation of the Cuboid3d.
- classmethod allowed_transforms()¶
Returns the allowed transforms for the Geometry.
- classmethod name()¶
Get the name of the geometry.
Same as
geometry_name(), but shorter. In order to make the code more concise.- Returns:
string with name of geometry
- static geometry_name()[source]¶
Returns the name of the geometry.
- Returns:
name of the geometry
- Return type:
- clone()¶
Clone from GEOMETRYYY
-
convert(new_geometry, contour_radius=
0, approx_epsilon=None)¶ Convert geometry to another geometry shape.
-
draw_contour(bitmap, color, thickness=
1, config=None)¶ Draws the figure contour on a given bitmap canvas :param bitmap: np.ndarray :param color: [R, G, B] :param thickness: (int) :param config: drawing config specific to a concrete subclass, e.g. per edge colors
- fliplr(img_size)¶
- Parameters:
- Returns:
Geometry after flip in horizontal.
- Return type:
- Raises:
NotImplementedError – if method is not implemented in subclass
- flipud(img_size)¶
- Parameters:
- Returns:
Geometry after flip in vertical.
- Return type:
- Raises:
NotImplementedError – if method is not implemented in subclass
- get_mask(img_size)¶
Returns 2D boolean mask of the geometry. With shape as img_size (height, width) and filled with True values inside the geometry and False values outside. dtype = np.bool shape = img_size
- relative_crop(rect)¶
Crops object like “crop” method, but return results with coordinates relative to rect :param rect: Rectangle for crop. :type rect:
Rectangle:returns: List of Geometry after relative crop. :rtype: List[Geometry]` :raises NotImplementedError: if method is not implemented in subclass
- resize(in_size, out_size)¶
- Parameters:
- Returns:
Geometry after resize.
- Return type:
- Raises:
NotImplementedError – if method is not implemented in subclass
- rotate(rotator)¶
Rotates around image center -> New Geometry :param rotator: Class for image rotation. :type rotator:
ImageRotator:returns: Geometry after rotation. :rtype:Geometry
- scale(factor)¶
Scales around origin with a given factor. :param: factor: Scale factor. :type factor: float :returns:
Geometry:rtype:Geometry:raises NotImplementedError: if method is not implemented in subclass
- to_bbox()¶
- Returns:
Rectangle from geometry.
- Return type:
- Raises:
NotImplementedError – if method is not implemented in subclass
- to_json()[source]¶
Converts the Cuboid3d to a JSON object.
- Returns:
JSON object
- Return type:
- Returns:
Cuboid3d in json format
- validate(obj_class_shape, settings)¶
Validate geometry.
- Parameters:
- Raises:
ValueError – if geometry validation error
- property area¶
- Returns:
float
- property dimensions¶
Copy of the dimensions of the Cuboid3d.
- property position¶
Copy of the position of the Cuboid3d.