bwlabel
bwlabel是用来标记二维的二值图像中的连通组的,简言之,就是黑背景下面有多少白的块,也就是从黑背景甄别白块块的。
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 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.
[gpuarrayL, num] = bwlabel(gpuarrayBW, n) performs the labeling operation on a GPU. The input image and output image are gpuArrays. n can be a numeric array or a gpuArray.
在BW数组中,0代表黑背景,1代表白