-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add additional image encoding (#661)
Enable the use of `jpeg` encoding to send camera data as jpeg as it is more efficient when using remote connections. I also provided a notebook example to run the camera example within a jupyter notebook for fast protoyping.
- Loading branch information
Showing
4 changed files
with
102 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
nodes: | ||
- id: camera | ||
build: pip install ../../node-hub/opencv-video-capture | ||
path: opencv-video-capture | ||
inputs: | ||
tick: dora/timer/millis/20 | ||
outputs: | ||
- image | ||
env: | ||
CAPTURE_PATH: 0 | ||
IMAGE_WIDTH: 640 | ||
IMAGE_HEIGHT: 480 | ||
ENCODING: "jpeg" | ||
|
||
- id: plot | ||
path: dynamic | ||
inputs: | ||
image: | ||
source: camera/image | ||
queue_size: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from dora import Node\n", | ||
"import IPython.display\n", | ||
"from IPython.display import clear_output" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\n", | ||
"node = Node(\"plot\")\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\n", | ||
"for event in node:\n", | ||
" if event[\"type\"] != \"INPUT\":\n", | ||
" continue\n", | ||
" data = event[\"value\"].to_numpy()\n", | ||
" IPython.display.display(IPython.display.Image(data=data))\n", | ||
" clear_output(wait=True)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "base", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"name": "python", | ||
"version": "3.10.13" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters