connectedComponents
computes the connected components
(i.e. areas of contiguous non-zero pixels) of a binary image.
connectedComponents(image, connectivity = 8, return_table = TRUE)
image | An an 8-bit (8U) single-channel |
---|---|
connectivity | The connetivity neighborhood to decide whether 2 pixels are contiguous. This parameter can take two values:
|
return_table | A logical indicating whether a dataframe of the x-y coordinates of the connected components should be returned (default: TRUE). |
A list with 2 (or 3) items:
n: the number of connected components in the image.
labels: a 16-bit (16U) single-channel image in which each pixel of each connected component is represented by the identity number of the component, and the background pixels by zero.
table (if `return_table = TRUE`): a dataframe with 3 columns representing the identity of the connected components (id), and the x-y coordinates of the pixels they are composed of.
Simon Garnier, garnier@njit.edu
# TODO