def rbbox2d_to_near_bbox(rbboxes):
    "convert rotated bbox to nearest 'standing' or 'lying' bbox.\n    Args:\n        rbboxes: [N, 5(x, y, xdim, ydim, rad)] rotated bboxes\n    Returns:\n        bboxes: [N, 4(xmin, ymin, xmax, ymax)] bboxes\n    "
    rots = rbboxes[(..., (- 1))]
    rots_0_pi_div_2 = np.abs(limit_period(rots, 0.5, np.pi))
    cond = (rots_0_pi_div_2 > (np.pi / 4))[(..., np.newaxis)]
    bboxes_center = np.where(cond, rbboxes[:, [0, 1, 3, 2]], rbboxes[:, :4])
    bboxes = center_to_minmax_2d(bboxes_center[:, :2], bboxes_center[:, 2:])
    return bboxes
convert rotated bbox to nearest 'standing' or 'lying' bbox.
Args:
    rbboxes: [N, 5(x, y, xdim, ydim, rad)] rotated bboxes
Returns:
    bboxes: [N, 4(xmin, ymin, xmax, ymax)] bboxes
def rbbox2d_to_near_bbox(rbboxes):
    "convert rotated bbox to nearest 'standing' or 'lying' bbox.\n    Args:\n        rbboxes: [N, 5(x, y, xdim, ydim, rad)] rotated bboxes\n    Returns:\n        bboxes: [N, 4(xmin, ymin, xmax, ymax)] bboxes\n    "
    rots = rbboxes[(..., (- 1))]
    rots_0_pi_div_2 = np.abs(limit_period(rots, 0.5, np.pi))
    cond = (rots_0_pi_div_2 > (np.pi / 4))[(..., np.newaxis)]
    bboxes_center = np.where(cond, rbboxes[:, [0, 1, 3, 2]], rbboxes[:, :4])
    bboxes = center_to_minmax_2d(bboxes_center[:, :2], bboxes_center[:, 2:])
    return bboxes