def overlap(xy_min1, xy_max1, xy_min2, xy_max2):
    """
    Calculate the width/height of overlap area between bbox1 and bbox2
    :param xy_min1: x_min or y_min of bbox1
    :param xy_max1: x_max or y_max of bbox1
    :param xy_min2: x_min or y_min of bbox2
    :param xy_max2: x_max or y_max of bbox2
    :return:
    """

    left = max(xy_min1, xy_min2)
    right = min(xy_max1, xy_max2)

    return right - left