dabble.bbox_to_btm_midpoint

Description

Converts bounding boxes to a single point of reference.

class Node(config=None, **kwargs)[source]

Converts bounding boxes to a single point which is the bottom midpoint of the bounding box.

This node is primarily used for zone counting. The bottom midpoint is an unambiguous way of telling whether an object is in the zone specified, as the bottom midpoint usually corresponds to the point where the object is located.

Inputs

img (numpy.ndarray): A NumPy array of shape \((height, width, channels)\) containing the image data in BGR format.

bboxes (numpy.ndarray): A NumPy array of shape \((N, 4)\) containing normalized bounding box coordinates of \(N\) detected objects. Each bounding box is represented as \((x_1, y_1, x_2, y_2)\) where \((x_1, y_1)\) is the top-left corner and \((x_2, y_2)\) is the bottom-right corner. The order corresponds to bbox_labels and bbox_scores.

Outputs

btm_midpoint (List[Tuple[int, int]]): A list of tuples each representing the \((x, y)\) coordinates of the bottom middle of a bounding box for use in zone analytics. The order corresponds to bboxes.

Configs

None.