ComfyUI Node
CV Find Contours
Extracts contours from a binary image (cv2.findContours) - feed it edges (cv2.Canny) or a threshold/mask image. Color input is converted to grayscale; any non-zero pixel counts as foreground. Contours come out sorted by area, largest first, with specks below min_area dropped. Zero contours is a valid result (count = 0), not an error.
CV Find Contours
- image
- contours
- count
◄modeRETR_EXTERNAL►
◄methodCHAIN_APPROX_SIMPLE►
◄min_area0►
Categoryimage/CV/contours
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | NPARRAY,IMAGE,MASK | Binary image (edges or MASK); non-zero = foreground. 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. | |
| mode | COMBO | RETR_EXTERNAL | RETR_EXTERNAL: only outermost contours (usual choice). RETR_LIST: all, ungrouped; uses the TRUCO parallel engine (OpenCV 4.14+). |
| method | COMBO | CHAIN_APPROX_SIMPLE | CHAIN_APPROX_SIMPLE compresses straight segments to their endpoints; CHAIN_APPROX_NONE keeps every boundary pixel. |
| min_area | FLOAT | 00–1000000000 | Drop contours whose area (px²) is below this - filters noise specks. 0 keeps everything. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| contours | CV_CONTOURS | — |
| count | INT | — |