def union_of_bboxes(height, width, bboxes, erosion_rate=<NUM_LIT:0.0>, to_int=False):
x1, y1 = width, height<EOL>x2, y2 = <NUM_LIT:0>, <NUM_LIT:0><EOL>for b in bboxes:<EOL><INDENT>w, h = b[<NUM_LIT:2>] - b[<NUM_LIT:0>], b[<NUM_LIT:3>] - b[<NUM_LIT:1>]<EOL>lim_x1, lim_y1 = b[<NUM_LIT:0>] + erosion_rate * w, b[<NUM_LIT:1>] + erosion_rate * h<EOL>lim_x2, lim_y2 = b[<NUM_LIT:2>] - erosion_rate * w, b[<NUM_LIT:3>] - erosion_rate * h<EOL>x1, y1 = np.min([x1, lim_x1]), np.min([y1, lim_y1])<EOL>x2, y2 = np.max([x2, lim_x2]), np.max([y2, lim_y2])<EOL><DEDENT>return x1, y1, x2, y2<EOL>
Calculate union of bounding boxes.

    Args:
        height (float): Height of image or space.
        width (float): Width of image or space.
        bboxes (list): List like bounding boxes. Format is `[x_min, y_min, x_max, y_max]`.
        erosion_rate (float): How much each bounding box can be shrinked, useful for erosive cropping.
            Set this in range [0, 1]. 0 will not be erosive at all, 1.0 can make any bbox to lose its volume.