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 ../../node-hub/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.3.7rc0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

opencv_video_capture-0.3.7rc0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file opencv_video_capture-0.3.7rc0.tar.gz.

File metadata

  • Download URL: opencv_video_capture-0.3.7rc0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.6 Linux/6.5.0-44-generic

File hashes

Hashes for opencv_video_capture-0.3.7rc0.tar.gz
Algorithm Hash digest
SHA256 a71187226b2511b0f5f56c0f4a9475dac66d9c0495f2c4bc63725e416bfbf6eb
MD5 ae1c535318cdaf2fc57415c557b77408
BLAKE2b-256 113366ca1cc26d4f0bca2d5ecd2c025d9769c8cfff02edbde767ccafb806be3a

See more details on using hashes here.

File details

Details for the file opencv_video_capture-0.3.7rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for opencv_video_capture-0.3.7rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c54969bb0fd94c6d5166891730e1362abf652a55c3929ee82517c5bba599a34
MD5 abec7dda223d013a6da25f782309d9db
BLAKE2b-256 008fcfb30d3760bf9b917c356a6ee64d9096b9d799cc9eaf87f7aae84b2617e7

See more details on using hashes here.

Supported by

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