Friday, 11 July 2014

morphology operations

clear all
close all
a=imread('cell1.bmp'); % reads the image
b=im2bw(a); %convert to binary
b1=bwareaopen(b,550); % remove connected components from a binary image
b2=imfill(b1,'holes'); % fill the region
%dialte
se=strel('disk',3,6); %structuring elt default:4
d1=imdilate(b2,se);
%imerode
se1=strel('disk',11);
d2=imerode(d1,se1);
%contour
p=bwmorph(d1,'remove');
perimeter=sum(sum(p));
figure(1);imshow(a);
figure(2);imshow(b1);
figure(3);imshow(d1);
figure(4);imshow(d2);
figure(5);imshow(p);
fprintf('perimeter of the shape');
disp(perimeter)

No comments:

Post a Comment