Saturday, June 2, 2012

Dilation and Erosion Matlab code


Dilation and Erosion Matlab code


AimTo perform dilation & erosion of an image

Equipments:

Operating System: -     Windows XP
Software: -                   Matlab 7.5, Image Processing Toolbox.


Program:

close all;
clear all;
clc;
f=imread('cameraman.tif');
level=graythresh(f);
f1=im2bw(f,level);
s=[0 1 0; 1 1 1 ; 0 1 0];
f2=imdilate(f1,s);
subplot(1,3,1);imshow(f);title('original image');
subplot(1,3,2);imshow(f1);title('binary image');
subplot(1,3,3);imshow(f2);title('dilated image');


Results:

Dilation

































Erosion




No comments:

Post a Comment