# box_measurements

Python API: `depthai_nodes.message.box_measurements`

Per-frame box measurement results.

## Classes

| Name | Description |
| --- | --- |
| [`BoxDimensions`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-BoxDimensions) | A box's length, width and height in millimeters. |
| [`BoxMeasurementResult`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-BoxMeasurementResult) | A tracked box's measurement outcome in one processed frame. |
| [`BoxMeasurements`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-BoxMeasurements) | Measurement results of the boxes tracked in one frame. |
| [`MeasurementStatus`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-MeasurementStatus) | Whether a box was measured in a frame. |

### class `BoxDimensions`

```python
class BoxDimensions
```

A box's length, width and height in millimeters.

Raises

| Type | Description |
| --- | --- |
| `TypeError` | If a field is not a real number. |
| `ValueError` | If a field is not finite. |

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `height_mm` | `float` | Height in millimeters. |
| `length_mm` | `float` | Length in millimeters. |
| `width_mm` | `float` | Width in millimeters. |

Properties

| Name | Type | Description |
| --- | --- | --- |
| [`volume_mm3`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-BoxDimensions-volume_mm3) | `float` | The box volume in cubic millimeters. |

#### property `volume_mm3`

```python
volume_mm3: float
```

The box volume in cubic millimeters.

### class `BoxMeasurementResult`

```python
class BoxMeasurementResult
```

A tracked box's measurement outcome in one processed frame.

Raises

| Type | Description |
| --- | --- |
| `TypeError` | If a field has the wrong type. |
| `ValueError` | If `confidence` is not finite, or a measured box has no dimensions. |

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `bounding_box` | `dai.RotatedRect` | Normalized bounding box in the source frame. |
| `confidence` | `float` | Detection confidence. |
| `dimensions` | `BoxDimensions | None` | The box's aggregated dimensions, when it has any. |
| `measurement_status` | `MeasurementStatus` | Outcome of measuring the box in this frame. |
| `track_id` | `int` | Tracker ID of the box. |
| `track_status` | `dai.Tracklet.TrackingStatus` | Tracking status of the box in this frame, `NEW` or `TRACKED`. Lost tracks keep only their last-seen box, so they are not emitted. |

### class `BoxMeasurements`

```python
class BoxMeasurements(Collection)
```

Measurement results of the boxes tracked in one frame.

Args

| Name | Description |
| --- | --- |
| `items` | Measurement results. |

Raises

| Type | Description |
| --- | --- |
| `TypeError` | If `items` is not a list of one type. |

Methods

| Name | Description |
| --- | --- |
| [`getVisualizationMessage`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-BoxMeasurements-getVisualizationMessage) | Outline each box, labelled with its identity and any dimensions. |

#### method `getVisualizationMessage`

```python
def getVisualizationMessage() -> dai.ImgAnnotations
```

Outline each box, labelled with its identity and any dimensions.

Returns

| Type | Description |
| --- | --- |
| `dai.ImgAnnotations` | Annotations with this message's buffer metadata. |

### class `MeasurementStatus`

```python
class MeasurementStatus(str, Enum)
```

Whether a box was measured in a frame.

`INELIGIBLE` boxes could not be measured, for example because no support plane is set or the box touches the frame border.
`FAILED` boxes were eligible but their geometry could not be measured. `MEASURED` boxes produced a sample and have dimensions.

Attributes

| Name | Type | Description |
| --- | --- | --- |
| `FAILED` | `str` |  |
| `INELIGIBLE` | `str` |  |
| `MEASURED` | `str` |  |

## Functions

| Name | Description |
| --- | --- |
| [`annotation_text`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Functions-annotation_text) | Return the annotation text of a measured box. |

### function `annotation_text`

```python
def annotation_text(box: BoxMeasurementResult) -> str
```

Return the annotation text of a measured box.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `box` | `BoxMeasurementResult` | Measurement result to describe. | required |

Returns

| Type | Description |
| --- | --- |
| `str` | Track ID and confidence, followed by the dimensions in centimeters and the volume in cubic centimeters when the box has dimensions. |
