OpenCV connectedComponentsWithStatsWithAlgorithm_1
The kitchen-sink blob node, duplicated (connectedComponentsWithStatsWithAlgorithm_1)
- image
- labels
- stats
- centroids
- int
- nparray_1
- nparray_2
- nparray_3
connectedComponentsWithStatsWithAlgorithm_1 is the duplicate of connectedComponentsWithStatsWithAlgorithm_0 - same cv2.connectedComponentsWithStatsWithAlgorithm call, same four outputs, identical code. The pack's generator emits a node per overload in OpenCV's type stubs, this function declared two signatures, and both shipped. Use the _0 node; this one is the numbering system being thorough.
The short version
The fullest connected-components node in the pack: label blobs, get stats, pick the algorithm.
- image (NPARRAY) - 8-bit single-channel binary mask. Convert via
Image2Nparray+cvtColor(code=6, BGR2GRAY) or get theCV_8UC1assertion. - connectivity (INT) -
4or8. Use8. - ltype (INT) -
4(CV_32S) or2(CV_16U). Use4. - ccltype (INT) -
0CCL_DEFAULT,1CCL_WU,2CCL_GRANA,3CCL_BOLELLI,4CCL_SAUF,5CCL_BBDT,6CCL_SPAGHETTI. Start at0. - labels / stats / centroids (NPARRAY, optional) - out-parameters; skip them.
- Outputs:
int(component count),nparray_1(labels),nparray_2(stats - left/top/width/height/area per blob),nparray_3(centroids).
Classic use: mask cleanup - count objects and filter speckles by area from the stats rows.
Install
Same as the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
or ComfyUI Manager → "opencv-comfyui". Needs opencv-python-contrib. Watch the pack-wide guidedFilter OpenCV conflict and Image2Nparray's batch-size-1 limit. And that's genuinely it - every sentence on this page applies to the _0 node too, so if you came here wondering whether _1 does something extra, it doesn't.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | NPARRAY | — | |
| connectivity | INT | — | |
| ltype | INT | — | |
| ccltype | INT | — | |
| labelsopt | NPARRAY | — | |
| statsopt | NPARRAY | — | |
| centroidsopt | NPARRAY | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| int | INT | — |
| nparray_1 | NPARRAY | — |
| nparray_2 | NPARRAY | — |
| nparray_3 | NPARRAY | — |