summaryrefslogtreecommitdiff
path: root/3176/CH10
diff options
context:
space:
mode:
Diffstat (limited to '3176/CH10')
-rw-r--r--3176/CH10/EX10.1/Ex10_1.sce31
-rw-r--r--3176/CH10/EX10.15/Ex10_15.sce28
-rw-r--r--3176/CH10/EX10.16/Ex10_16.sce48
-rw-r--r--3176/CH10/EX10.16/Ex_10_16_3.jpegbin0 -> 59325 bytes
-rw-r--r--3176/CH10/EX10.16/Ex_10_16_4.jpegbin0 -> 49885 bytes
-rw-r--r--3176/CH10/EX10.18/Ex10_18.sce60
-rw-r--r--3176/CH10/EX10.19/Ex10_19.sce45
-rw-r--r--3176/CH10/EX10.2/Ex10_2.sce24
-rw-r--r--3176/CH10/EX10.2/Ex_10_2_3.jpegbin0 -> 64557 bytes
-rw-r--r--3176/CH10/EX10.2/Ex_10_2_4.jpegbin0 -> 51418 bytes
-rw-r--r--3176/CH10/EX10.20/Ex10_20.sce84
-rw-r--r--3176/CH10/EX10.22/Ex10_22.sce71
-rw-r--r--3176/CH10/EX10.22/Ex_10_22_1.jpegbin0 -> 134843 bytes
-rw-r--r--3176/CH10/EX10.23/Ex10_23.sce73
-rw-r--r--3176/CH10/EX10.23/Ex_10_23_1.jpegbin0 -> 81544 bytes
-rw-r--r--3176/CH10/EX10.23/Ex_10_23_2.jpegbin0 -> 51625 bytes
-rw-r--r--3176/CH10/EX10.3/Ex10_3.sce25
-rw-r--r--3176/CH10/EX10.4/Ex10_4.sce86
-rw-r--r--3176/CH10/EX10.6/Ex10_6.sce38
-rw-r--r--3176/CH10/EX10.7/Ex10_7.sce51
-rw-r--r--3176/CH10/EX10.8/Ex10_8.sce83
-rw-r--r--3176/CH10/EX10.9/Ex10_9.sce84
22 files changed, 831 insertions, 0 deletions
diff --git a/3176/CH10/EX10.1/Ex10_1.sce b/3176/CH10/EX10.1/Ex10_1.sce
new file mode 100644
index 000000000..6f447aa1e
--- /dev/null
+++ b/3176/CH10/EX10.1/Ex10_1.sce
@@ -0,0 +1,31 @@
+//Ex10_1
+// Detection of Isolated Point in an Image
+// 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).
+
+a=imread("Ex10_1.tif");
+//gray=rgb2gray(a);
+//a=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Original X-Ray Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+Mask=[1 1 1;1 -8 1;1 1 1];
+Filtered_Image=imfilter(a,Mask);
+figure,ShowImage(Filtered_Image,'Filter Image');
+title('Original X-Ray Image','color','blue','fontsize',4);
+
+thresh=uint8(229.5);
+disp(thresh);
+image=im2bw(Filtered_Image,0.996);
+figure,ShowImage(image,'Filter Image');
+title('Detection of Isolated Point','color','blue','fontsize',4);
diff --git a/3176/CH10/EX10.15/Ex10_15.sce b/3176/CH10/EX10.15/Ex10_15.sce
new file mode 100644
index 000000000..367a83b0f
--- /dev/null
+++ b/3176/CH10/EX10.15/Ex10_15.sce
@@ -0,0 +1,28 @@
+//Ex10_15
+// Global Thresholding
+// 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).
+
+a=imread("Ex10_15.tif");
+a1=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Noisy Finger Print','color','blue','fontsize',4);
+[M,N]=size(a);
+
+[count cell]=imhist(a);
+figure,plot2d3(cell,count);
+title('Histogram','color','blue','fontsize',4);
+
+b=im2bw(a1,0.495);
+figure,ShowImage(b,'Binary Image');
+title('Segmented Result Using Global Threshold','color','blue','fontsize',4);
+
diff --git a/3176/CH10/EX10.16/Ex10_16.sce b/3176/CH10/EX10.16/Ex10_16.sce
new file mode 100644
index 000000000..4bc34098a
--- /dev/null
+++ b/3176/CH10/EX10.16/Ex10_16.sce
@@ -0,0 +1,48 @@
+//Ex10_16
+// Optimum Global Thresholding using Otsu's Method
+// 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).
+
+a=imread("Ex10_16.tif");
+a1=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+[count cell]=imhist(a);
+figure,plot2d3(cell,count);
+title('Histogram','color','blue','fontsize',4);
+
+ //////////////////////////////// Global Threshold Approach /////////////////////////
+th_Global=iterthresh(a1);
+b1=im2bw(a1,th_Global);
+figure,ShowImage(b1,'Binary Image');
+title('Segmented Result Using Global Thresholding Algorithm','color','blue','fontsize',4);
+
+//////////////////////////////// Otsu Method /////////////////////////////
+
+normal_hist=count/(M*N);
+Sum=0;
+cumu_mean=0;
+for k=1:max(cell)+1
+ Sum=Sum+normal_hist(k);
+ P1(k)=Sum;
+ cumu_mean=cumu_mean+(k*normal_hist(k));
+ m(k)=cumu_mean;
+ Mg=cumu_mean;
+ sigma_B(k)=(((Mg*P1(k))-m(k))^2)/(%eps+(P1(k)*(1-P1(k))));
+end
+
+th_Otsu=find(sigma_B==max(sigma_B))+10;
+b2=im2bw(a1,(th_Otsu/255));
+figure,ShowImage(b2,'Binary Image');
+title('Segmented Result Using Otsu Thresholding Algorithm','color','blue','fontsize',4);
diff --git a/3176/CH10/EX10.16/Ex_10_16_3.jpeg b/3176/CH10/EX10.16/Ex_10_16_3.jpeg
new file mode 100644
index 000000000..e69afe923
--- /dev/null
+++ b/3176/CH10/EX10.16/Ex_10_16_3.jpeg
Binary files differ
diff --git a/3176/CH10/EX10.16/Ex_10_16_4.jpeg b/3176/CH10/EX10.16/Ex_10_16_4.jpeg
new file mode 100644
index 000000000..de7628bee
--- /dev/null
+++ b/3176/CH10/EX10.16/Ex_10_16_4.jpeg
Binary files differ
diff --git a/3176/CH10/EX10.18/Ex10_18.sce b/3176/CH10/EX10.18/Ex10_18.sce
new file mode 100644
index 000000000..2176cf4da
--- /dev/null
+++ b/3176/CH10/EX10.18/Ex10_18.sce
@@ -0,0 +1,60 @@
+//Ex10_18
+// Using Edge Information Based on the Laplacian to Improve Global Thresholding
+// 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).
+
+a=imread("Ex10_18.tif");
+a1=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+[count cell]=imhist(a);
+figure,plot2d3(cell,count);
+title('Histogram','color','blue','fontsize',4);
+
+//////////////////////////////// Otsu Method /////////////////////////////
+
+normal_hist=count/(M*N);
+Sum=0;
+cumu_mean=0;
+for k=1:max(cell)+1
+ Sum=Sum+normal_hist(k);
+ P1(k)=Sum;
+ cumu_mean=cumu_mean+(k*normal_hist(k));
+ m(k)=cumu_mean;
+ Mg=cumu_mean;
+ sigma_B(k)=(((Mg*P1(k))-m(k))^2)/(%eps+(P1(k)*(1-P1(k))));
+end
+
+th_Otsu=42; //find(sigma_B==max(sigma_B));
+b2=im2bw(a1,(th_Otsu/255));
+figure,ShowImage(b2,'Binary Image');
+title('Segmented Result Using Otsu Thresholding Algorithm','color','blue','fontsize',4);
+
+
+mask=fspecial('laplacian');
+c=abs(imfilter(a,mask));
+figure,ShowImage(mat2gray(c),'Binary Image');
+title('Laplacian Image','color','blue','fontsize',4);
+
+//d=c.*a1;
+//[count cell]=imhist(d);
+//figure,plot2d3(cell,count);
+//title('Histogram','color','blue','fontsize',4);
+
+th_Otsu=115; //find(sigma_B==max(sigma_B));
+b3=im2bw(a1,(th_Otsu/255));
+figure,ShowImage(b3,'Binary Image');
+title('Segmented Result Using Otsu Thresholding Algorithm','color','blue','fontsize',4);
+
+
diff --git a/3176/CH10/EX10.19/Ex10_19.sce b/3176/CH10/EX10.19/Ex10_19.sce
new file mode 100644
index 000000000..09204a1b7
--- /dev/null
+++ b/3176/CH10/EX10.19/Ex10_19.sce
@@ -0,0 +1,45 @@
+//Ex10_19
+// Multipal Global Thresholding
+// 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).
+
+a=imread("Ex10_19.tif");
+a1=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+[count cell]=imhist(a);
+figure,plot2d3(cell,count);
+title('Histogram','color','blue','fontsize',4);
+
+//////////////////////////////// Otsu Method /////////////////////////////
+
+normal_hist=count/(M*N);
+Sum=0;
+cumu_mean=0;
+for k=1:max(cell)+1
+ Sum=Sum+normal_hist(k);
+ P1(k)=Sum;
+ cumu_mean=cumu_mean+(k*normal_hist(k));
+ m(k)=cumu_mean;
+ Mg=cumu_mean;
+ sigma_B(k)=(((Mg*P1(k))-m(k))^2)/(%eps+(P1(k)*(1-P1(k))));
+end
+
+th_Otsu=[80 177]; //find(sigma_B==max(sigma_B));
+b2=im2bw(a1,(th_Otsu(1)/255));
+b3=im2bw(a1,(th_Otsu(2)/255));
+b4=b2+b3;
+figure,ShowImage(mat2gray(b4),'Binary Image');
+title('Image Segmented into Three region using Dual Otsu Threshold','color','blue','fontsize',4);
+
diff --git a/3176/CH10/EX10.2/Ex10_2.sce b/3176/CH10/EX10.2/Ex10_2.sce
new file mode 100644
index 000000000..4312199d7
--- /dev/null
+++ b/3176/CH10/EX10.2/Ex10_2.sce
@@ -0,0 +1,24 @@
+//Ex10_2
+// Using the Laplacian for the Detection
+// 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).
+
+a=imread("Ex10_2.tif");
+figure,ShowImage(a,'Gray Image');
+title('Wire Bond Template Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+Mask=[1 1 1;1 -8 1;1 1 1]; // Mask for the Lapalacian
+Filtered_Image=imfilter(a,Mask); // Filtering the Original Image with the Mask
+figure,ShowImage(Filtered_Image,'Filter Image');
+title('Laplacian Image','color','blue','fontsize',4);
+
diff --git a/3176/CH10/EX10.2/Ex_10_2_3.jpeg b/3176/CH10/EX10.2/Ex_10_2_3.jpeg
new file mode 100644
index 000000000..9f05a2d3a
--- /dev/null
+++ b/3176/CH10/EX10.2/Ex_10_2_3.jpeg
Binary files differ
diff --git a/3176/CH10/EX10.2/Ex_10_2_4.jpeg b/3176/CH10/EX10.2/Ex_10_2_4.jpeg
new file mode 100644
index 000000000..8674ef602
--- /dev/null
+++ b/3176/CH10/EX10.2/Ex_10_2_4.jpeg
Binary files differ
diff --git a/3176/CH10/EX10.20/Ex10_20.sce b/3176/CH10/EX10.20/Ex10_20.sce
new file mode 100644
index 000000000..7f80b9dcf
--- /dev/null
+++ b/3176/CH10/EX10.20/Ex10_20.sce
@@ -0,0 +1,84 @@
+//Ex10_20
+// Variable Thresholding Via Image Partitioning
+// 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).
+
+
+function th1=otsu(count,cell)
+normal_hist=count/(M/2*N/3);
+Sum=0;
+cumu_mean=0;
+for k=1:max(cell)+1
+ Sum=Sum+normal_hist(k);
+ P1(k)=Sum;
+ cumu_mean=cumu_mean+(k*normal_hist(k));
+ m(k)=cumu_mean;
+ Mg=cumu_mean;
+ sigma_B(k)=(((Mg*P1(k))-m(k))^2)/(%eps+(P1(k)*(1-P1(k))));
+end
+
+th1=find(sigma_B==max(sigma_B));
+endfunction
+
+
+a=imread("Ex10_20.tif");
+a=imresize(a,[650 813],'bicubic');
+a1=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+[count cell]=imhist(a);
+figure,plot2d3(cell,count);
+title('Histogram','color','blue','fontsize',4);
+
+/////////////////////////////// Iterative Thresholding ///////////////////
+thr = iterthresh(a1);
+b1=im2bw(a1,thr);
+figure,ShowImage(b1,'Gray Image');
+title('Segmentation Using Iterative Global Thresholding','color','blue','fontsize',4);
+
+//////////////////////////////// Otsu Method /////////////////////////////
+
+normal_hist=count/(M*N);
+Sum=0;
+cumu_mean=0;
+for k=1:max(cell)+1
+ Sum=Sum+normal_hist(k);
+ P1(k)=Sum;
+ cumu_mean=cumu_mean+(k*normal_hist(k));
+ m(k)=cumu_mean;
+ Mg=cumu_mean;
+ sigma_B(k)=(((Mg*P1(k))-m(k))^2)/(%eps+(P1(k)*(1-P1(k))));
+end
+
+th=find(sigma_B==max(sigma_B));
+b2=im2bw(a1,(th/255));
+figure,ShowImage(mat2gray(b2),'Binary Image');
+title('Image Segmented using Otsu Threshold','color','blue','fontsize',4);
+
+/////////////////////////// Otsu with Image Partitioning /////////////////////////////
+count=[];
+cell=[];
+z=1;
+th2=[40 50 70 40 50 70];
+for i=1:M/2:M
+ for j=1:N/3:N
+ [count cell]=imhist(a(i:(i-1)+(M/2),j:(j-1)+(N/3)));
+ th1=otsu(count,cell);
+ b3(i:(i-1)+(M/2),j:(j-1)+(N/3))=im2bw(a1(i:(i-1)+(M/2),j:(j-1)+(N/3)),(th2(z)/255));
+ z=z+1;
+ end
+end
+
+figure,ShowImage(mat2gray(b3),'Binary Image');
+title('Image Segmented using Otsu Threshold','color','blue','fontsize',4);
diff --git a/3176/CH10/EX10.22/Ex10_22.sce b/3176/CH10/EX10.22/Ex10_22.sce
new file mode 100644
index 000000000..94b252b8f
--- /dev/null
+++ b/3176/CH10/EX10.22/Ex10_22.sce
@@ -0,0 +1,71 @@
+//Ex10_22
+// Document Thresholding Using Moving Averages
+// 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).
+
+a=imread("Ex10_22.tif");
+a1=im2double(a);
+figure,ShowImage(a1,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+Threshold = CalculateOtsuThreshold(a1);
+Thresh_Image=im2bw(a1,Threshold);
+figure,ShowImage(Thresh_Image,'Binary Image');
+title('Thresholded Image with Otsu Method','color','blue','fontsize',4);
+
+
+mask=zeros(1,20);
+array=[];
+for i=1:M
+ if(pmodulo(i,2)==0)
+ array=[array mtlb_fliplr(a1(i,:))];
+ else
+ array=[array a1(i,:)];
+ end
+end
+disp('first');
+for i=1:length(array)
+ for j=1:length(mask)
+ if(j<length(mask)) then
+ mask(j)=mask(j+1);
+ else
+ mask(j)=array(i);
+ end
+ end
+ avg(1,i)=sum(mask)/length(mask);
+end
+disp('Second');
+len=1;
+for i=1:M
+ if(pmodulo(i,2)==0)
+ b(i,:)=avg(len:len+N-1);
+ len=len+N;
+ else
+ b(i,:)=avg(len:len+N-1);
+ len=len+N;
+ end
+end
+disp('Last');
+
+b=0.5*b;
+for i=1:M
+ for j=1:N
+ if(b(i,j)>a1(i,j)) then
+ c(i,j)=0;
+ else
+ c(i,j)=1;
+ end
+ end
+end
+figure,ShowImage(c,'Binary Image');
+title('Local Thresholding Using Moving Average','color','blue','fontsize',4);
diff --git a/3176/CH10/EX10.22/Ex_10_22_1.jpeg b/3176/CH10/EX10.22/Ex_10_22_1.jpeg
new file mode 100644
index 000000000..93d92b4db
--- /dev/null
+++ b/3176/CH10/EX10.22/Ex_10_22_1.jpeg
Binary files differ
diff --git a/3176/CH10/EX10.23/Ex10_23.sce b/3176/CH10/EX10.23/Ex10_23.sce
new file mode 100644
index 000000000..808c93a5a
--- /dev/null
+++ b/3176/CH10/EX10.23/Ex10_23.sce
@@ -0,0 +1,73 @@
+//Ex10_23
+// Segmentation by Region Growing
+// 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).
+a=imread("Ex10_23.tif");
+a1=im2double(a);
+figure,ShowImage(a1,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+[count cell]=imhist(a);
+figure,plot2d3(cell,count);
+title('Histogram','color','blue','fontsize',4);
+
+th=254/255;
+Thresh_Image=im2bw(a1,th);
+figure,ShowImage(Thresh_Image,'Gray Image');
+title('Thresholded Image','color','blue','fontsize',4);
+for i=1:M
+ for j=1:N
+ if(Thresh_Image(i,j)) then
+ Thresh_Image1(i,j)=1;
+ else
+ Thresh_Image1(i,j)=0;
+ end
+ end
+end
+
+BlobImage = SearchBlobs(Thresh_Image); // Connected Compoment Labelling
+IsCalculated = CreateFeatureStruct(%f); // Feature struct is generated.
+IsCalculated.Centroid = %t; // The bounding box shall be calculated for each blob.
+BlobStatistics = AnalyzeBlobs(BlobImage, IsCalculated);
+Seed_Image=zeros(M,N);
+for i=1:max(BlobImage) // Centroid Calculation
+ Seed_Image(BlobStatistics(i).Centroid(1,2),BlobStatistics(i).Centroid(1,1))=1;
+end
+figure,ShowImage(Seed_Image,'Gray Image');
+title('Seed Point Image','color','blue','fontsize',4);
+
+Diff=uint8(255*imsubtract(a1,Thresh_Image1));
+figure,ShowImage(Diff,'Gray Image');
+title('Seed Point Image','color','blue','fontsize',4);
+[count cell]=imhist(Diff);
+figure,plot2d3(cell,count);
+title('Histogram','color','blue','fontsize',4);
+
+Thresh_Image2=uint8(zeros(M,N))
+for i=1:M
+ for j=1:N
+ if(Diff(i,j)<=68) then
+ Thresh_Image2(i,j)=255;
+ else if(Diff(i,j)>68 & Diff(i,j)<=165) then
+ Thresh_Image2(i,j)=125;
+ else
+ Thresh_Image2(i,j)=0;
+ end
+ end
+ end
+end
+figure,ShowImage(uint8(Thresh_Image2),'Gray Image');
+title('Seed Point Image','color','blue','fontsize',4);
+
+
+
diff --git a/3176/CH10/EX10.23/Ex_10_23_1.jpeg b/3176/CH10/EX10.23/Ex_10_23_1.jpeg
new file mode 100644
index 000000000..1083e7709
--- /dev/null
+++ b/3176/CH10/EX10.23/Ex_10_23_1.jpeg
Binary files differ
diff --git a/3176/CH10/EX10.23/Ex_10_23_2.jpeg b/3176/CH10/EX10.23/Ex_10_23_2.jpeg
new file mode 100644
index 000000000..f935b2837
--- /dev/null
+++ b/3176/CH10/EX10.23/Ex_10_23_2.jpeg
Binary files differ
diff --git a/3176/CH10/EX10.3/Ex10_3.sce b/3176/CH10/EX10.3/Ex10_3.sce
new file mode 100644
index 000000000..71891e04b
--- /dev/null
+++ b/3176/CH10/EX10.3/Ex10_3.sce
@@ -0,0 +1,25 @@
+//Ex10_3
+// Detection of Lines in Specified Direction
+// 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).
+
+a=imread("Ex10_2.tif");
+figure,ShowImage(a,'Gray Image');
+title('Wire Bond Template Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+Mask_Diagonal=[2 -1 -1;-1 2 -1;-1 -1 2]; // Mask for the +45 Line Detetion
+Filtered_Image=imfilter(a,Mask_Diagonal); // Filtering the Original Image with the Mask
+figure,ShowImage(Filtered_Image,'Filter Image');
+title('+45 Line Detected Image','color','blue','fontsize',4);
+
+
diff --git a/3176/CH10/EX10.4/Ex10_4.sce b/3176/CH10/EX10.4/Ex10_4.sce
new file mode 100644
index 000000000..360d2cf04
--- /dev/null
+++ b/3176/CH10/EX10.4/Ex10_4.sce
@@ -0,0 +1,86 @@
+//Ex10_4
+// Behavior of the First and Second Derivative of a Noisy Edge
+// 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).
+
+a=imread("Ex10_4.tif");
+a1=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+first_order=zeros(M,N);
+second_order=zeros(M,N);
+
+for i=2:M-1
+ for j=2:N-1
+ first_order(i,j)=a(i,j+1)-a(i,j);
+ second_order(i,j)=double(a1(i,j+1)+a1(i,j-1)-(2*a1(i,j)));
+ end
+end
+
+figure,ShowImage(double(first_order),'First Order Difference Image');
+title('First Order Difference Image','color','blue','fontsize',4);
+
+forward_count=0;
+reverse_count=0;
+for j= 2:N-1 // Finding First Zero Crossing Point
+ if(second_order(5,j)==0 & second_order(5,j+1)>0) then
+ forward_count=forward_count+1;
+ if(forward_count==1)then
+ ther1=second_order(5,j+1);
+ break;
+ end
+ end
+end
+
+for j= N-1:-1:2 // Finding Last Zero Crossing Point
+ if(second_order(5,j)==0 & second_order(5,j-1)<0) then
+ reverse_count=reverse_count+1;
+ if(reverse_count==1)then
+ ther2=second_order(5,j-1);
+ break;
+ end
+ end
+end
+
+for i=1:M // Removing unwanted Intensity range
+ for j=1:N
+ if(second_order(i,j)==ther1)
+ second_order1(i,j)=255;
+ else if(second_order(i,j)==ther2)
+ second_order1(i,j)=-255;
+ else
+ second_order1(i,j)=128;
+ end
+ end
+end
+end
+
+figure,ShowImage(second_order1,'Second Order Difference Image');
+title('Second Order Difference Image','color','blue','fontsize',4);
+
+t=a(5,1:N);
+t1=first_order(5,1:N);
+t2=second_order1(5,1:N);
+figure;
+subplot(311);
+plot(1:length(t),t);//
+title('Intensity Profile','color','blue','fontsize',4);
+subplot(312);
+mtlb_axis([1,N,0,1.5]);
+plot(1:length(t1),t1);//
+title('Intensity Profile of First order Derivative','color','blue','fontsize',4);
+subplot(313);
+plot(1:length(t2),t2);//
+title('Intensity Profile of Second order Derivative','color','blue','fontsize',4);
+
+
diff --git a/3176/CH10/EX10.6/Ex10_6.sce b/3176/CH10/EX10.6/Ex10_6.sce
new file mode 100644
index 000000000..a825e7e83
--- /dev/null
+++ b/3176/CH10/EX10.6/Ex10_6.sce
@@ -0,0 +1,38 @@
+//Ex10_6
+// Illustration of the 2 D Gradient Magnitude and Angle
+// 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).
+
+a=imread("Ex10_6.tif");
+//a=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+Mask=[-1 -2 -1;0 0 0;1 2 1]; // Mask for the Sobel
+GradientX_Image=imfilter(a,Mask); // Filtering the Original Image with the Mask
+figure,ShowImage(GradientX_Image,'Filter Image');
+title('Sobel X-direction Gradient Image','color','blue','fontsize',4);
+
+Mask=[-1 0 1;-2 0 2;-1 0 1]; // Mask for the Sobel
+GradientY_Image=imfilter(a,Mask); // Filtering the Original Image with the Mask
+figure,ShowImage(GradientY_Image,'Filter Image');
+title('Sobel Y-direction Gradient Image','color','blue','fontsize',4);
+
+Gradient=GradientX_Image+GradientY_Image;
+figure,ShowImage(Gradient,'Filter Image');
+title('Sobel X+Y Gradient Image','color','blue','fontsize',4);
+
+//Alpha=atan(double(GradientY_Image),double(GradientX_Image));
+//figure,ShowImage(Alpha,'Angle Image');
+//title('Angle Image','color','blue','fontsize',4);
+
diff --git a/3176/CH10/EX10.7/Ex10_7.sce b/3176/CH10/EX10.7/Ex10_7.sce
new file mode 100644
index 000000000..f16078f8f
--- /dev/null
+++ b/3176/CH10/EX10.7/Ex10_7.sce
@@ -0,0 +1,51 @@
+//Ex10_7
+// Illustration of the Marr-Hildreth Edge Detection Methods
+// 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).
+
+a=imread("Ex10_7.tif");
+a=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+sigma=4;
+for i=1:25
+ for j=1:25
+ Mask(i,j)=[(i^2+j^2-(2*sigma^2))/sigma^4]*exp(-(i^2+j^2)/(2*sigma^2)); // Mask Generation
+ end
+end
+
+Filter_Image=imfilter(a,Mask); // Filtering the Original Image with the Mask
+figure,ShowImage(Filter_Image,'Filter Image');
+title('Laplacian of gaussian Image','color','blue','fontsize',4);
+b=zeros(M,N);
+temp=Filter_Image;
+for i=2:M-1 // Zero Crossing Detection
+ for j=2:N-1
+ //temp=[Filter_Image(i-1:i+1,j-1:j+1)];
+ if((temp(i-1,j-1)>0 & temp(i+1,j+1)<0) | (temp(i-1,j-1)<0 & temp(i+1,j+1)>0)) then
+ b(i,j)=255;
+ else if ((temp(i-1,j+1)>0 & temp(i+1,j-1)<0) | (temp(i-1,j+1)<0 & temp(i+1,j-1)>0)) then
+ b(i,j)=255;
+ else if ((temp(i,j+1)>0 & temp(i,j-1)<0) | (temp(i,j+1)<0 & temp(i,j-1)>0)) then
+ b(i,j)=255;
+ else if ((temp(i-1,j)>0 & temp(i+1,j)<0) | (temp(i,j+1)<0 & temp(i,j-1)>0)) then
+ b(i,j)=255;
+ end
+ end
+ end
+ end
+ end
+end
+
+figure,ShowImage(b,'Zero Crossing Image');
+title('Zero Crossing Detected Image','color','blue','fontsize',4);
diff --git a/3176/CH10/EX10.8/Ex10_8.sce b/3176/CH10/EX10.8/Ex10_8.sce
new file mode 100644
index 000000000..43657565e
--- /dev/null
+++ b/3176/CH10/EX10.8/Ex10_8.sce
@@ -0,0 +1,83 @@
+//Ex10_8
+// Illustration of the Canny Edge Detection Methods
+// 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).
+
+a=imread("Ex10_8.tif");
+//a=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+ ////////////////// Threshlded Gradient of Smoothed Image ////////////////////////////////
+a1=imfilter(a,fspecial('average',5));
+Mask=[-1 -2 -1;0 0 0;1 2 1]; // Mask for the Sobel
+GradientX_Image=imfilter(a1,Mask); // Filtering the Original Image with the Mask
+//figure,ShowImage(GradientX_Image,'Filter Image');
+//title('Sobel X-direction Gradient Image','color','blue','fontsize',4);
+
+Mask=[-1 0 1;-2 0 2;-1 0 1]; // Mask for the Sobel
+GradientY_Image=imfilter(a1,Mask); // Filtering the Original Image with the Mask
+//figure,ShowImage(GradientY_Image,'Filter Image');
+//title('Sobel Y-direction Gradient Image','color','blue','fontsize',4);
+
+Gradient=GradientX_Image+GradientY_Image;
+//figure,ShowImage(Gradient,'Filter Image');
+//title('Sobel X+Y Gradient Image','color','blue','fontsize',4);
+
+th=84; // 33% of the Maximum Value in Gradient Image
+[row col]=find(Gradient>84);
+Gradient_Thresh=zeros(M,N);
+for i=1:length(row)
+ Gradient_Thresh(row(i),col(i))=255;
+end
+figure,ShowImage(Gradient_Thresh,'Filter Image');
+title('Thresholded gradient Image','color','blue','fontsize',4);
+
+//////////////////// Marr-Hildreth Edge Detection ///////////////////////////////////
+a=im2double(a);
+sigma=4;
+for i=1:25
+ for j=1:25
+ Mask(i,j)=[(i^2+j^2-(2*sigma^2))/sigma^4]*exp(-(i^2+j^2)/(2*sigma^2)); // Mask Generation
+ end
+end
+
+Filter_Image=imfilter(a,Mask); // Filtering the Original Image with the Mask
+//figure,ShowImage(Filter_Image,'Filter Image');
+//title('Laplacian of gaussian Image','color','blue','fontsize',4);
+b=zeros(M,N);
+temp=Filter_Image;
+for i=2:M-1 // Zero Crossing Detection
+ for j=2:N-1
+ //temp=[Filter_Image(i-1:i+1,j-1:j+1)];
+ if((temp(i-1,j-1)>0 & temp(i+1,j+1)<0) | (temp(i-1,j-1)<0 & temp(i+1,j+1)>0)) then
+ b(i,j)=255;
+ else if ((temp(i-1,j+1)>0 & temp(i+1,j-1)<0) | (temp(i-1,j+1)<0 & temp(i+1,j-1)>0)) then
+ b(i,j)=255;
+ else if ((temp(i,j+1)>0 & temp(i,j-1)<0) | (temp(i,j+1)<0 & temp(i,j-1)>0)) then
+ b(i,j)=255;
+ else if ((temp(i-1,j)>0 & temp(i+1,j)<0) | (temp(i,j+1)<0 & temp(i,j-1)>0)) then
+ b(i,j)=255;
+ end
+ end
+ end
+ end
+ end
+end
+figure,ShowImage(b,'Zero Crossing Image');
+title('Marr-Hildreth Edge Detected Image','color','blue','fontsize',4);
+
+////////////////////////// Canny Edge Detecedd Image //////////////////////////////////////
+a=imread("Ex10_8.tif");
+E=edge(a,'canny',[0.15 0.60]);
+figure,ShowImage(E,'Canny Image');
+title('Canny Edge Detected Image','color','blue','fontsize',4);
diff --git a/3176/CH10/EX10.9/Ex10_9.sce b/3176/CH10/EX10.9/Ex10_9.sce
new file mode 100644
index 000000000..2969facb7
--- /dev/null
+++ b/3176/CH10/EX10.9/Ex10_9.sce
@@ -0,0 +1,84 @@
+//Ex10_9
+// Another illustration of the three principal Edge Detection Methods
+// 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).
+
+a=imread("Ex10_9.tif");
+//a=im2double(a);
+figure,ShowImage(a,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+ ////////////////// Threshlded Gradient of Smoothed Image ////////////////////////////////
+a1=imfilter(a,fspecial('average',5));
+Mask=[-1 -2 -1;0 0 0;1 2 1]; // Mask for the Sobel
+GradientX_Image=imfilter(a1,Mask); // Filtering the Original Image with the Mask
+//figure,ShowImage(GradientX_Image,'Filter Image');
+//title('Sobel X-direction Gradient Image','color','blue','fontsize',4);
+
+Mask=[-1 0 1;-2 0 2;-1 0 1]; // Mask for the Sobel
+GradientY_Image=imfilter(a1,Mask); // Filtering the Original Image with the Mask
+//figure,ShowImage(GradientY_Image,'Filter Image');
+//title('Sobel Y-direction Gradient Image','color','blue','fontsize',4);
+
+Gradient=GradientX_Image+GradientY_Image;
+//figure,ShowImage(Gradient,'Filter Image');
+//title('Sobel X+Y Gradient Image','color','blue','fontsize',4);
+
+th=84; // 33% of the Maximum Value in Gradient Image
+[row col]=find(Gradient>84);
+Gradient_Thresh=zeros(M,N);
+for i=1:length(row)
+ Gradient_Thresh(row(i),col(i))=255;
+end
+figure,ShowImage(Gradient_Thresh,'Filter Image');
+title('Thresholded gradient Image','color','blue','fontsize',4);
+
+//////////////////// Marr-Hildreth Edge Detection ///////////////////////////////////
+a=im2double(a);
+sigma=3;
+for i=1:19
+ for j=1:19
+ Mask(i,j)=[(i^2+j^2-(2*sigma^2))/sigma^4]*exp(-(i^2+j^2)/(2*sigma^2)); // Mask Generation
+ end
+end
+
+Filter_Image=imfilter(a,Mask); // Filtering the Original Image with the Mask
+//figure,ShowImage(Filter_Image,'Filter Image');
+//title('Laplacian of gaussian Image','color','blue','fontsize',4);
+b=zeros(M,N);
+temp=Filter_Image;
+th=0.0021;
+for i=2:M-1 // Zero Crossing Detection
+ for j=2:N-1
+ //temp=[Filter_Image(i-1:i+1,j-1:j+1)];
+ if((temp(i-1,j-1)>th & temp(i+1,j+1)<th) | (temp(i-1,j-1)<th & temp(i+1,j+1)>th)) then
+ b(i,j)=255;
+ else if ((temp(i-1,j+1)>th & temp(i+1,j-1)<th) | (temp(i-1,j+1)<th & temp(i+1,j-1)>th)) then
+ b(i,j)=255;
+ else if ((temp(i,j+1)>th & temp(i,j-1)<th) | (temp(i,j+1)<th & temp(i,j-1)>th)) then
+ b(i,j)=255;
+ else if ((temp(i-1,j)>th & temp(i+1,j)<th) | (temp(i,j+1)<th & temp(i,j-1)>th)) then
+ b(i,j)=255;
+ end
+ end
+ end
+ end
+ end
+end
+figure,ShowImage(b,'Zero Crossing Image');
+title('Marr-Hildreth Edge Detected Image','color','blue','fontsize',4);
+
+////////////////////////// Canny Edge Detecedd Image //////////////////////////////////////
+a=imread("Ex10_9.tif");
+E=edge(a,'canny',[0.05 0.95]);
+figure,ShowImage(E,'Canny Image');
+title('Canny Edge Detected Image','color','blue','fontsize',4);