boundingbox
boundingbox ¶
Module for BoundingBox and corresponding methods
Classes¶
BoundingBox ¶
Class to represent a bounding box and its methods
Functions¶
__eq__ ¶
Checks if two BoundingBoxes are the (nearly) same
Source code in niceml/utilities/boundingboxes/boundingbox.py
__repr__ ¶
calc_iou ¶
Calculates the iou between the two bounding boxes
Source code in niceml/utilities/boundingboxes/boundingbox.py
decode ¶
Decodes the predicted net values to a bounding box
Source code in niceml/utilities/boundingboxes/boundingbox.py
do_intersect ¶
Checks whether two bounding boxes do intersect
Source code in niceml/utilities/boundingboxes/boundingbox.py
encode ¶
Encodes the anchor(self) with a ground truth box to net targets
Source code in niceml/utilities/boundingboxes/boundingbox.py
get_absolute_area ¶
get_absolute_ullr ¶
Returns a tuple of upper-left and lower-right coordinates (x_upper_left, y_upper_left, x_lower_right, y_lower_right) as float or int values
Source code in niceml/utilities/boundingboxes/boundingbox.py
get_absolute_xywh ¶
Returns a tuple in pixel coords: (x, y, w, h) as float or int values
Source code in niceml/utilities/boundingboxes/boundingbox.py
get_intersection ¶
Calculates the intersection bounding box
Source code in niceml/utilities/boundingboxes/boundingbox.py
get_relative_area ¶
Returns the absolute bounding box area in pixels
get_relative_ullr ¶
Returns a tuple with relative upper-left and lower-right coordinates (x_ul,y_ul,x_lr,y_lr)
Source code in niceml/utilities/boundingboxes/boundingbox.py
get_relative_xywh ¶
Returns a tuple with relative coordinates (x,y,width,height)
scale ¶
Scales a bounding box (x_pos, y_pos, width, height) by a given scale factor.
scale: Args: scale: Factor to scale the bounding box by
Returns:
-
BoundingBox
–Scaled BoundingBox
Source code in niceml/utilities/boundingboxes/boundingbox.py
shift ¶
Shifts a bounding box on a given axis by shift_by
Parameters:
-
axis
(int
) –Axis on which to be shifted (0: X-Axis, 1: Y-Axis).
-
shift_by
(int
) –Shift value in pixels
-
direction
(int
) –Direction to be shifted (0: left if axis is 0, up if axis is 1; 1: right if axis is 0, down if axis is 1)
Source code in niceml/utilities/boundingboxes/boundingbox.py
Functions¶
bounding_box_from_ullr ¶
Returns a bounding box from given ullr coordinates
get_bounding_box_attributes ¶
Returns a list with the names of the attributes of the bounding box class
Returns:
-
List[str]
–List of strings with the names of the BoundingBox attributes
Source code in niceml/utilities/boundingboxes/boundingbox.py
get_scaled_values ¶
Scales the values with the image size from pixel to relative
Source code in niceml/utilities/boundingboxes/boundingbox.py
get_surrounding_bounding_box ¶
Finds the surrounding bounding box from the given bounding box arrays which are in ullr format. The surrounding bounding box is defined as the smallest possible rectangle that contains all the inputted boxes.
Parameters:
-
bbox_arrays
(ndarray
, default:()
) –Variable number of bounding box arrays
Returns: BoundingBox that surrounds all of the given bounding boxes
Source code in niceml/utilities/boundingboxes/boundingbox.py
split_bounding_boxes ¶
Splits the bounding_box in smaller boxes covering the same area
Parameters:
-
bounding_box
(BoundingBox
) –BoundingBox to be split
-
x_boxes
(int
) –Number of boxes to split the bounding box into along the x-axis
-
y_boxes
(int
) –Number of boxes to split the bounding box into along the y-axis
Returns: A list of bounding boxes