KJNodes/InstanceDiffusiongenerated

DrawInstanceDiffusionTracking

This node takes an image batch and tracking data of type TRACKING as input.

Draw Instance Diffusion Tracking

image
tracking
image
box_line_width
2
draw_text
font
COMBO
font_size
20
KJNodes

The DrawInstanceDiffusionTracking node receives an image batch and tracking data of type TRACKING as input.

The DrawInstanceDiffusionTracking node is used to visualize instance segmentation and tracking results on images. Its core function is to read tracking data generated by the CreateInstanceDiffusionTracking node and draw this data (such as object bounding boxes and category labels) onto the corresponding images, thereby generating visualized images with annotation information.

Node Function

This node receives an image batch and tracking data of type TRACKING as input. Internally, it uses Matplotlib's rainbow color map to assign colors to different tracking categories and utilizes the drawing capabilities of the PIL library to overlay the detected object bounding boxes and optional category text for each image frame onto the original images. Users can customize the drawing style, such as box line width, font, and text display.

Node Parameter Description - DrawInstanceDiffusionTracking

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
imageIMAGEYes--Input image batch on which to draw the tracking data.
trackingTRACKINGYes--tracking (input parameter): Tracking data from the CreateInstanceDiffusionTracking node, containing category and bounding box information.
fontCOMBOYes--Font name to use for drawing text. Select from the available fonts.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
box_line_widthINTYes21 - 10 (step: 1)box_line_width (input parameter): Sets the line width for drawing bounding boxes. The value range is 1 to 10.
draw_textBOOLEANYesTrue-draw_text (input parameter): A boolean switch that controls whether to draw category label text next to the bounding boxes.
font_sizeINTYes20-font_size (input parameter): Sets the font size for drawing text.

Output

Parameter NameData TypeDescription
imageIMAGEimage (output parameter): Outputs the visualized image with drawn tracking boxes and labels.

Usage Scenarios

This node is very useful in workflows for video analysis or sequential image processing. For example, after processing all frames of a video and obtaining object tracking data, you can use this node to draw the tracking boxes and ID information frame by frame back onto the original video images, thereby generating a visualized video with tracking trajectories. This facilitates intuitive inspection of the accuracy and stability of the tracking algorithm.

Notes

Please note that the input tracking data must come from the CreateInstanceDiffusionTracking node, and its structure must strictly correspond temporally with the input image batch. If the frame index in the tracking data exceeds the range of the image batch, the corresponding drawing operation will be skipped.

The DrawInstanceDiffusionTracking node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…