bbox_format_converters
最后更新
depthai_nodes.node.parsers.utils.bbox_format_converters函数
corners_to_rotated_bbox
Python
1def corners_to_rotated_bbox(corners: np.ndarray) -> np.ndarray:corners(np.ndarray): 边界框的角点。角点应按左上、右上、右下、左下的顺序排列。
np.ndarray: 定义为 [x_center, y_center, width, height, angle] 的旋转边界框。
normalize_bboxes
Python
1def normalize_bboxes(bboxes: np.ndarray, height: int, width: int) -> np.ndarray:bboxes(np.ndarray): 包含边界框的形状为 (N, 4) 的 numpy 数组。height(int): 图像的高度。width(int): 图像的宽度。
np.ndarray: 包含归一化边界框的形状为 (N, 4) 的 numpy 数组。
rotated_bbox_to_corners
Python
1def rotated_bbox_to_corners(cx: float, cy: float, w: float, h: float, rotation: float) -> np.ndarray:cx(float): 边界框中心的 x 坐标。cy(float): 边界框中心的 y 坐标。w(float): 边界框的宽度。h(float): 边界框的高度。rotation(float): 边界框的角度,以度为单位。
np.ndarray: 边界框的角点。
top_left_wh_to_xywh
Python
1def top_left_wh_to_xywh(bboxes: np.ndarray) -> np.ndarray:bboxes(np.ndarray): 要转换的边界框。
np.ndarray: 转换后的边界框。
xywh_to_xyxy
Python
1def xywh_to_xyxy(bboxes: np.ndarray) -> np.ndarray:bboxes(np.ndarray): 包含 (x, y, width, height) 格式边界框的形状为 (N, 4) 的 numpy 数组。
np.ndarray: 包含 (x_min, y_min, x_max, y_max) 格式边界框的形状为 (N, 4) 的 numpy 数组。
xyxy_to_xywh
Python
1def xyxy_to_xywh(bboxes: np.ndarray) -> np.ndarray:bboxes(np.ndarray): 要转换的边界框。
np.ndarray: 转换后的边界框。