def box_area(box):
    """
    Calculates the area of a bounding box.
    Source code mainly taken from:
    https://www.pyimagesearch.com/2016/11/07/intersection-over-union-iou-for-object-detection/
    `box`: the bounding box to calculate the area for with the format ((x_min, x_max), (y_min, y_max))
    return: the bounding box area
    """
    return max(0, box[0][1] - box[0][0] + 1) * max(0, box[1][1] - box[1][0] + 1)