Check Overlap Bounding Box

tomni.bbox_operations.check_overlap_bbox(bb1: Union[tuple, list], bb2: Union[tuple, list]) bool[source]

Checks if two bounding boxes overlap with each other. Bounding boxes are represented as tuples or lists in the format (xmin, ymin, xmax, ymax).

Parameters
  • bb1 (Union[tuple, list]) – Bounding box 1, specified as (x1, y1, x2, y2).

  • bb2 (Union[tuple, list]) – Bounding box 2, specified as (x1, y1, x2, y2).

Raises

ValueError – If the length of either bounding box is not 4.

Returns

True if the bounding boxes overlap, False otherwise.

Return type

bool

Example:

bb1 = (1, 1, 4, 4)
bb2 = (3, 3, 6, 6)
check_overlap_bbox(bb1, bb2)
True  # The bounding boxes overlap.