refactor: rename the node from opencv-plot to dora-plot

The repository is dora-plot, but the package, the entrypoint, the manifest
name and the window title were all opencv-plot. Consumers wire the node by
`path:`, so the split name was visible in every dataflow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WLVZCFFcCH1EpTXGfS9aD
This commit is contained in:
2026-09-14 16:08:48 -05:00
co-authored by Claude Opus 5
parent d5d3026b92
commit e2debe0581
12 changed files with 57 additions and 57 deletions
+37
View File
@@ -0,0 +1,37 @@
"""Parsing of the `bbox` input: an Arrow struct carrying boxes and labels."""
import numpy as np
from dora_plot.plot import Bboxes
def parse(value, bbox_format: str) -> Bboxes:
"""Read a `bbox` payload. `bbox_format` is the `format` metadata parameter."""
fields = value[0]
corners = _flat(fields, "bbox").reshape(-1, 4)
if bbox_format == "xyxy":
pass
elif bbox_format == "xywh":
# xywh is centre-based: x and y are the box centre, not a corner.
x, y, w, h = corners.T
corners = np.stack([x - w / 2, y - h / 2, x + w / 2, y + h / 2], axis=1)
else:
raise RuntimeError(f"unsupported bbox format: {bbox_format}")
return Bboxes(
corners=corners,
conf=_flat(fields, "conf"),
labels=_flat(fields, "labels", numeric=False),
)
def _flat(fields, name: str, numeric: bool = True) -> np.ndarray:
"""Read a struct field as a flat numpy array.
Senders wrap each field in a single-element list -- that is what
`pa.array([{...}])` produces from numpy arrays -- so unwrap it when present.
"""
column = fields[name]
column = getattr(column, "values", column)
return column.to_numpy(zero_copy_only=False) if not numeric else column.to_numpy()