use std/media/v1/Image for image and depth

Both inputs now declare dora's Arrow struct {width, height, encoding, data}
rather than a flat buffer plus loose metadata. The payload describes itself, so
nothing about its shape has to be agreed out of band, and the frame travels as
one Arrow value instead of a buffer whose meaning lives in a sidecar dict.

Depth uses the same type. dora's registry has no depth type, and a depth map is
an image whose pixels are distances -- the reading ROS takes as well -- so it
arrives with a single-channel encoding: 32FC1/float32 or 16UC1/mono16/uint16.
`units` stays in message metadata because the struct has no field for it.

decode.IMAGE_TYPE is the single definition of the struct; the example source
and the tests build payloads from it rather than respelling the schema.

The older shapes are still decoded -- a flat UInt8 buffer with
width/height/encoding for image, a flat Float32 buffer with shape/units for
depth -- so a producer's payload can move before its manifest does. That is
only half a migration path: type compatibility is directional, so a producer
still declaring std/core/v1/UInt8 fails validate against an
std/media/v1/Image input regardless of what it sends, and has to update its
manifest too.

Verified: 41 tests, validate clean with 4 contracts injected, the dataflow runs
to a clean exit, and a composite rendered through the struct path is identical
to the one rendered before the migration.
This commit is contained in:
2026-09-15 05:27:40 -03:00
parent a6fa3ce32b
commit 8a7bda5867
8 changed files with 153 additions and 53 deletions
+15 -10
View File
@@ -21,13 +21,14 @@ dora: ">=1.0"
inputs:
image:
type: std/core/v1/UInt8
type: std/media/v1/Image
required: false
description: >-
Base image to draw on: a flat UInt8 buffer described by the metadata
{width, height, encoding}. Supported encodings: bgr8, rgb8,
jpeg/jpg/jpe/bmp/webp/png (encoded bytes), yuv420, avif. Receiving this
input triggers a redraw and display.
Base image to draw on: an Arrow struct {width, height, encoding, data}.
Supported encodings: bgr8, rgb8, jpeg/jpg/jpe/bmp/webp/png (encoded
bytes), yuv420, avif. Receiving this input triggers a redraw and display.
A flat UInt8 buffer described by {width, height, encoding} metadata is
still decoded, for producers that have not moved to the struct.
bbox:
required: false
description: >-
@@ -53,13 +54,17 @@ inputs:
this input -- they are picked up from there, which is what covers a
camera that published its intrinsics before this node started.
depth:
type: std/core/v1/Float32
type: std/media/v1/Image
required: false
description: >-
Depth map as a flat Float32 buffer, described by the metadata
{shape: [height, width], units}. Millimetres unless `units` says `m`;
0 and non-finite values are missing depth and draw black. Colour-mapped
into its own panel, which receiving this input redraws.
Depth map as an Arrow struct {width, height, encoding, data}, one channel
per pixel. Supported encodings: 32FC1/float32 and 16UC1/mono16/uint16 --
dora has no depth type, and a depth map is an image whose pixels are
distances, which is how ROS spells it too. Millimetres unless the `units`
metadata says `m`; 0 and non-finite values are missing depth and draw
black. Colour-mapped into its own panel, which receiving this input
redraws. A flat Float32 buffer with {shape, units} metadata is still
decoded, for producers that have not moved to the struct.
outputs: {}