build with uv, and preview locally instead of a second dataflow
validate / validate (push) Successful in 59m16s

The build command was `pip install .`, which is what upstream and the dora docs
use because `--uv` rewrites it. Spelling it `uv pip install .` means the
dataflow never installs through pip at all, whether or not `--uv` was passed.
The cost is that the node then needs a virtualenv to install into, so it must
be run with `--uv`; the README says so.

The second dataflow is gone. It existed to wire this node into dora-image-view
just to see the frames, which pulled another repository over the network and
needed a tag there. PREVIEW=true now opens a local window of the frames as they
are published, so checking a camera, an encoding or a flip needs this
repository alone. It shows the frame after the flip and the resize, so what is
on screen is what is sent, and it never opens under CI, where there is no
display.

That a source node can display its own output overlaps with what a viewer node
does. The overlap is the point: the alternative was a second repository in the
loop before you can tell whether a camera works.
This commit is contained in:
2026-09-15 06:09:12 -03:00
parent 3c0e0f327d
commit dc3960809a
6 changed files with 87 additions and 50 deletions
+36
View File
@@ -0,0 +1,36 @@
"""An optional local preview window.
A source node showing its own frames overlaps with what a viewer node does, and
that is the point: it means checking that a camera works needs this repository
only, not a second node wired into a dataflow. It is off unless asked for, and
never opens under CI.
"""
import cv2
import numpy as np
WINDOW = "dora-webcam"
def show(frame: np.ndarray) -> bool:
"""Display one frame and report whether the viewer asked to quit.
Parameters
----------
frame : np.ndarray
The captured BGR frame, before encoding, which is what a person wants
to look at.
Returns
-------
bool
True when `q` was pressed, which stops the node.
"""
cv2.imshow(WINDOW, frame)
return cv2.waitKey(1) & 0xFF == ord("q")
def close() -> None:
"""Tear the window down, if one was ever opened."""
cv2.destroyAllWindows()