www.gusucode.com > images 案例代码 matlab源码程序 > images/PerformMorphologicalOperationsOnBinaryImageExample.m

    %% Perform Morphological Operations on Binary Image
% 
%%
% Read binary image and display it.

% Copyright 2015 The MathWorks, Inc.

BW = imread('circles.png');
imshow(BW);
%%
% Remove interior pixels to leave an outline of the shapes.
BW2 = bwmorph(BW,'remove');
figure
imshow(BW2)
%%
% Get the image skeleton.
BW3 = bwmorph(BW,'skel',Inf);
figure
imshow(BW3)