paralleldomain.model.geometry.bounding_box_2d

class BoundingBox2DBaseGeometry(x, y, width, height)

Represents a 2D Bounding Box geometry with a generic coordinate precision of either int or float.

Parameters:
x

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

y

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

width

Width of box in pixel along x-axis

height

Height of box in pixel along y-axis

class_id

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

instance_id

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

attributes

Dictionary of arbitrary object attributes.

include_point(point, inline=False)

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

Parameters:
  • point (Point2DBaseGeometry[TypeVar(T, int, float)]) – 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.

Return type:

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

Returns:

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

include_points(points, inline=False)

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

Parameters:
Return type:

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

Returns:

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

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 area

Returns area of 2D Bounding Box in square pixel.

property edges: 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
property vertices: ndarray

Returns the 2D vertices of a bounding box.

Vertices are returned in the following order:

0--------1
|        |
|        | right
|        |
3--------2
  bottom
property x_max: T

Returns the maximum x value of the corners of the 2D Bounding Box

property x_min: T

Returns the minimum x value of the corners of the 2D Bounding Box

property y_max: T

Returns the maximum y value of the corners of the 2D Bounding Box

property y_min: T

Returns the minimum y value of the corners of the 2D Bounding Box

class BoundingBox2DGeometry(x, y, width, height)
Parameters:
  • x (T) –

  • y (T) –

  • width (T) –

  • height (T) –

include_point(point, inline=False)

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

Parameters:
  • point (Point2DBaseGeometry[TypeVar(T, int, float)]) – 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.

Return type:

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

Returns:

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

include_points(points, inline=False)

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

Parameters:
Return type:

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

Returns:

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

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 area

Returns area of 2D Bounding Box in square pixel.

property edges: 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
property vertices: ndarray

Returns the 2D vertices of a bounding box.

Vertices are returned in the following order:

0--------1
|        |
|        | right
|        |
3--------2
  bottom
property x_max: T

Returns the maximum x value of the corners of the 2D Bounding Box

property x_min: T

Returns the minimum x value of the corners of the 2D Bounding Box

property y_max: T

Returns the maximum y value of the corners of the 2D Bounding Box

property y_min: T

Returns the minimum y value of the corners of the 2D Bounding Box