Draw Contours π¦
Overlay your detected outlines on the original
- nparrays
- contours
- dst
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: aCV_CONTOURSobject - 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
contoursport expects the pack's ownCV_CONTOURStype. 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.
hideBackgrounddraws 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.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| nparrays | NPARRAY | Input image to draw contours on. Should be color image. | |
| contours | CV_CONTOURS | Contours to draw. Use FindContours node to get contours. | |
| color | COMBO | GREEN | color for contour. |
| thickness | INT | 2-1β20 | Thickness of the contour lines. -1 means filled. |
| hideBackground | BOOLEAN | false | If true, the background will be blacked out, only contours are shown. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| dst | NPARRAY | β |