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.
CV Draw Segments
- source
- segments
- labels
- image
- count
◄thickness2►
◄color(0, 255, 0)►
◄line_stylesolid►
Categoryimage/CV/points
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| source | COMFY_MATCHTYPE_V3 | Image 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. | |
| segments | NPARRAY | Nx1x4 or Nx4 endpoint quadruples (x1, y1, x2, y2); cv2_HoughLinesP plugs in directly. | |
| thickness | INT | 21–64 | Line thickness in pixels. |
| color | STRING | (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. |
| labelsopt | NPARRAY | (N,) integer labels: one color per cluster. | |
| line_styleopt | COMBO | solid | Stroke 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)
| Name | Type | Description |
|---|---|---|
| image | COMFY_MATCHTYPE_V3 | Same format as the image input. |
| count | INT | How many segments were drawn - branch on it with if/else for the nothing-found case. |