Functions > Image Processing > Feature Extraction > Connected Component Labeling
Connected Component Labeling
concomp(M, con, fg)—Performs connected component labeling of pixels with grayscale value fg in matrix M.
Connected component labeling is an operation on a binary image, where an image pixel grayscale value is treated as foreground and the remaining pixel values are treated as background. You specify one of two possible pixel connection methods using the con argument.
The function returns a matrix which contains the connected component labels as unique integers.
M is the image matrix.
con is the connectivity type: 4 or 8.
fg is the target foreground intensity value.
Two pixels are connected if they have the same value, and connectivity can be classified as 4 (only horizontal or vertical neighbors) or 8 (horizontal, vertical and diagonal neighbors). Connected components are a useful way to automate image feature recognition, bonding like areas and holes in the image.
The algorithm finds the 4- or 8-connected components of the foreground pixels and assigns each component a unique integer label, starting with 1, in the output matrix. Background pixels are assigned label 0.
Was this helpful?