# utils

Python API: `depthai_nodes.message.utils`

消息复制策略和检测几何辅助函数。

## 子页面

 * [detection_utils](/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/utils/detection_utils.md)

## 函数

### copy_message

```python
def copy_message(msg: dai.Buffer) -> dai.Buffer:
```

使用第一个支持的复制策略复制 DepthAI 消息。

优先使用消息的原生 `copy()` 方法，然后是支持的自定义消息复制器，最后是 `copy.deepcopy`。缓冲区所有权遵循所选策略；原生复制可能会共享底层像素存储。

参数

 * `msg` (`dai.Buffer`): 要复制的消息。

返回

 * `dai.Buffer`: 输入消息的副本。

抛出

 * `TypeError`: 如果没有复制策略支持该消息类型。
