summaryrefslogtreecommitdiff
path: root/3176/CH9/EX9.4/Ex9_4.sce
blob: 5863bddcbd7181047c5cf14e2d0dae75cf944651 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//Ex9_4
//Use of opening and closing for Morphological Filtering
// Version : Scilab 5.4.1
// Operating System : Window-xp, Window-7
//Toolbox: Image Processing Design 8.3.1-1
//Toolbox: SIVP 0.5.3.1-2
//Reference book name : Digital Image Processing
//book author: Rafael C. Gonzalez and Richard E. Woods

clc;
close;
clear;
xdel(winsid())//to close all currently open figure(s).

Color=imread("Ex9_4.png");
Image=imresize(rgb2gray(Color),2,'bicubic');
Image=im2bw(Image,0.75);
[nr nc]=size(Image);
figure,ShowImage(Image,'Gray Image');
title('Noisy Image','color','blue','fontsize',4);

Mask=CreateStructureElement('square',3);  // Create Structuring Element
Image_Eroide=ErodeImage(Image,Mask);  // Erosion Operation
figure,ShowImage(Image_Eroide,'Eriode Image');
title('Eriode Image with 3*3 Square Mask','color','blue','fontsize',4);

Image_Open=OpenImage(Image,Mask);   // Opening Operation
figure,ShowImage(Image_Open,'Open Image');
title('Opening Image with 3*3 Square Mask','color','blue','fontsize',4);

Image_Dilate=DilateImage(Image_Open,Mask);  // Dilusion of Open Image
figure,ShowImage(Image_Dilate,'Dilate Image');
title('Dilate Image with 3*3 Square Mask','color','blue','fontsize',4);

Image_Close=CloseImage(Image_Dilate,Mask);   // Opening Operation
figure,ShowImage(Image_Close,'Closing Image');
title('Closing Image with 3*3 Square Mask','color','blue','fontsize',4);