% 2. Compute the distance transform of thecomplement of the binary
% image.
%
% D = bwdist(~bw);
% figure,imshow(D,[],'InitialMagnification','fit')
% title('Distance transform of ~bw')
2. 计算上述二值图像的补的距离变换
% 3. Complement the distance transform, andforce pixels that don't
% belong to the objects to be at -Inf.
%
% D = -D;
% D(~bw) = -Inf;
3. 计算距离变换的补, 并令不属于两个对象的像素为负无穷.
% 4. Compute the watershed transform, anddisplay the resulting label
% matrix as an RGB image.
%
% L = watershed(D);
% rgb = label2rgb(L,'jet',[.5 .5 .5]);
% figure,imshow(rgb,'InitialMagnification','fit')
% title('Watershed transform of D')
4. <