def update_borders(bb: list, roi_size: list):
    """
    Update bounding box borders according to roi_size. Borders are updated from center of image.
    :param bb: original bounding box
    :param roi_size: output bounding box size
    :return: modified bounding box
    """
    mid_x = bb[0] + bb[2] / 2
    mid_y = bb[1] + bb[3] / 2

    new_x = int(mid_x - roi_size[1] / 2)
    new_y = int(mid_y - roi_size[0] / 2)

    return [new_x, new_y, roi_size[0], roi_size[1]]