# clusters

Python API: `depthai_nodes.message.creators.clusters`

## Functions

| Name | Description |
| --- | --- |
| [`create_cluster_message`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/creators/clusters.md#clusters-Functions-create_cluster_message) | Create a native cluster message from grouped 2D points. |

### function `create_cluster_message`

```python
def create_cluster_message(clusters: list[list[list[float | int]]]) -> dai.beta.Clusters
```

Create a native cluster message from grouped 2D points.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `clusters` | `list[list[list[float | int]]]` | List of clusters, each a list of XY points. Points may be lists or tuples containing two numeric coordinates. Coordinates are copied without scaling; empty clusters are retained. | required |

Returns

| Type | Description |
| --- | --- |
| `dai.beta.Clusters` | A message with one cluster per input list, labeled by its zero-based list index. |

Raises

| Type | Description |
| --- | --- |
| `TypeError` | If clusters or their point containers have unsupported types, or a coordinate is not an int or float. |
| `ValueError` | If a point does not contain exactly two coordinates. |
