Code covered by the BSD License  

Highlights from
Erosion

image thumbnail

Erosion

by

 

For the Erosion and dilation

erosion.m
clc;
clear all;
a=imread('erosion_in.png');
b=im2bw(a);

s=[1 1;1 1];
[row column cc]= size(a);

for i=1 : row-1
    for j= 1 : column-1
        new= [b(i,j)*s(1,1)
             b(i,j+1)*s(1,2);
             b(i+1,j)*s(2,1)
             b(i+1,j+1)*s(2,2)];
        new_im(i,j)=min(min(new));
        new_im_d(i,j)=max(max(new));
        
    end
end
    
subplot(2,2,1);imshow(new_im);
subplot(2,2,2);imshow(new_im_d);
% subplot(2,2,3);imshow(new_im);

Contact us