draw_bbox draws bounding boxes onto CUDA NV12 video frames using metadata attached to each frame.
- Reads a CUDA
av::VideoFramefromsrc. - Copies the frame into a new CUDA output frame.
- Parses bbox metadata from
metadata_key. - Draws one or more boxes onto the copied frame.
- Forwards the annotated frame to
dst.
draw_bbox accepts two metadata shapes:
- single-box metadata such as
viewport_bboxorbbox_norm - YOLO-style metadata with:
coord_spacemodel_widthmodel_heightdetections
Each YOLO detection may include:
clslabelconfxyxymodel_index
When YOLO runs on a padded model canvas, detections are still emitted in model-space coordinates.
Use the optional model_content_* parameters to map detections from the active image region inside that canvas back onto the full output frame:
model_content_widthmodel_content_heightmodel_content_offset_xmodel_content_offset_y
Example:
- source frame
1920x1080 - YOLO input canvas
960x960 - active image area
960x540 - centered vertical padding
y=210
Then set:
model_content_width: 960model_content_height: 540model_content_offset_x: 0model_content_offset_y: 210
-
srcInput video edge. -
dstOutput video edge.
-
metadata_keyMetadata key to read bounding boxes from. Default:reframer_bbox. -
bbox_thicknessOutline thickness in pixels. Default:2. -
min_confMinimum confidence for YOLO detections. Default:0.0. -
allowed_classesOptional array of class IDs to draw. -
allowed_labelsOptional array of labels to draw. -
model_colorsOptional object mapping YOLOmodel_indexvalues to named colors. Supported values:red,green,light_blue. Detections from models without an override keep the default draw color. -
model_content_widthWidth of the real image area inside the model canvas. Default: disabled. -
model_content_heightHeight of the real image area inside the model canvas. Default: disabled. -
model_content_offset_xLeft offset of the real image area inside the model canvas. Default:0. -
model_content_offset_yTop offset of the real image area inside the model canvas. Default:0. -
width -
height -
pixel_format -
real_pixel_formatOutput-format hints used by the node graph. -
debug_log_every_nLogging interval. Default:0.
node.add {
"type": "draw_bbox",
"src": "v_1080p_with_md",
"dst": "v_annotated_cuda",
"metadata_key": "yolo_detections_v1",
"allowed_labels": ["ball", "foot", "player"],
"model_colors": { "0": "red", "1": "green", "2": "light_blue" },
"model_content_width": 960,
"model_content_height": 540,
"model_content_offset_x": 0,
"model_content_offset_y": 210,
"width": 1920,
"height": 1080,
"pixel_format": "cuda",
"real_pixel_format": "nv12"
}