# segmentation

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

## Functions

| Name | Description |
| --- | --- |
| [`create_segmentation_message`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/creators/segmentation.md#segmentation-Functions-create_segmentation_message) | Create a DepthAI message for segmentation mask. |

### function `create_segmentation_message`

```python
def create_segmentation_message(mask: np.ndarray) -> SegmentationMask
```

Create a DepthAI message for segmentation mask.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `mask` | `np.ndarray` | Segmentation map array of shape (H, W) where each value represents a segmented object class. Index 255 represents background. | required |

Returns

| Type | Description |
| --- | --- |
| `SegmentationMask` | Segmentation mask message. |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If mask is not a numpy array. If mask is not 2D. If mask is not of type uint8. |
