bwlabel函数可以用于对二值图像进行标注,是个很有用的函数,真希望VC也有这些函数。 Label connected components in a binary image SyntaxL = bwlabel(BW,n) [L,num] = bwlabel(BW,n) DescriptionL = bwlabel(BW,n) returns a matrix L, of the same size as BW, containing labels for the connected objects 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.