# coordinates_mapper

Python API: `depthai_nodes.node.coordinates_mapper`

## Classes

### CoordinatesMapper

Remap supported messages into a cached target image transformation.

The first target message establishes the reference frame. Subsequent messages update the cached transformation when available. An
on-device Script node forwards only the target transformation, timestamps, and an empty image frame to reduce host-device traffic.

`MessageGroup`, `Collection`, and `GatheredData` items are remapped recursively while preserving container timestamps and sequence
numbers. `GatheredData.reference_data` remains unchanged. Supported leaf messages are those accepted by `remap_message`; they must
expose `getTransformation()`. Messages without a source transformation pass through unchanged.

> **Note**
> This temporary host node is intended to be replaced by equivalent functionality in DepthAI's `ImageAlign` node.

Raises

 * `RuntimeError`: If constructed on RVC2, or if a target message has no usable transformation when processing starts.
 * `TypeError`: If a leaf message with a source transformation has an unsupported type.

#### Methods

##### init

```python
def __init__(self):
```

Initialize logging and the platform-specific output image format.

Raises

 * `ValueError`: If the pipeline device platform has no configured image-frame format.

##### build

```python
def build(toTransformationInput: dai.Node.Output, fromTransformationInput: dai.Node.Output) -> CoordinatesMapper:
```

Connect the target and source streams used for coordinate remapping.

Parameters

 * `toTransformationInput` (`dai.Node.Output`): Stream providing messages whose transformation defines the target reference frame.
 * `fromTransformationInput` (`dai.Node.Output`): Stream providing messages whose coordinates should be remapped.

Returns

 * `CoordinatesMapper`: The configured node instance.

##### run

```python
def run(self):
```

Cache the latest target transformation and remap incoming messages.

#### Attributes

##### out

Return the remapped output stream.

##### SCRIPT_CONTENT
