def _match_boxes()

in cvat-serverless/functions/endpoints/openvino_reidentification.py [0:0]


def _match_boxes(box0, box1, distance):
    cx0 = (box0["points"][0] + box0["points"][2]) / 2
    cy0 = (box0["points"][1] + box0["points"][3]) / 2
    cx1 = (box1["points"][0] + box1["points"][2]) / 2
    cy1 = (box1["points"][1] + box1["points"][3]) / 2
    is_good_distance = euclidean([cx0, cy0], [cx1, cy1]) <= distance
    is_same_label = box0["label_id"] == box1["label_id"]

    return is_good_distance and is_same_label