Nodes/ComfyUI-ArchiGraph/Draw Contours 🐦
ComfyUI Node

Draw Contours 🐦

Overlay your detected outlines on the original

By vincentfsΒ·Created 2 years agoΒ·Updated 9 months agoΒ· 3
Draw Contours 🐦
  • nparrays
  • contours
  • dst
β—„colorGREENβ–Ί
β—„thickness2β–Ί
β—„hideBackgroundfalseβ–Ί

Find Contours gives you a list of point vectors and a hierarchy of how they nest. Neither of those is something you look at and go "oh, nice." This node is the other half of that story - it takes the contours object straight from Find Contours and paints them back onto an image, so you can actually see what the detector decided was a shape.

The inputs

  • nparrays: the image to draw on. The tooltip says it should be a color image; if you feed grayscale or single-channel, it converts internally.
  • contours: a CV_CONTOURS object - the exact output of this pack's Find Contours node. The two are made for each other; there's no parsing or reshaping needed, which is the point of having a custom type.
  • color: WHITE / BLACK / RED / GREEN / BLUE, default GREEN (the classic "this is what was detected" look).
  • thickness (default 2): line width; -1 fills the contour instead of outlining it.
  • hideBackground (default false): set true and everything outside the contours is blacked out, leaving just the outlines floating on black. Perfect for isolating "the shapes" as a standalone artifact - feed that to a ControlNet and you've got a shape map.

One behavior worth noting from the node's own description: it always draws all contours in the list. There's no "only draw the 5 biggest" filter here - if you want selective drawing, filter the contours before you reach this node (or use the stats/area filtering from Connected Components With Stats to decide which contours matter).

The workflow

Image β†’ To Nparray β†’ threshold/Canny β†’ Find Contours β†’ Draw Contours β†’ To Image β†’ preview or save. It's the visible output of a contour-detection chain, and with hideBackground on it doubles as a shape-map generator.

The constraint

Like Find Contours, this node is single-batch only - feed it a batch and it raises a ValueError. One image at a time, no exceptions.

Install

ComfyUI Manager β†’ search ComfyUI-ArchiGraph, or:

cd ComfyUI/custom_nodes
git clone https://github.com/vincentfs/ComfyUI-ArchiGraph

Restart and run the pack's install script once. OpenCV is the only real dependency; no models.

Gotchas

  • The contours port expects the pack's own CV_CONTOURS type. Contours from some other pack's OpenCV node may or may not slot in depending on how they store points - the intended pairing is Find Contours β†’ Draw Contours.
  • Thickness -1 fills the contour. Handy for turning outlines into solid regions, but it hides the shape's actual edges.
  • hideBackground draws on black, so the output is no longer "the original image with outlines" - it's outlines only. That's a feature, just know it's doing that.

A companion node, not a standalone hero - but without it, Find Contours is half a feature. Wire them together and the detection becomes legible.

CategoryπŸ¦β€πŸ”₯ ArchiGraph/πŸ“€ OpenCV

Inputs (5)

NameTypeDefaultDescription
nparraysNPARRAYInput image to draw contours on. Should be color image.
contoursCV_CONTOURSContours to draw. Use FindContours node to get contours.
colorCOMBOGREENcolor for contour.
thicknessINT2-1–20Thickness of the contour lines. -1 means filled.
hideBackgroundBOOLEANfalseIf true, the background will be blacked out, only contours are shown.

Outputs (1)

NameTypeDescription
dstNPARRAYβ€”