Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
|
|
6 months ago | |
|---|---|---|
| .. | ||
| opencv_plot | 6 months ago | |
| tests | 10 months ago | |
| README.md | 1 year ago | |
| pyproject.toml | 6 months ago | |
| uv.lock | 10 months ago | |
This node is used to plot a text and a list of bbox on a base image (ideal for object detection).
- id: opencv-plot
build: pip install ../../node-hub/opencv-plot
path: opencv-plot
inputs:
# image: Arrow array of size 1 containing the base image
# bbox: Arrow array of bbox
# text: Arrow array of size 1 containing the text to be plotted
env:
PLOT_WIDTH: 640 # optional, default is image input width
PLOT_HEIGHT: 480 # optional, default is image input height
image: Arrow array containing the base 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))
)
bbox: an arrow array containing the bounding boxes, confidence scores, and class names of the detected objects
bbox: {
"bbox": np.array, # flattened array of bounding boxes
"conf": np.array, # flat array of confidence scores
"labels": np.array, # flat array of class names
}
encoded_bbox = pa.array([bbox], {"format": "xyxy"})
decoded_bbox = {
"bbox": encoded_bbox[0]["bbox"].values.to_numpy().reshape(-1, 4),
"conf": encoded_bbox[0]["conf"].values.to_numpy(),
"labels": encoded_bbox[0]["labels"].values.to_numpy(zero_copy_only=False),
}
text: Arrow array containing the text to be plottedtext: str
encoded_text = pa.array([text])
decoded_text = encoded_text[0].as_py()
Check example at examples/python-dataflow
This project is licensed under Apache-2.0. Check out NOTICE.md for more information.
DORA (Dataflow-Oriented Robotic Architecture) is middleware designed to streamline and simplify the creation of AI-based robotic applications. It offers low latency, composable, and distributed datafl
Rust Python TOML Markdown C other