Tuesday, August 25, 2009

BWLABEL in Matlab

BWLABEL Label connected components in 2-D binary image. L = BWLABEL(BW,N) returns a matrix L, of the same size as BW, containing labels for the connected components in BW. N can have a value of either 4 or 8, where 4 specifies 4-connected objects and 8 specifies 8-connected objects; if the argument is omitted, it defaults to 8. The elements of L are integer values greater than or equal to 0.  The pixels labeled 0 are the background.  The pixels labeled 1 make up one object, the pixels labeled 2 make up a second object, and so on. [L,NUM] = BWLABEL(BW,N) returns in NUM the number of connected objects found in BW. Note: Comparing BWLABEL and BWLABELN
    BWLABEL supports 2-D inputs only, whereas BWLABELN support any
    input dimension.  In some cases you might prefer to use BWLABELN even
    for 2-D problems because it can be faster.  If you have a 2-D input
    whose objects are relatively "thick" in the vertical direction,
    BWLABEL will probably be faster; otherwise BWLABELN will probably be
    Class Support
    BW can be logical or numeric, and it must be real, 2-D, and
    nonsparse.  L is double.
BW = logical();
L = bwlabel(BW,4);
[r,c] = find(L == 2); 
See also bwareaopen, bweuler, bwlabeln, bwselect, label2rgb.

Reference page in Help browser
doc bwlabel

No comments:

Post a Comment