# utils

Python API: `depthai_nodes.node.utils`

用于坐标重映射、裁剪脚本、图像布局和抑制的辅助函数。

## 子页面

 * [detection_config_generator](/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/utils/detection_config_generator.md)
 * [message_remapping](/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/utils/message_remapping.md)
 * [nms](/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/utils/nms.md)
 * [util_constants](/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/utils/util_constants.md)

## 函数

### to_planar

```python
def to_planar(arr: np.ndarray, shape: tuple) -> np.ndarray:
```

将输入图像 `arr` (NumPy 数组) 转换为 depthai 期望的平面格式。图像将调整大小到 `shape` 中指定的尺寸。

参数

 * `arr` (`np.ndarray`): 输入 NumPy 数组（图像）。
 * `shape` (`tuple`): 目标尺寸（宽度，高度）。

返回

 * `np.ndarray`: 包含平面图像数据的一维 NumPy 数组。
