KJNodes/maskinggenerated

Bbox Visualize(BboxVisualize)

This node supports two common bounding box coordinate formats: `xywh` (top-left coordinates and width-height) and `xyxy` (top-left and bottom-right coordinates)

Bbox Visualize

images
bboxes
images
line_width
1
bbox_format
xywh
KJNodes

The Bbox Visualize node supports two common bounding box coordinate formats: xywh (top-left coordinates and width/height) and xyxy (top-left and bottom-right coordinates).

The Bbox Visualize node is a tool for visualizing bounding boxes on images. Its core function is to receive an image and corresponding bounding box data, then draw these boxes onto the image, providing an intuitive display of object detection or region segmentation results.

Node Functionality

This node supports two common bounding box coordinate formats: xywh (top-left coordinates and width/height) and xyxy (top-left and bottom-right coordinates). Internally, it transposes the dimensions of the input image tensor, then draws rectangular boxes on the image using preset red lines based on the specified format and line width, ultimately outputting a new image with the visualized boxes.

Node Parameter Description - Bbox Visualize

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
imagesIMAGEYes--The image on which to draw the bounding boxes.
bboxesBBOXYes--The bounding box data corresponding to the image. Each box should be a sequence containing four numerical values.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
bbox_formatCOMBOYesxywh"xywh", "xyxy"Specifies the bounding box format: xywh (top-left x, y, width, height) or xyxy (top-left x, y and bottom-right x, y coordinates).
line_widthINTYes11 - 10 (step: 1)Sets the line width for drawing the bounding boxes. The range is 1 to 10, with a step size of 1.

Output

Parameter NameData TypeDescription
imagesIMAGEOutputs the visualized image with the bounding boxes drawn on it.

Usage Scenarios

This node is very useful in object detection workflows. For example, after running an object detection model, you can connect the model's raw bounding box output (BBOX) and the original image (IMAGE) to this node to quickly generate a preview image with detection results, making it convenient for users to verify the model's accuracy.

Notes

Please note that the input bboxes parameter must be a sequence containing four numerical values (such as a list or array), and each value should be an integer or convertible to an integer. If the format is incorrect or the values are invalid, the node may skip processing that particular box.

The Bbox Visualize node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…