Captures frames from a V4L2 camera and publishes them as std/media/v1/Image: an Arrow struct of width, height, encoding and data, so a receiver needs nothing from the message metadata. For a compressed encoding the recorded dimensions are the image's, not the length of the payload. Based on opencv-video-capture from dora-hub, with three changes. The output is the typed image struct rather than a flat UInt8 buffer plus metadata. Camera selection by id reads /dev/v4l/by-id/ only; the upstream macOS system_profiler and Windows PowerShell enumeration is not carried. CAPTURE_FRAMES bounds a run so a test ends on its own, in place of upstream's ten-second CI cutoff -- a timeout would have made the CI step exit non-zero. CI=true keeps a failed capture from raising, publishing a labelled black frame instead, which is what lets dataflow.yml run on a machine with no camera. Two dataflows, run one at a time, as dora has no cross-dataflow wiring: dataflow.yml is the camera alone and the CI gate; dataflow_view.yml wires it into dora-image-view and is not run by CI, since it fetches that node over the network and needs a tag to exist there.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
[project]
|
||||
name = "dora-webcam"
|
||||
version = "0.1.0"
|
||||
description = "Dora node that captures frames from a webcam and publishes them as std/media/v1/Image"
|
||||
readme = "README.md"
|
||||
license = { text = "MIT" }
|
||||
requires-python = ">=3.11"
|
||||
|
||||
# Every dependency ships prebuilt wheels for linux-x86_64, linux-aarch64 and
|
||||
# macos-arm64, so the node installs with no system packages and no compiler.
|
||||
dependencies = [
|
||||
"dora-rs >= 1.0.1",
|
||||
"numpy >= 2.0",
|
||||
"opencv-python >= 4.9",
|
||||
"pyarrow >= 17.0",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
dora-webcam = "dora_webcam.main:main"
|
||||
|
||||
[dependency-groups]
|
||||
dev = ["pymarkdownlnt >= 0.9.30", "pytest >= 8.1", "ruff >= 0.9"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["dora_webcam"]
|
||||
|
||||
[tool.ruff.lint]
|
||||
extend-select = ["D", "I", "N", "RET", "UP"]
|
||||
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
convention = "numpy"
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
# Test names are the documentation here; a docstring would only repeat them.
|
||||
"tests/*" = ["D1"]
|
||||
|
||||
[tool.pymarkdown]
|
||||
# The prose here wraps near ruff's 88; 100 leaves room for a long link or table
|
||||
# row without inviting unwrapped paragraphs.
|
||||
plugins.md013.line_length = 100
|
||||
Reference in New Issue
Block a user