Get a linear index list of all the pixels in each region. The function returns a cell array with an element for each region it finds in the label matrix.
Examine one of the pixel index lists returned. For example, look at the second cell in the returned cell array. It contains the linear indices for all the pixels in the region labeled "2". The upper left corner of the region is pixel BW(2,5), which is the 34th pixel in linear indexing.
pixelIndexList — Linear indices of pixels in regions 1-by-n cell array
Linear indices of pixels in regions, returned as a 1-by-n cell array. Each
element of the output, pixelIndexList{n}, is a vector
that contains all the linear indices in L where
L is equal to n.
Extended Capabilities
C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™.