Detection2DArray
The detections of one frame; header is the image's header.
Preview
The figure robot_msgs.viz.plot(example) draws for the example below.

Fields
| Name | Type | Default |
|---|---|---|
header | Header | Header() |
detections | tuple[Detection2D, ...] | () |
Example
One instance from the package's own test catalog; the output is its real repr().
Detection2DArray(header=Header(stamp=1761600000.25, frame_id='camera_color_optical_frame'), detections=(Detection2D(header=Header(stamp=1761600000.25, frame_id='camera_color_optical_frame'), results=(ObjectHypothesisWithPose(hypothesis=ObjectHypothesis(class_id='bottle', score=0.91), pose=Pose(position=Point(x=0.4, y=-0.1, z=0.25), orientation=Quaternion(x=-0.10566871683993562, y=0.6991667342497077, z=0.10566871683993563, w=0.6991667342497078))),), bbox=BoundingBox2D(center=Pose2D(x=60.0, y=120.0, theta=0.0), size_x=100.0, size_y=200.0), id='7'), Detection2D(header=Header(stamp=1761600000.25, frame_id='camera_color_optical_frame'), results=(ObjectHypothesisWithPose(hypothesis=ObjectHypothesis(class_id='bottle', score=0.91), pose=Pose(position=Point(x=0.4, y=-0.1, z=0.25), orientation=Quaternion(x=-0.10566871683993562, y=0.6991667342497077, z=0.10566871683993563, w=0.6991667342497078))),), bbox=BoundingBox2D(center=Pose2D(x=60.0, y=120.0, theta=0.0), size_x=100.0, size_y=200.0), id='8')))to_dict() as JSON
{
"_type": "vision/Detection2DArray",
"header": {
"_type": "std/Header",
"stamp": 1761600000.25,
"frame_id": "camera_color_optical_frame",
"meta": {}
},
"detections": [
{
"_type": "vision/Detection2D",
"header": {
"_type": "std/Header",
"stamp": 1761600000.25,
"frame_id": "camera_color_optical_frame",
"meta": {}
},
"results": [
{
"_type": "vision/ObjectHypothesisWithPose",
"hypothesis": {
"_type": "vision/ObjectHypothesis",
"class_id": "bottle",
"score": 0.91
},
"pose": {
"_type": "geometry/Pose",
"position": {
"_type": "geometry/Point",
"x": 0.4,
"y": -0.1,
"z": 0.25
},
"orientation": {
"_type": "geometry/Quaternion",
"x": -0.10566871683993562,
"y": 0.6991667342497077,
"z": 0.10566871683993563,
"w": 0.6991667342497078
}
},
"covariance": null
}
],
"bbox": {
"_type": "vision/BoundingBox2D",
"center": {
"_type": "geometry/Pose2D",
"x": 60.0,
"y": 120.0,
"theta": 0.0
},
"size_x": 100.0,
"size_y": 200.0
},
"id": "7"
},
{
"_type": "vision/Detection2D",
"header": {
"_type": "std/Header",
"stamp": 1761600000.25,
"frame_id": "camera_color_optical_frame",
"meta": {}
},
"results": [
{
"_type": "vision/ObjectHypothesisWithPose",
"hypothesis": {
"_type": "vision/ObjectHypothesis",
"class_id": "bottle",
"score": 0.91
},
"pose": {
"_type": "geometry/Pose",
"position": {
"_type": "geometry/Point",
"x": 0.4,
"y": -0.1,
"z": 0.25
},
"orientation": {
"_type": "geometry/Quaternion",
"x": -0.10566871683993562,
"y": 0.6991667342497077,
"z": 0.10566871683993563,
"w": 0.6991667342497078
}
},
"covariance": null
}
],
"bbox": {
"_type": "vision/BoundingBox2D",
"center": {
"_type": "geometry/Pose2D",
"x": 60.0,
"y": 120.0,
"theta": 0.0
},
"size_x": 100.0,
"size_y": 200.0
},
"id": "8"
}
]
}Long arrays are cut after 16 values and say so with “…”.
Functions
Constructors
Classmethods and staticmethods: ways to build one.
Methods
Return new values; messages are never mutated.
as_arrays() -> dict[str, Array]The batch view: boxes_xyxy (N, 4), scores (N,), class_ids (N,) strings.
filtered(
min_score: float | None = None,
class_ids: Iterable[str] | None = None,
) -> Detection2DArrayDetections whose best score is at least min_score and whose class is in class_ids.
nms(iou_threshold: float) -> Detection2DArrayNon-maximum suppression, class-agnostic: highest scores win, overlaps above
to_dict
from Msgto_dict() -> dict[str, Any]JSON-safe dict with a "_type" key; arrays keep their dtype and shape.
Operators
Python operators and protocols the type supports.