功能:标注二进制图像中已连接的部分。
语法:L = bwlabel(BW,n) [L,num] = bwlabel(BW,n)
其中BW为输入图像;N可取值为4或8表示连接四连通或八连通区域;NUM为找到的连通区域数目;L为输出图像矩阵,其元素值为整数,背景被标记为0,第一个连通区域被标记为1,第二个连通区域被标记为2,依此类推.所以你不明白的1,2,3即为第1,2,3个连通区域的标记
网上给出的解释大部分是不完整的,
官网的解释
L = bwlabel(BW, n) returns a matrix L, of the same size as BW, containing labels for the connected objects in BW. The variable 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 backgro