Cuboid3d

class Cuboid3d[source]

Bases: supervisely.geometry.geometry.Geometry

This is a class for creating and using Cuboid3d objects for Labels

Methods

allowed_transforms

clone

Clone from GEOMETRYYY

config_from_json

config_to_json

convert

crop

param rect

Rectangle

draw

param bitmap

np.ndarray

draw_contour

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.

fliplr

param img_size

(rows, cols)

flipud

param img_size

(rows, cols)

from_json

The function from_json convert Cuboid3d from json format(dict) to Cuboid3d class object.

geometry_name

get_mask

Returns 2D boolean mask of the geometry.

name

Same as geometry_name(), but shorter.

relative_crop

Crops object like "crop" method, but return results with coordinates relative to rect :param rect: :return: list of Geometry

resize

param in_size

(rows, cols)

rotate

Rotates around image center -> New Geometry :param rotator: ImageRotator :return: Geometry

scale

Scales around origin with a given factor.

to_bbox

rtype

Rectangle

to_json

The function to_json convert Cuboid3d class object to json format(dict) :return: Cuboid3d in json format

translate

param drow

int rows shift

validate

Attributes

area

return

float

dimensions

position

rotation

clone()

Clone from GEOMETRYYY

crop(rect)
Parameters
rect

Rectangle

Returns

list of Geometry

draw(bitmap, color, thickness=1, config=None)
Parameters
bitmap

np.ndarray

color

[R, G, B]

thickness

used only in Polyline and Point

config

drawing config specific to a concrete subclass, e.g. per edge colors

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
img_size

(rows, cols)

Returns

Geometry

flipud(img_size)
Parameters
img_size

(rows, cols)

Returns

Geometry

classmethod from_json(data)[source]

The function from_json convert Cuboid3d from json format(dict) to Cuboid3d class object. :param data: Cuboid3d in json format(dict) :return: Cuboid3d class object

static geometry_name()[source]
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

Parameters
img_size : Tuple[int, int]

size of the image (height, width)

Returns

2D boolean mask of the geometry

Return type

np.ndarray

classmethod name()

Same as geometry_name(), but shorter. In order to make the code more concise.

Returns

string with name of geometry

relative_crop(rect)

Crops object like “crop” method, but return results with coordinates relative to rect :param rect: :return: list of Geometry

resize(in_size, out_size)
Parameters
in_size

(rows, cols)

out_size

(128, 256) (128, KEEP_ASPECT_RATIO) (KEEP_ASPECT_RATIO, 256)

Returns

Geometry

rotate(rotator)

Rotates around image center -> New Geometry :param rotator: ImageRotator :return: Geometry

scale(factor)

Scales around origin with a given factor. :param: factor (float): :return: Geometry

to_bbox()
Return type

Rectangle

Returns

Rectangle

to_json()[source]

The function to_json convert Cuboid3d class object to json format(dict) :return: Cuboid3d in json format

translate(drow, dcol)
Parameters
drow

int rows shift

dcol

int cols shift

Returns

Geometry

property area
Returns

float

property dimensions
property position
property rotation