M-File Help: ilabel View code for ilabel

ilabel

Label an image

L = ilabel(im) is a label image that indicates connected components within the image im (HxW). Each pixel in L (HxW) is an integer label that indicates which connected region the corresponding pixel in im belongs to. Region labels are in the range 1 to M.

[L,m] = ilabel(im) as above but returns the value of the maximum label value.

[L,m,parents] = ilabel(im) as above but also returns region hierarchy information. The value of parents(I) is the label of the parent, or enclosing, region of region I. A value of 0 indicates that the region has no single enclosing region, for a binary image this means the region touches the edge of the image, for a multilevel image it means that the region touches more than one other region.

[L,maxlabel,parents,class] = ilabel(im) as above but also returns the class of pixels within each region. The value of class(I) is the value of the pixels that comprise region I.

[L,maxlabel,parents,class,edge] = ilabel(im) as above but also returns the edge-touch status of each region. If edge(I) is 1 then region I touches edge of the image, otherwise it does not.

Notes

See also

iblobs, imoments


 

© 1990-2012 Peter Corke.