# coordinates_mapper

Python API: `depthai_nodes.node.coordinates_mapper`

## Classes

| Name | Description |
| --- | --- |
| [`CoordinatesMapper`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/coordinates_mapper.md#coordinates_mapper-Classes-CoordinatesMapper) | Remap supported messages into a cached target image transformation. |

### class `CoordinatesMapper`

```python
class CoordinatesMapper(BaseThreadedHostNode)
```

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

| Type | Description |
| --- | --- |
| `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. |

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `SCRIPT_CONTENT` | `str` |  |

Properties

| Name | Type | Description |
| --- | --- | --- |
| [`out`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/coordinates_mapper.md#coordinates_mapper-Classes-CoordinatesMapper-out) | `dai.Node.Output` | Return the remapped output stream. |

Methods

| Name | Description |
| --- | --- |
| [`__init__`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/coordinates_mapper.md#coordinates_mapper-Classes-CoordinatesMapper-__init__) | Initialize logging and the platform-specific output image format. |
| [`build`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/coordinates_mapper.md#coordinates_mapper-Classes-CoordinatesMapper-build) | Connect the target and source streams used for coordinate remapping. |
| [`run`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/coordinates_mapper.md#coordinates_mapper-Classes-CoordinatesMapper-run) | Cache the latest target transformation and remap incoming messages. |

#### property `out`

```python
out: dai.Node.Output
```

Return the remapped output stream.

#### method `__init__`

```python
def __init__()
```

Initialize logging and the platform-specific output image format.

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If the pipeline device platform has no configured image-frame format. |

#### method `build`

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

Connect the target and source streams used for coordinate remapping.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `toTransformationInput` | `dai.Node.Output` | Stream providing messages whose transformation defines the target reference frame. | required |
| `fromTransformationInput` | `dai.Node.Output` | Stream providing messages whose coordinates should be remapped. | required |

Returns

| Type | Description |
| --- | --- |
| `CoordinatesMapper` | The configured node instance. |

#### method `run`

```python
def run()
```

Cache the latest target transformation and remap incoming messages.
