# support_plane

Python API: `depthai_nodes.message.support_plane`

Portable support plane geometry, independent of running pipeline nodes.

## Classes

| Name | Description |
| --- | --- |
| [`SupportPlane`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlane) | The normalized plane equation `normal · point + offset_mm = 0`. |
| [`SupportPlaneCandidate`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlaneCandidate) | A support plane found by calibration, with how much of the scene supports it. |

### class `SupportPlane`

```python
class SupportPlane
```

The normalized plane equation `normal · point + offset_mm = 0`.

Coordinates are in millimeters. Construction scales the normal to unit length and the offset with it, so equations that differ
only by a positive factor give equal planes.

Calibration emits planes whose normal points along gravity, away from the camera, so `offset_mm` is at most zero.
[depthai_nodes.node.BoxDimensioner](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/box_dimensioner/box_dimensioner.md#box_dimensioner-Classes-BoxDimensioner)
and plane verification accept either sign.

Raises

| Type | Description |
| --- | --- |
| `TypeError` | If `normal` is not a list or tuple, or a component is not a real number. |
| `ValueError` | If `normal` does not have three components, is zero, or a value is not finite. |

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `normal` | `tuple[float, float, float]` | Unit normal `(x, y, z)`. |
| `offset_mm` | `float` | Offset in millimeters. |

Methods

| Name | Description |
| --- | --- |
| [`fromJson`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlane-fromJson) | Create a plane from a dictionary written by `toJson`. |
| [`fromJsonFile`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlane-fromJsonFile) | Read a plane from a JSON file written by `toJsonFile`. |
| [`toJson`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlane-toJson) | Return the normalized geometry as a JSON-compatible dictionary. |
| [`toJsonFile`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlane-toJsonFile) | Write the plane as JSON to a file. |

#### class method `fromJson`

```python
def fromJson(data: dict[str, Any]) -> SupportPlane
```

Create a plane from a dictionary written by `toJson`.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `data` | `dict[str, Any]` | Dictionary with exactly `normal` and `offset_mm`. | required |

Returns

| Type | Description |
| --- | --- |
| `SupportPlane` | The normalized support plane. |

Raises

| Type | Description |
| --- | --- |
| `TypeError` | If `data` is not a dictionary or holds non-numeric geometry. |
| `ValueError` | If the keys differ from `normal` and `offset_mm`, or the geometry is invalid. |

#### class method `fromJsonFile`

```python
def fromJsonFile(path: str | Path) -> SupportPlane
```

Read a plane from a JSON file written by `toJsonFile`.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `path` | `str | Path` | Source file path. | required |

Returns

| Type | Description |
| --- | --- |
| `SupportPlane` | The normalized support plane. |

Raises

| Type | Description |
| --- | --- |
| `OSError` | If the file cannot be read. |
| `json.JSONDecodeError` | If the file is not valid JSON. |
| `TypeError` | If the JSON has the wrong types. |
| `ValueError` | If the JSON has the wrong keys or invalid geometry. |

#### method `toJson`

```python
def toJson() -> dict[str, Any]
```

Return the normalized geometry as a JSON-compatible dictionary.

Returns

| Type | Description |
| --- | --- |
| `dict[str, Any]` | A dictionary with exactly `normal` (a list) and `offset_mm`. |

#### method `toJsonFile`

```python
def toJsonFile(path: str | Path)
```

Write the plane as JSON to a file.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `path` | `str | Path` | Destination file path. | required |

Raises

| Type | Description |
| --- | --- |
| `OSError` | If the file cannot be written. |

### class `SupportPlaneCandidate`

```python
class SupportPlaneCandidate
```

A support plane found by calibration, with how much of the scene supports it.

Raises

| Type | Description |
| --- | --- |
| `TypeError` | If a field has the wrong type. |
| `ValueError` | If a field is out of range or not finite. |

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `inlier_count` | `int` | Points of the calibration cloud on the plane, at least 1. |
| `inlier_ratio` | `float` | Share of the calibration cloud on the plane, in (0, 1]; at least the config's `min_inlier_ratio`. Not the on-plane ratio of a plane verification. |
| `plane` | `SupportPlane` | The support plane. |
