scistag.imagestag.bounding.Bounding2D¶
- class Bounding2D(value=None, pos=None, lr=None, size=None)[source]¶
Bases:
objectDefines the 2D-bounding of a visual element by it’s upper left and lower right corner.
- Parameters
value (Bounding2DTypes | None) – The bounding value (or a bounding to copy) as defined by
Bounding2DTypes.pos (Pos2DTypes | None) – The explicit upper left coordinate
lr (Pos2DTypes | None) – The explicit lower right coordinate
size (Size2DTypes | None) – The size, relative to the upper left coordinate or lower right coordinate.
Methods
Creates a copy of the bounding :rtype:
Bounding2D:return: The copyReturns the element's size as int tuple
Returns the element's size as Size2D object
Returns the element's size as float tuple
Returns the element's height
Returns if the bounding is zero
Returns the bounding as 1D coordinate, width, height tuple
Returns the bounding as 1D coordinate tuple
Returns the bounding as 1D coordinate, width, height tuple
Returns the bounding as 1D coordinate tuple
Returns the bounding as 1D coordinate, width, height tuple
Returns the bounding as 1D coordinate tuple
Returns the element's width
Attributes
__annotations____dataclass_fields____dataclass_params____dict____doc____hash____module____weakref__list of weak references to the object (if defined)
The position of the upper left coordinate.
The position of the lower right coordinate.
- copy()[source]¶
Creates a copy of the bounding :rtype:
Bounding2D:return: The copy
- get_size()[source]¶
Returns the element’s size as Size2D object
- Return type
- Returns
The size in pixels
- is_empty()[source]¶
Returns if the bounding is zero
- Return type
- Returns
True if width and height are zero
- to_coord_size_tuple()[source]¶
Returns the bounding as 1D coordinate, width, height tuple
- Returns
A tuple in the format x, y, width, height
- to_coord_tuple()[source]¶
Returns the bounding as 1D coordinate tuple
- Returns
A tuple in the format x, y, x2, y2
- to_int_coord_size_tuple()[source]¶
Returns the bounding as 1D coordinate, width, height tuple
- Returns
A tuple in the format x, y, width, height
- to_int_coord_tuple()[source]¶
Returns the bounding as 1D coordinate tuple
- Returns
A tuple in the format x, y, x2, y2
- to_nested_coord_size_tuple()[source]¶
Returns the bounding as 1D coordinate, width, height tuple
- Returns
A tuple in the format (x, y), (width, height)
- to_nested_coord_tuple()[source]¶
Returns the bounding as 1D coordinate tuple
- Returns
A tuple in the format (x, y), (x2, y2)