Webcam Plot
This example will launch a webcam plot stream.
-
Make sure to have a webcam and cv2 install via:
pip install numpy opencv-python pyarrow
-
Download two pre-implemented operators from our repository in a new folder
webcam_project
wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.6/examples/python-operator-dataflow/webcam.py
wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.6/examples/python-operator-dataflow/plot.py
wget https://raw.githubusercontent.com/dora-rs/dora/v0.3.6/examples/python-operator-dataflow/utils.py -
Create a new
dataflow.yml
file or replace the existing file with the following nodes:nodes:
- id: webcam
operator:
python: webcam.py
inputs:
tick: dora/timer/millis/100
outputs:
- image
- id: plot
operator:
python: plot.py
inputs:
image: webcam/imageIn this example, the webcam takes a tick input of frequency of 100 millis. It outputs the webcam image and dora forward it to a plot operator.
-
Start attached to the dataflow as follows:
dora start dataflow.yml --attach --hot-reload --name webcam
--attach
: enables you to wait for the dataflow to finish before returning.--hot-reload
: enables you to modify Python Operator while the dataflow is running.--name
: enables you to name a dataflow that might be simpler to use than the UUID.
-
You should see a small webcam window open up!
- To stop your dataflow, you can use ctrl+c