Skip to content

Connected Components

The Connected Components command scans the binary mask produced by Threshold and assigns a unique integer label to each connected group of foreground pixels. Each labelled region is one candidate object.

Each isolated group of touching foreground pixels becomes its own labelled region

Internally this runs as a two-pass union-find labeling: a first pass walks the image assigning provisional labels and recording which labels turn out to be the same object (because two differently-labelled regions touch), and a second pass resolves every provisional label to its final one.

Connected Components is a required intermediate step between Threshold and Extract ROIs. It separates the monolithic foreground mask into individually labelled regions that can be further split by Watershed or immediately passed to Extract ROIs.

ParameterDescription
Min size (px²)Objects with a pixel area below this threshold are discarded immediately after labelling, before any downstream step sees them. Useful for suppressing noise and speckle artifacts. Default 0 disables the filter

Setting Min size to a small positive value (e.g. 5–20 px²) is a lightweight alternative to running a Morphological Transform opening step just to remove speckle, and avoids inflating the object count seen by Extract ROIs.

Threshold → Connected Components → [optional Watershed] → Extract ROIs

Two-pass connected-component labelling with an equivalence table (union-find) is one of the oldest algorithms in image analysis, going back to Azriel Rosenfeld and John Pfaltz, “Sequential Operations in Digital Picture Processing,” Journal of the ACM, vol. 13, no. 4, pp. 471-494, 1966.