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.10rc0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

opencv_video_capture-0.3.10rc0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for opencv_video_capture-0.3.10rc0.tar.gz
Algorithm Hash digest
SHA256 b6dfe5a1eae26148b8ad6d35c80108b7026160182536961105a99707b1f5278e
MD5 7900d473e2dbc9aa6d8250cdfedb2cc4
BLAKE2b-256 5dd0eb23d86029f950619680afa44c6aa9ec578fcd898d99cf0c4b45b13c25fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opencv_video_capture-0.3.10rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 353a02eb63331e6df501a3d50c4462dfb45e107a9fbad0bed893b9aa5a8f2f11
MD5 d3f9a9ff35748967e3d11b46e45deabf
BLAKE2b-256 5e60a283d521de7c719ab707e0f2121eab91ac8ccf3c8852f84f0c0b59e330c3

See more details on using hashes here.

Supported by

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