# message_remapping

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

## Functions

### remap_message

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

Remap a supported DepthAI message into a target image transformation.

Native `transformTo` maps coordinate fields. Map and mask pixel arrays are warped separately with nearest-neighbor interpolation
and detached from the source buffer before writing. Pixels outside the source image are filled with 255 for `uint8` arrays and -1
for other dtypes.

Parameters

 * `message` (`GMessage`): An `ImgDetections`, `SegmentationMask`, or beta `Keypoints`, `Clusters`, `Map2D`, `Lines`,
   `Predictions`, or `Classifications` message.
 * `from_transformation` (`dai.ImgTransformation | None`): Fallback source transformation. If the message has no transformation,
   this value is attached to it before remapping. An existing message transformation takes precedence.
 * `to_transformation` (`dai.ImgTransformation`): Target coordinate space and output pixel dimensions.

Returns

 * `GMessage`: Remapped message carrying the target transformation. If neither the message nor `from_transformation` provides a
   source transformation, returns the original message unchanged.

Raises

 * `TypeError`: If the message type is unsupported.
