help bwlabel,第一行如示:BWLABEL Label connected components in 2-D binary image.
这就是说bwlabel是用来标记二维的二值图像中的connected components的,简言之,就是黑背景下面有多少白的块(连通组件?真别扭),反正就是从黑背景甄别白块块的。就这么理解吧。
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.
就是说bwlabel能从一个读入二值图像后产生的BW数组(也可能自己创建,只要符合元素是0或者1就行)中,区别出其中的1有多少块(注:在BW数组中,0代表黑背景