www.gusucode.com > images 案例代码 matlab源码程序 > images/PerformErosionUsingA2by2NeighborhoodExample.m
%% Perform Erosion Using a 2-by-2 Neighborhood % %% % Create the LUT. % Copyright 2015 The MathWorks, Inc. lutfun = @(x)(sum(x(:))==4); lut = makelut(lutfun,2); %% % Read image into the workspace and then apply the LUT to the image. An % output pixel is |on| only if all four of the input pixel's neighborhood % pixels are |on| . BW1 = imread('text.png'); BW2 = applylut(BW1,lut); %% % Show the original image and the eroded image. figure, imshow(BW1); figure, imshow(BW2);