Lab 9
Lab 9
(Dilation)
clc;
clear all;
close all;
img=imread('blobs.png');
se=transpose([1 1 1 1 1 1 1]);
img1=imdilate(img,se);
subplot(1,2,1),imshow(img),title('original image');
subplot(1,2,2),imshow(img1),title('Dilated image');
(Erode)
img=imread('blobs.png');
se=transpose([1 1 1 1 1 1 1]);
img1=imerode(img,se);
subplot(1,2,1),imshow(img),title('original
image');subplot(1,2,2),imshow(img1),title('Erode
image')
a=imread('blobs.png');
w1=strel('square',5);
w2=strel('square',7);
b=imerode(a,w1);
c=imerode(a,w2);
subplot(2,2,1); imshow(a);
title('Original Image');
subplot(2,2,2); imshow(b);
title('Erode image with 5*5');
subplot(2,2,3); imshow(c);
title('Erode image with 7*7');
(Closing at 10):
img=imread('circles.png');
w1=strel('disk',10);
img1=imclose(img,w1);
subplot(2,2,1),imshow(img),title('original image');
subplot(2,2,2),imshow(img1),title('close image'):
(Closing at 5):
img=imread('snowflakes.png');
w1=strel('disk',5);
img1=imclose(img,w1);
subplot(1,2,1),imshow(img),title('original image');
subplot(1,2,2),imshow(img1),title('open image');
For blobs;
In open at 5
img=imread('blobs.png');
w1=strel('disk',5);
img1=imopen(img,w1);
subplot(2,1,1),imshow(img),title('original image');
subplot(2,1,2),imshow(img1),title('close image');
In Open at 3:
img=imread('blobs.png');
w1=strel('disk',3);
img1=imopen(img,w1);
subplot(2,1,1),imshow(img),title('original image');
subplot(2,1,2),imshow(img1),title('open image');
Size if structuring elements:
(Closing at 10):
(Closing at 5):
For blobs:
In open at 5
In Open at 3: