Skip to main content

Dora Node for capturing video with OpenCV

Project description

Dora Node for capturing video with OpenCV

This node is used to capture video from a camera using OpenCV.

YAML

- id: opencv-video-capture
  build: pip install ../../opencv-video-capture
  path: opencv-video-capture
  inputs:
    tick: dora/timer/millis/16 # try to capture at 60fps
  outputs:
    - image: # the captured image

  env:
    PATH: 0 # optional, default is 0

    IMAGE_WIDTH: 640 # optional, default is video capture width
    IMAGE_HEIGHT: 480 # optional, default is video capture height

Inputs

  • tick: empty Arrow array to trigger the capture

Outputs

  • image: an arrow array containing the captured image
## Image data
image_data: UInt8Array # Example: pa.array(img.ravel())
metadata = {
  "width": 640,
  "height": 480,
  "encoding": str, # bgr8, rgb8
}

## Example
node.send_output(
  image_data, {"width": 640, "height": 480, "encoding": "bgr8"}
  )

## Decoding
storage = event["value"]

metadata = event["metadata"]
encoding = metadata["encoding"]
width = metadata["width"]
height = metadata["height"]

if encoding == "bgr8":
    channels = 3
    storage_type = np.uint8

frame = (
    storage.to_numpy()
    .astype(storage_type)
    .reshape((height, width, channels))
)

Examples

Check example at examples/python-dataflow

License

This project is licensed under Apache-2.0. Check out NOTICE.md for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opencv_video_capture-0.4.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opencv_video_capture-0.4.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file opencv_video_capture-0.4.0.tar.gz.

File metadata

  • Download URL: opencv_video_capture-0.4.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for opencv_video_capture-0.4.0.tar.gz
Algorithm Hash digest
SHA256 cf628dc97a4ccf11b7630760d6367a3c91b920718cf8bee059b0f7682f327083
MD5 011da4814e64501b6e115e69c683eab6
BLAKE2b-256 fd91f4ddf53285c33de01bec5266a19fd8d46866008df4a9176609988bf65498

See more details on using hashes here.

File details

Details for the file opencv_video_capture-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: opencv_video_capture-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for opencv_video_capture-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cb909f2672b8a30584c3c15380a4ae5002fe7e3dd67be1ee86774e814087535
MD5 dd0f867f6f82dc456cbd7f1c747a85dd
BLAKE2b-256 09465b8616e9955d6e9431532469c9f6c203b22e9de6ab467f862ab7ed83c7ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page