# message_remapping

Python API: `depthai_nodes.node.utils.message_remapping`

## 函数

### remap_message

```python
def remap_message(message: GMessage, from_transformation: dai.ImgTransformation | None, to_transformation: dai.ImgTransformation) -> GMessage:
```

将支持的 DepthAI 消息重新映射到目标图像变换。

原生 `transformTo` 映射坐标字段。映射和掩码像素数组通过最近邻插值单独扭曲，并在写入前从源缓冲区分离。源图像外的像素对于 `uint8` 数组填充 255，对于其他 dtypes 填充 -1。

参数

 * `message` (`GMessage`): `ImgDetections`、`SegmentationMask` 或 beta `Keypoints`、`Clusters`、`Map2D`、`Lines`、`Predictions` 或
   `Classifications` 消息。
 * `from_transformation` (`dai.ImgTransformation | None`): 回退源变换。如果消息没有变换，此值将在重新映射前附加到消息。现有消息变换优先。
 * `to_transformation` (`dai.ImgTransformation`): 目标坐标空间和输出像素尺寸。

返回

 * `GMessage`: 带有目标变换的重新映射消息。如果消息和 `from_transformation` 都没有提供源变换，则返回原始消息不变。

抛出

 * `TypeError`: 如果消息类型不受支持。
