# plane_validation

Python API: `depthai_nodes.node.support_plane_calibrator.plane_validation`

The level test shared by the candidate search and plane verification.

## Functions

| Name | Description |
| --- | --- |
| [`gravity_angle_deg`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/support_plane_calibrator/plane_validation.md#plane_validation-Functions-gravity_angle_deg) | Return the angle between a plane normal and the direction opposing gravity. |
| [`is_valid_horizontal_plane`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/support_plane_calibrator/plane_validation.md#plane_validation-Functions-is_valid_horizontal_plane) | Check that a plane is horizontal and lies below the camera (the level test). |
| [`orient_along_gravity`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/support_plane_calibrator/plane_validation.md#plane_validation-Functions-orient_along_gravity) | Return the plane equation with its normal pointing away from `gravity`. |

### function `gravity_angle_deg`

```python
def gravity_angle_deg(plane_eq: np.ndarray, gravity: np.ndarray) -> float
```

Return the angle between a plane normal and the direction opposing gravity.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `plane_eq` | `np.ndarray` | Plane `(a, b, c, d)` with a unit normal `(a, b, c)`. | required |
| `gravity` | `np.ndarray` | Raw accelerometer vector; only its direction is used. | required |

Returns

| Type | Description |
| --- | --- |
| `float` | The angle in degrees, from 0 to 180. |

### function `is_valid_horizontal_plane`

```python
def is_valid_horizontal_plane(
    plane_eq: np.ndarray,
    gravity: np.ndarray,
    config: PlaneCalibrationConfig,
) -> bool
```

Check that a plane is horizontal and lies below the camera (the level test).

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `plane_eq` | `np.ndarray` | Plane `(a, b, c, d)` with a unit normal `(a, b, c)`, oriented with [orient_along_gravity](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/support_plane_calibrator/plane_validation.md#plane_validation-Functions-orient_along_gravity). | required |
| `gravity` | `np.ndarray` | Raw accelerometer vector; only its direction is used. | required |
| `config` | `PlaneCalibrationConfig` | Supplies the largest angle between the normal and the direction opposing gravity, and the camera height range. | required |

Returns

| Type | Description |
| --- | --- |
| `bool` | `True` if the normal is within the angle and the camera height `-d` is not negative and within the configured range. `False` if `gravity` is the zero vector. |

### function `orient_along_gravity`

```python
def orient_along_gravity(plane_eq: np.ndarray, gravity: np.ndarray) -> np.ndarray
```

Return the plane equation with its normal pointing away from `gravity`.

The accelerometer vector points up, so the oriented normal points down, away from a camera above the plane. RANSAC and saved
planes may give either sign; orienting them first makes
[is_valid_horizontal_plane](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/support_plane_calibrator/plane_validation.md#plane_validation-Functions-is_valid_horizontal_plane)
depend only on the plane.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `plane_eq` | `np.ndarray` | Plane `(a, b, c, d)`. | required |
| `gravity` | `np.ndarray` | Raw accelerometer vector. | required |

Returns

| Type | Description |
| --- | --- |
| `np.ndarray` | `plane_eq` if its normal already points away from `gravity`, otherwise the negated equation. |
