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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file opencv_video_capture-0.3.7rc2.tar.gz
.
File metadata
- Download URL: opencv_video_capture-0.3.7rc2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e88a3501e7bd10be91f8c5536229f90adad96a311c4e391447201b7c51d4042 |
|
MD5 | cea6abe4d8eb85aab7c8fe5aa8fca4b6 |
|
BLAKE2b-256 | d15c74a02dabfcbb2924f0a6e93f076a8128f41a1cf9c02694cd8f9efccc7402 |
File details
Details for the file opencv_video_capture-0.3.7rc2-py3-none-any.whl
.
File metadata
- Download URL: opencv_video_capture-0.3.7rc2-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f27ce0b348fa636760f282968b4f4fe4e7a20c9b8e9ec4d2c81ecc41ead9e163 |
|
MD5 | 18149109650298e98d8c0bb29c646984 |
|
BLAKE2b-256 | 353041405b448ec04d801bae292a443ea444ded58c5e883ac17a09c534398588 |