add opencv-plot node for dora dataflows
A display sink that overlays bounding boxes and text on an image input and shows it in an OpenCV window. Based on opencv-plot from dora-hub, brought up to the dora 1.0 node contract and packaged with uv. Python rather than Rust: the opencv Rust crate generates its bindings from the OpenCV headers on the build machine, so it needs libopencv-dev and libclang-dev per machine and per architecture and does not cross-compile. Every dependency here ships prebuilt wheels for linux-x86_64, linux-aarch64 and macos-arm64. Covers every encoding the upstream node did — bgr8, rgb8, jpeg/jpg/jpe/bmp/ webp/png, yuv420 and avif — plus both bbox formats, the text overlay, PLOT_WIDTH/PLOT_HEIGHT and headless operation under CI=true.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
# Node manifest: the typed contract a consumer wires against.
|
||||
#
|
||||
# No source package is shared between node repositories, so this file and its
|
||||
# type URNs are the only contract a consumer has. `dora validate` checks a
|
||||
# dataflow against it without running the node, so CI needs neither OpenCV nor
|
||||
# a display.
|
||||
apiVersion: 1
|
||||
name: opencv-plot
|
||||
namespace: liria
|
||||
description: Overlays bounding boxes, labels, and text on an image input and displays it in an OpenCV window
|
||||
categories: [visualization, debug]
|
||||
keywords: [opencv, plot, bbox, bounding-box, image, visualization, object-detection]
|
||||
|
||||
runtime: python
|
||||
entrypoint: opencv-plot
|
||||
# `dora build --uv` / `dora run --uv` rewrites this to `uv pip install .` and
|
||||
# gives the node its own managed venv under `.dora/python-envs/`, so the
|
||||
# dependencies it sees at runtime are the ones installed here.
|
||||
build: pip install .
|
||||
dora: ">=1.0"
|
||||
|
||||
inputs:
|
||||
image:
|
||||
type: std/core/v1/UInt8
|
||||
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.
|
||||
bbox:
|
||||
required: false
|
||||
description: >-
|
||||
Bounding boxes to overlay: an Arrow struct with fields {bbox, conf,
|
||||
labels} and metadata {format}. Supported formats: xyxy, xywh. Stored and
|
||||
drawn on the next image redraw. Deliberately untyped — senders differ in
|
||||
whether the numeric fields are 32- or 64-bit, and the node casts either.
|
||||
text:
|
||||
type: std/core/v1/String
|
||||
required: false
|
||||
description: >-
|
||||
Text string to overlay at the top-left corner. Stored and drawn on the
|
||||
next image redraw.
|
||||
|
||||
outputs: {}
|
||||
|
||||
env:
|
||||
PLOT_WIDTH:
|
||||
type: int
|
||||
description: Resize the displayed frame to this width (pixels). Defaults to the image input width.
|
||||
PLOT_HEIGHT:
|
||||
type: int
|
||||
description: Resize the displayed frame to this height (pixels). Defaults to the image input height.
|
||||
|
||||
example: |
|
||||
- id: plot
|
||||
git: ssh://git@gitea.liria.cl:5001/liria/dora-plot.git
|
||||
tag: v0.1.0
|
||||
build: pip install .
|
||||
path: opencv-plot
|
||||
inputs:
|
||||
image: camera/image
|
||||
bbox: detector/bbox
|
||||
text: detector/text
|
||||
Reference in New Issue
Block a user