# message

Python API: `depthai_nodes.message`

Native parser messages and custom messages for DepthAI v3.

Parser creators return native DepthAI messages. The package requires DepthAI 3.12.0. Use
[depthai_nodes.message.creators](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/creators.md)
to construct messages from arrays and
[depthai_nodes.message.utils](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/utils.md)
for copying and detection geometry.

Table of Contents

Contents

 * [Native parser
   messages](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message.md#message-Native-parser-messages)
 * [Custom
   messages](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message.md#message-Custom-messages)
   * [Support
   plane](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message.md#message-Custom-messages-Support-plane)
    * [Box
      measurement](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message.md#message-Custom-messages-Box-measurement)
    * [MeasureAnything
      measurement](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message.md#message-Custom-messages-MeasureAnything-measurement)

## Native parser messages

The creator functions document the required shapes, coordinate conventions, and value ranges for each payload:

 * `dai.ImgDetections` contains detections, including optional keypoints and instance masks; `dai.SpatialImgDetections` adds
   spatial coordinates.
 * `dai.SegmentationMask` contains a segmentation mask.
 * `dai.beta.Classifications` contains class names and scores, including sequence classification results.
 * `dai.beta.Clusters` and `dai.beta.Cluster` represent grouped 2D points.
 * `dai.beta.Keypoints` contains keypoints and optional skeleton edges.
 * `dai.beta.Lines` and `dai.beta.Line` represent line detections.
 * `dai.beta.Map2D` stores a numeric map, such as a depth estimate.
 * `dai.beta.Predictions` and `dai.beta.Prediction` store regression results.
 * `dai.TrackedFeatures` represents feature points and matches.
 * `dai.ImgFrame` and `dai.NNData` carry images and embedding tensors.

## Custom messages

[AxialDepthFrameResult](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/axial_depth.md#axial_depth-Classes-AxialDepthFrameResult)
associates native target-axial depth with correction provenance inside one Python runtime, including standalone OAK-4 apps.

[Collection](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/collection.md#collection-Classes-Collection)
stores items of one runtime type. Add items with `append()` or `extend()`. The first item establishes the accepted type; an
initially empty collection infers its type when populated. Assigning `items` validates the replacement list, but directly mutating
the returned list bypasses that validation. `copy()` copies each item through `copy_message` and preserves the message timestamps
and sequence number.

[GatheredData](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/gathered_data.md#gathered_data-Classes-GatheredData)
extends
[Collection](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/collection.md#collection-Classes-Collection)
with a reference message. Assigning `reference_data` copies its timestamps and sequence number to the message.
[depthai_nodes.node.GatherData](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/gather_data.md#gather_data-Classes-GatherData)
produces these messages by matching messages around a reference timestamp.

[SnapData](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/snap_data.md#snap_data-Classes-SnapData)
stores a snap name, a `dai.FileGroup` containing the image and associated files, optional tags, and string metadata. Pass these
messages to
[depthai_nodes.node.SnapsUploader](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/snaps_uploader.md#snaps_uploader-Classes-SnapsUploader)
to upload them through the Hub Events API.

> **Example**
> Group detections with the frame they refer to:

```text
import depthai as dai
from depthai_nodes.message import GatheredData

frame = dai.ImgFrame()
detections = dai.ImgDetections()
batch = GatheredData(reference_data=frame, items=[detections])
assert batch.reference_data is frame
```

> **Note**
> Creator functions populate payloads. Callers that emit messages from a pipeline must also set the appropriate timestamps, sequence number, and image transformation. Native message copies may share pixel storage; see [depthai_nodes.message.utils.copy_message](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/utils.md#utils-Functions-copy_message) before modifying copied buffers.

### Support plane

[SupportPlane](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlane)
is the support plane equation `normal · point + offset_mm = 0` in millimeters, normalized on construction. `toJson()`,
`fromJson()`, `toJsonFile()`, and `fromJsonFile()` save and load exactly its `normal` and `offset_mm`.

[depthai_nodes.node.SupportPlaneCalibrator](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/support_plane_calibrator/support_plane_calibrator.md#support_plane_calibrator-Classes-SupportPlaneCalibrator)
exchanges these messages:

 * [SupportPlaneCalibrationControl](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane_calibration.md#support_plane_calibration-Classes-SupportPlaneCalibrationControl)
   starts, stops, or resets calibration, or asks for a plane verification of a given support plane.
 * [SupportPlaneCalibrationResult](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane_calibration.md#support_plane_calibration-Classes-SupportPlaneCalibrationResult)
   ends a calibration attempt with a
   [CalibrationOutcome](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane_calibration.md#support_plane_calibration-Classes-CalibrationOutcome)
   and, only when it succeeded, its support plane candidates.
 * [SupportPlaneCandidate](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlaneCandidate)
   holds a `plane` with its `inlier_count` and `inlier_ratio`.
 * [SupportPlaneVerificationResult](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane_calibration.md#support_plane_calibration-Classes-SupportPlaneVerificationResult)
   reports the result of a plane verification: the plane's angle to gravity, its on-plane ratio, the share of the checked point
   cloud's sampled points that lie on the plane (`None` when not measured), and whether it was accepted: level, below the camera,
   and with enough of the point cloud on it. The on-plane ratio is not a candidate's inlier ratio.

[depthai_nodes.node.AutoSupportPlane](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/node/support_plane_calibrator/auto_support_plane.md#auto_support_plane-Classes-AutoSupportPlane)
sends an
[AutoSupportPlaneResult](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/auto_support_plane_result.md#auto_support_plane_result-Classes-AutoSupportPlaneResult)
for each finished cycle: `passed` tells whether it found or confirmed a support plane, and `plane` is the support plane in use, or
`None` when there is none. It is a Python `Buffer` subclass, so it travels between host nodes only; over XLink or a
`RemoteConnection` it arrives as a bare `Buffer`.

The fields of these messages are read-only.
[SupportPlane](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlane)
and
[SupportPlaneCandidate](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlaneCandidate)
are frozen dataclasses that take keyword arguments and raise `TypeError` for a wrong type or `ValueError` for an invalid value.

### Box measurement

[BoxDetections](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_detections.md#box_detections-Classes-BoxDetections)
is a
[Collection](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/collection.md#collection-Classes-Collection)
of
[BoxDetection](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_detections.md#box_detections-Classes-BoxDetection)
items, one box detection per tracked box: its track ID, normalized bounding box, confidence, and tracking status. A shared `uint8`
segmentation mask covers the whole frame; a pixel holds the index of the item it belongs to, and 255 marks background. `getMask()`
returns one item's boolean mask.

[BoxMeasurements](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-BoxMeasurements)
is a
[Collection](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/collection.md#collection-Classes-Collection)
of
[BoxMeasurementResult](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-BoxMeasurementResult)
items. Each result repeats the box detection fields and adds a
[MeasurementStatus](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-MeasurementStatus)
and, when the box has any, its
[BoxDimensions](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-BoxDimensions):
length, width, and height in millimeters. A measured result always has dimensions. Both messages draw labelled box outlines
through `getVisualizationMessage()`.
[BoxDetection](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_detections.md#box_detections-Classes-BoxDetection),
[BoxMeasurementResult](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-BoxMeasurementResult),
and
[BoxDimensions](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md#box_measurements-Classes-BoxDimensions)
are frozen dataclasses that take keyword arguments and raise the same errors as the support plane value types.

Boxes are measured against a support plane; see "Support plane" above.

### MeasureAnything measurement

`MeasureAnythingDetectorConfig` holds the existing
[SupportPlane](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md#support_plane-Classes-SupportPlane)
value for runtime updates through the detector's `inputConfig`. An initial support plane can be passed to `build`. Without one,
scene groups are consumed without processing or output until a config supplies the plane. One queued update is applied before each
scene, when available. Its state persists and its plane snapshot travels through measurement. Camera intrinsics, distortion,
poses, and the reference-frame label come from native image and point-cloud transformation metadata.

`MeasureAnythingDetections` holds a tuple of eligible `MeasureAnythingDetection` objects. Each retains a read-only float32
`xyz_mm` array in source-point order. `candidate_id` is a zero-based proposal index local to the frame. `decisions` preserves all
proposal eligibility decisions without retaining the source cloud. Decision and source-timing records are internal output details
rather than public constructors. `MeasureAnythingMeasurements` holds one `MeasureAnythingMeasurement` per detected object. Its
`MeasureAnythingMeasurement.Status` distinguishes no fit, a footprint with unknown height, and a measured cuboid.
`MeasureAnythingCuboid` carries the base center, length axis, length, width, and optional height. These messages preserve the
frame's upward plane, complete algorithm ID, all available source timing, and `MeasureAnythingDetections.Outcome`. The same
outcome enum is available through `MeasureAnythingMeasurements.Outcome`. Successful empty frames and failed frames are distinct.

MeasureAnything messages retain nested Python values on one host. They have no XLink or RemoteConnection serialization.

## Child Pages

 * [creators](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/creators.md)
 * [utils](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/utils.md)
 * [auto_support_plane_result](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/auto_support_plane_result.md)
 * [axial_depth](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/axial_depth.md)
 * [box_detections](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_detections.md)
 * [box_measurements](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/box_measurements.md)
 * [collection](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/collection.md)
 * [gathered_data](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/gathered_data.md)
 * [measure_anything](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/measure_anything.md)
 * [snap_data](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/snap_data.md)
 * [support_plane](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane.md)
 * [support_plane_calibration](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/message/support_plane_calibration.md)
