Nodes/comfyui_cv/CV Draw Segments
ComfyUI Node

CV Draw Segments

Debug helper: draws line segments given as endpoint quadruples (x1, y1, x2, y2) - exactly what cv2_HoughLinesP outputs (Nx1x4). Connect labels to color segments by cluster, matching 'CV Draw Points'. Two segment sets on the SAME image should differ in line STYLE as well as color - a dashed set over a solid one reads for every viewer, a green set over a red one does not. None/empty segments pass the image through unchanged (HoughLinesP returns None when nothing is found) and count=0.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Draw Segments
  • source
  • segments
  • labels
  • image
  • count
thickness2
color(0, 255, 0)
line_stylesolid
Categoryimage/CV/points

Inputs (6)

NameTypeDefaultDescription
sourceCOMFY_MATCHTYPE_V3Image or mask to draw on (a copy is made). Accepts a ComfyUI IMAGE/MASK directly (frame 0 of a batch) or an NPARRAY. Arithmetic ops (add, multiply, etc.) process the full IMAGE batch when both inputs have the same batch size.
segmentsNPARRAYNx1x4 or Nx4 endpoint quadruples (x1, y1, x2, y2); cv2_HoughLinesP plugs in directly.
thicknessINT21–64Line thickness in pixels.
colorSTRING(0, 255, 0)Color as a single value (broadcast to all channels) or BGR tuple, e.g. '255' or '(0, 255, 0)'. Shorter tuples are zero-padded; longer tuples are truncated. Ignored when labels are connected.
labelsoptNPARRAY(N,) integer labels: one color per cluster.
line_styleoptCOMBOsolidStroke pattern. Colour alone cannot separate two overlaid line sets for a colour-blind viewer or in greyscale - give the second set a different style and the picture reads without the palette. 'solid' is cv2's own line.

Outputs (2)

NameTypeDescription
imageCOMFY_MATCHTYPE_V3Same format as the image input.
countINTHow many segments were drawn - branch on it with if/else for the nothing-found case.