Skip to content

Rotated box operations

powerboxes.rotated_iou_distance(boxes1, boxes2)

Compute the pairwise iou distance between rotated boxes.

Boxes should be in (cx, cy, w, h, a) format where cx and cy are center coordinates, w and h width and height and a, the angle in degrees

Parameters:

Name Type Description Default
boxes1 NDArray[float64]

2d array of boxes in cxywha format

required
boxes2 NDArray[float64]

2d array of boxes in cxywha format

required

Raises:

Type Description
TypeError

if boxes1 or boxes2 are not numpy arrays

ValueError

if boxes1 and boxes2 have different dtypes

Returns:

Type Description
NDArray[float64]

np.ndarray: 2d matrix of pairwise distances

powerboxes.rotated_giou_distance(boxes1, boxes2)

Compute the pairwise giou distance between rotated boxes.

Boxes should be in (cx, cy, w, h, a) format where cx and cy are center coordinates, w and h width and height and a, the angle in degrees

Parameters:

Name Type Description Default
boxes1 NDArray[float64]

2d array of boxes in cxywha format

required
boxes2 NDArray[float64]

2d array of boxes in cxywha format

required

Raises:

Type Description
TypeError

if boxes1 or boxes2 are not numpy arrays

ValueError

if boxes1 and boxes2 have different dtypes

Returns:

Type Description
NDArray[float64]

np.ndarray: 2d matrix of pairwise distances

powerboxes.rotated_tiou_distance(boxes1, boxes2)

Compute pairwise box tiou (tracking iou) distances between rotated boxes.

see here for tiou definition

Boxes should be in (cx, cy, w, h, a) format where cx and cy are center coordinates, w and h width and height and a, the angle in degrees

Parameters:

Name Type Description Default
boxes1 NDArray[float64]

2d array of boxes in cxywha format

required
boxes2 NDArray[float64]

2d array of boxes in cxywha format

required

Raises:

Type Description
TypeError

if boxes1 or boxes2 are not numpy arrays

ValueError

if boxes1 and boxes2 have different dtypes

Returns:

Type Description
NDArray[float64]

np.ndarray: 2d matrix of pairwise distances