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

    %% Erode an Image Using imerode
% This example shows how to erode a binary image using the |imerode|
% function.
%%
% Read a binary image into the workspace.
BW1 = imread('circbw.tif');
%%
% Create a structuring element. The following code creates a diagonal
% structuring element object. 
SE = strel('arbitrary',eye(5))
%%
% Erode the image using the |imerode| function, passing the input image and
% the structuring element as arguments. Display the original image and the
% eroded image. Notice the diagonal streaks on the right side of the
% output image. These are due to the shape of the structuring element.
BW2 = imerode(BW1,SE);
imshow(BW1)
figure, imshow(BW2)