diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /3176/CH3 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '3176/CH3')
-rw-r--r-- | 3176/CH3/EX3.1/Ex3_1.sce | 31 | ||||
-rwxr-xr-x | 3176/CH3/EX3.10/3_10_his_equ.jpeg | bin | 0 -> 35056 bytes | |||
-rwxr-xr-x | 3176/CH3/EX3.10/3_10_his_local.jpeg | bin | 0 -> 62145 bytes | |||
-rw-r--r-- | 3176/CH3/EX3.10/Ex3_10.sce | 75 | ||||
-rw-r--r-- | 3176/CH3/EX3.11/Ex3_11.sce | 40 | ||||
-rw-r--r-- | 3176/CH3/EX3.12/Ex3_12.sce | 69 | ||||
-rw-r--r-- | 3176/CH3/EX3.13/Ex3_13.sce | 49 | ||||
-rw-r--r-- | 3176/CH3/EX3.14/Ex3_14.sce | 30 | ||||
-rw-r--r-- | 3176/CH3/EX3.15/Ex3_15.sce | 43 | ||||
-rw-r--r-- | 3176/CH3/EX3.16/Ex3_16.sce | 41 | ||||
-rw-r--r-- | 3176/CH3/EX3.17/Ex3_17.sce | 27 | ||||
-rw-r--r-- | 3176/CH3/EX3.2/Ex3_2.sce | 32 | ||||
-rw-r--r-- | 3176/CH3/EX3.3/Ex3_3.sce | 38 | ||||
-rw-r--r-- | 3176/CH3/EX3.5/Ex3_5.sce | 56 | ||||
-rw-r--r-- | 3176/CH3/EX3.6/Ex3_6.sce | 67 | ||||
-rw-r--r-- | 3176/CH3/EX3.8/Ex3_8.sce | 74 | ||||
-rw-r--r-- | 3176/CH3/EX3.8/Ex_3_8_1.jpeg | bin | 0 -> 32246 bytes | |||
-rw-r--r-- | 3176/CH3/EX3.8/Ex_3_8_2.jpeg | bin | 0 -> 31106 bytes |
18 files changed, 672 insertions, 0 deletions
diff --git a/3176/CH3/EX3.1/Ex3_1.sce b/3176/CH3/EX3.1/Ex3_1.sce new file mode 100644 index 000000000..d4aed4978 --- /dev/null +++ b/3176/CH3/EX3.1/Ex3_1.sce @@ -0,0 +1,31 @@ +//Ex3_1
+// Gamma Intensity transformation
+// 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).
+gray=imread("Ex3_1.tif");
+figure,ShowImage(gray,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(gray);
+c=1;
+gamma=[0.6 0.4 0.3];
+for i=1:length(gamma)
+ b=c.*(gray).^gamma(i); //Gamma transformation
+ b=mat2gray(b);
+ figure,ShowImage(b,'Gray Image');
+ title('Enhance Image after Gamma transformation','color','blue','fontsize',4);
+end
+
+
+
+
+
+
diff --git a/3176/CH3/EX3.10/3_10_his_equ.jpeg b/3176/CH3/EX3.10/3_10_his_equ.jpeg Binary files differnew file mode 100755 index 000000000..5828162ba --- /dev/null +++ b/3176/CH3/EX3.10/3_10_his_equ.jpeg diff --git a/3176/CH3/EX3.10/3_10_his_local.jpeg b/3176/CH3/EX3.10/3_10_his_local.jpeg Binary files differnew file mode 100755 index 000000000..5a52a6223 --- /dev/null +++ b/3176/CH3/EX3.10/3_10_his_local.jpeg diff --git a/3176/CH3/EX3.10/Ex3_10.sce b/3176/CH3/EX3.10/Ex3_10.sce new file mode 100644 index 000000000..4f14adcbd --- /dev/null +++ b/3176/CH3/EX3.10/Ex3_10.sce @@ -0,0 +1,75 @@ +//Ex3_10
+// Local Histogram Equalization
+// 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).
+p1=imread('Ex3_10.tif');
+a=imcrop(p1,[175 178 155 160]);
+//a=imresize(a,0.5,'bicubic');
+[P Q]=size(a);
+
+/////////////////////////// Global Histogram Equalization /////////////////////////
+[count cell]=imhist(a);
+figure,ShowImage(a,'Original Image');
+title('Original Image','color','blue','fontsize',4);
+
+r=cell'; // Transpose of matrix
+nk=round(count)'; // Transpose of matrix
+M=sum(nk);
+probeblity_r=nk/M; // Probablity calculation
+for i=1:length(r)
+ sum_1=0;
+ for j=1:i
+ sum_1=sum_1+probeblity_r(j);
+ end
+ s(i)=max(r)*sum_1;
+end
+s=round(s); // Rounding Approach
+//disp(s);
+[nr nc]=size(s);
+temp=s'; // Transpose of matrix
+for i=1:P // Intensity Replacement in Original Image
+ for j=1:Q
+ b(i,j)=temp(double(a(i,j))+1);
+ end
+end
+figure,ShowImage(b,'histogram Equlized Image');
+title('Image Enhancement using Global Histogram Equalization','color','blue','fontsize',4);
+
+/////////////////////////// Local Histogram Equalization /////////////////////////
+mask=3;
+for i=1+floor(mask/2):P-floor(mask/2)
+ for j=1+floor(mask/2):Q-floor(mask/2)
+ a1=a(i-floor(mask/2):1:i+floor(mask/2),j-floor(mask/2):1:j+floor(mask/2)) ;
+ [count cell]=imhist(a1);
+ r=cell'; // Transpose of matrix
+ nk=round(count)'; // Transpose of matrix
+ M=sum(nk);
+ probeblity_r=nk/M; // Probablity calculation
+ for x=1:length(r)
+ sum_1=0;
+ for y=1:x
+ sum_1=sum_1+probeblity_r(y);
+ end
+ s(x)=max(r)*sum_1;
+ end
+ s=round(s); // Rounding Approach
+ //disp(s);
+ [nr nc]=size(s);
+ temp=s'; // Transpose of matrix
+ b(i,j)=temp(double(a(i,j))+1);
+ end
+ disp(i);
+end
+figure,ShowImage(b,'histogram Equlized Image');
+title('Image Enhancement using Local Histogram Equalization','color','blue','fontsize',4);
diff --git a/3176/CH3/EX3.11/Ex3_11.sce b/3176/CH3/EX3.11/Ex3_11.sce new file mode 100644 index 000000000..4c4c3d656 --- /dev/null +++ b/3176/CH3/EX3.11/Ex3_11.sce @@ -0,0 +1,40 @@ +//Ex3_11
+// Computing Histogram Statistic
+// 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=uint8([0 0 1 1 2;1 2 3 0 1;3 3 2 2 0;2 3 1 0 0;1 1 3 2 2]);
+L=max(a);
+[P Q]=size(a);
+
+/////////////////////////// Global Histogram Equalization /////////////////////////
+[count cell]=imhist(a);
+//figure,bar(cell(1:L+1),count(1:L+1),0.2);
+//title('Histogram');
+r=cell(1:L+1)'; // Transpose of matrix
+nk=round(count(1:L+1))'; // Transpose of matrix
+M=sum(nk);
+probeblity_r=nk/M; // Probablity calculation
+sum_1=0;
+for i=1:length(r)
+ sum_1=sum_1+(r(i)*probeblity_r(i));
+end
+Mean=sum_1;
+disp('Probablity:');
+disp(probeblity_r);
+disp('Mean:');
+disp(Mean);
+
+Mean1=mean(double(a));
+disp('Mean Calculated from (5*5)Image:');
+disp(Mean1);
diff --git a/3176/CH3/EX3.12/Ex3_12.sce b/3176/CH3/EX3.12/Ex3_12.sce new file mode 100644 index 000000000..ac44e2f9d --- /dev/null +++ b/3176/CH3/EX3.12/Ex3_12.sce @@ -0,0 +1,69 @@ +//Ex3_12
+// Local Enhancement using Histogram Statistic
+// 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('Ex3_12.tif');
+//a=double(a);
+[M N]=size(a);
+
+/////////////////////////// Global Histogram Equalization /////////////////////////
+[count cell]=imhist(a); // Histogram Calculation
+figure,ShowImage(a,'Original Image');
+title('Original Image','color','blue','fontsize',4);
+
+r=cell'; // Transpose of matrix
+nk=round(count)'; // Transpose of matrix
+P=sum(nk);
+probeblity_r=nk/P; // Probablity calculation
+for i=1:length(r)
+ sum_1=0;
+ for j=1:i
+ sum_1=sum_1+probeblity_r(j);
+ end
+ s(i)=max(r)*sum_1;
+end
+s=round(s); // Rounding Approach
+disp(s);
+[nr nc]=size(s);
+temp=s'; // Transpose of matrix
+for i=1:M // Intensity Replacement in Original Image
+ for j=1:N
+ b(i,j)=temp(double(a(i,j))+1);
+ end
+end
+figure,ShowImage(b,'histogram Equlized Image');
+title('Image Enhancement using Global Histogram Statistic ','color','blue','fontsize',4);
+
+
+/////////////////////////// Image Enhancement using Local Histogram Statistic /////////////////////////
+E=4;K0=0.4;K1=0.02;K2=0.4;
+mask=3;
+Mean_G=mean(double(a)); // Global Mean Value
+Variance_G=variance(double(a)); // Global Variance Value
+
+for i=1+floor(mask/2):M-floor(mask/2)
+ for j=1+floor(mask/2):N-floor(mask/2)
+ a1=a(i-floor(mask/2):1:i+floor(mask/2),j-floor(mask/2):1:j+floor(mask/2)) ;
+ Mean_L=mean(double(a1)); // Local Mean Value
+ Variance_L=variance(double(a1)); // Local Variance Value
+ if((Mean_L<=K0*Mean_G) & (K1*Variance_G<=Variance_L) & (Variance_L<=K2*Variance_G))
+ g(i,j)=E*a(i,j);
+ else
+ g(i,j)=a(i,j);
+ end
+ end
+end
+
+figure,ShowImage(g,'Local Histogram Statistic');
+title('Image Enhancement using Local Histogram Statistic','color','blue','fontsize',4);
diff --git a/3176/CH3/EX3.13/Ex3_13.sce b/3176/CH3/EX3.13/Ex3_13.sce new file mode 100644 index 000000000..fab5173a9 --- /dev/null +++ b/3176/CH3/EX3.13/Ex3_13.sce @@ -0,0 +1,49 @@ +//Ex3_13
+// Image Smoothing
+// 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('Ex3_13.tif');
+[M N]=size(a);
+figure,ShowImage(a,'Original Image');
+title('Original Image','color','blue','fontsize',4);
+
+/////////////////////////// Smoothing with Mask Size (3*3) /////////////////////////
+F=fspecial('average',3);
+Image=imfilter(a,F);
+figure,ShowImage(Image,'Original Image');
+title('Filtered Image with Mask Size(3*3)','color','blue','fontsize',4);
+
+/////////////////////////// Smoothing with Mask Size (5*5) /////////////////////////
+F=fspecial('average',5);
+Image=imfilter(a,F);
+figure,ShowImage(Image,'Original Image');
+title('Filtered Image with Mask Size(5*5)','color','blue','fontsize',4);
+
+/////////////////////////// Smoothing with Mask Size (5*5) /////////////////////////
+F=fspecial('average',9);
+Image=imfilter(a,F);
+figure,ShowImage(Image,'Original Image');
+title('Filtered Image with Mask Size(9*9)','color','blue','fontsize',4);
+
+/////////////////////////// Smoothing with Mask Size (5*5) /////////////////////////
+F=fspecial('average',15);
+Image=imfilter(a,F);
+figure,ShowImage(Image,'Original Image');
+title('Filtered Image with Mask Size(15*15)','color','blue','fontsize',4);
+
+/////////////////////////// Smoothing with Mask Size (5*5) /////////////////////////
+F=fspecial('average',35);
+Image=imfilter(a,F);
+figure,ShowImage(Image,'Original Image');
+title('Filtered Image with Mask Size(35*35)','color','blue','fontsize',4);
diff --git a/3176/CH3/EX3.14/Ex3_14.sce b/3176/CH3/EX3.14/Ex3_14.sce new file mode 100644 index 000000000..8df299b30 --- /dev/null +++ b/3176/CH3/EX3.14/Ex3_14.sce @@ -0,0 +1,30 @@ +//Ex3_14
+// Median Filtering for Noise Reduction
+// 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('Ex3_14.tif');
+[M N]=size(a);
+figure,ShowImage(a,'Original Image');
+title('Original Image','color','blue','fontsize',4);
+
+/////////////////////////// Averaging Filter with Mask Size (3*3) /////////////////////////
+F=fspecial('average',3);
+Image=imfilter(a,F);
+figure,ShowImage(Image,'Original Image');
+title('Filtered Image with Averaging Filter(3*3)','color','blue','fontsize',4);
+
+/////////////////////////// Median Filtering with Mask Size (5*5) /////////////////////////
+Image=MedianFilter(a,[3 3]);
+figure,ShowImage(Image,'Original Image');
+title('Median Filtered Image with Median Filter(3*3)','color','blue','fontsize',4);
diff --git a/3176/CH3/EX3.15/Ex3_15.sce b/3176/CH3/EX3.15/Ex3_15.sce new file mode 100644 index 000000000..3167b1db1 --- /dev/null +++ b/3176/CH3/EX3.15/Ex3_15.sce @@ -0,0 +1,43 @@ +//Ex3_15
+// Image Sharpning using Laplacian
+// 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('Ex3_15.tif');
+[M N]=size(a);
+figure,ShowImage(a,'Original Image');
+title('Original Image','color','blue','fontsize',4);
+
+/////////////////////////// Laplacian Filtering /////////////////////////
+F=fspecial('laplacian',0);
+Image1=imfilter(a,F);
+figure,ShowImage(Image1,'Original Image');
+title('Filtered Image with Laplacian Mask','color','blue','fontsize',4);
+
+/////////////////////////// Laplacian Filtering /////////////////////////
+F=[1 1 1;1 -8 1;1 1 1];
+Image2=imfilter(a,F);
+figure,ShowImage(Image2,'Original Image');
+title('Filtered Image with Laplacian Mask','color','blue','fontsize',4);
+
+/////////////////////////// Laplacian Filtering /////////////////////////
+b=a-(1*Image1);
+figure,ShowImage(b,'Original Image');
+title('Filtered Image with Laplacian Mask','color','blue','fontsize',4);
+
+
+/////////////////////////// Laplacian Filtering /////////////////////////
+b=a-(1*Image2);
+figure,ShowImage(b,'Original Image');
+title('Filtered Image with Laplacian Mask','color','blue','fontsize',4);
+
diff --git a/3176/CH3/EX3.16/Ex3_16.sce b/3176/CH3/EX3.16/Ex3_16.sce new file mode 100644 index 000000000..cdd7a580d --- /dev/null +++ b/3176/CH3/EX3.16/Ex3_16.sce @@ -0,0 +1,41 @@ +//Ex3_16
+// Image Sharpning using Un-Sharp Masking and High-Boost 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).
+a=imread('Ex3_16.tif');
+[M N]=size(a);
+figure,ShowImage(a,'Original Image');
+title('Original Image','color','blue','fontsize',4);
+
+/////////////////////////// Laplacian Filtering /////////////////////////
+F=fspecial('gaussian',5,3);
+Image1=imfilter(a,F);
+figure,ShowImage(Image1,'Original Image');
+title('Filtered Image with gaussian Filter(3*3)','color','blue','fontsize',4);
+
+Unsharp_Mask=a-Image1;
+figure,ShowImage(Unsharp_Mask,'Original Image');
+title('Unsharp Mask Image','color','blue','fontsize',4);
+
+/////////////////////////// Un-Sharp Filtering /////////////////////////
+k=1;
+Unsharp=a+(k.*Image1);
+figure,ShowImage(Unsharp,'Original Image');
+title('Unsharp Filtered Image','color','blue','fontsize',4);
+
+/////////////////////////// High-Boost Filtering /////////////////////////
+k=4.5;
+High_Boost=a+(k.*Image1);
+figure,ShowImage(High_Boost,'Original Image');
+title('High_Boost Filtered Image','color','blue','fontsize',4);
diff --git a/3176/CH3/EX3.17/Ex3_17.sce b/3176/CH3/EX3.17/Ex3_17.sce new file mode 100644 index 000000000..ec221d928 --- /dev/null +++ b/3176/CH3/EX3.17/Ex3_17.sce @@ -0,0 +1,27 @@ +//Ex3_17
+// Use of gradient for Edge Enhancement
+// 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=rgb2gray(imread('Ex3_17.png'));
+[M N]=size(a);
+figure,ShowImage(a,'Original Image');
+title('Original Image','color','blue','fontsize',4);
+
+/////////////////////////// Laplacian Filtering /////////////////////////
+F=fspecial('sobel'); // Sobel Mask
+Image1=imfilter(a,F);
+figure,ShowImage(Image1,'Original Image');
+title('Filtered Image with Sobel Gradient(3*3)','color','blue','fontsize',4);
+
+
diff --git a/3176/CH3/EX3.2/Ex3_2.sce b/3176/CH3/EX3.2/Ex3_2.sce new file mode 100644 index 000000000..6b984f70e --- /dev/null +++ b/3176/CH3/EX3.2/Ex3_2.sce @@ -0,0 +1,32 @@ +//Ex3_2
+// Illustration of Power Law Transformation
+// 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).
+gray=imread("Ex3_2.tif");
+gray=im2double(gray);
+figure,ShowImage(gray,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(gray);
+c=1;
+gamma=[3 4 5];
+for i=1:length(gamma)
+ b=c.*(gray).^gamma(i); //Gamma transformation
+ b=mat2gray(b);
+ figure,ShowImage(b,'Gray Image');
+ title('Enhance Image after Gamma transformation','color','blue','fontsize',4);
+end
+
+
+
+
+
+
diff --git a/3176/CH3/EX3.3/Ex3_3.sce b/3176/CH3/EX3.3/Ex3_3.sce new file mode 100644 index 000000000..ed8e2139c --- /dev/null +++ b/3176/CH3/EX3.3/Ex3_3.sce @@ -0,0 +1,38 @@ +//Ex3_3
+// Intensity Level Slicing
+// 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).
+gray=imread("Ex3_3.tif");
+//gray=im2double(gray);
+figure,ShowImage(gray,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(gray);
+A=145;
+B=245;
+for i=1:M
+ for j=1:N
+ if(gray(i,j)>A & gray(i,j)<=B)
+ b(i,j)=255;
+ c(i,j)=255;
+ else
+ b(i,j)=0;
+ c(i,j)=gray(i,j);
+ end
+ end
+end
+figure,ShowImage(b,'Gray Image');
+title('Image after Intensity Slicing transformation','color','blue','fontsize',4);
+
+figure,ShowImage(c,'Gray Image');
+title('Image after Intensity Slicing transformation(Linear)','color','blue','fontsize',4);
+
+
diff --git a/3176/CH3/EX3.5/Ex3_5.sce b/3176/CH3/EX3.5/Ex3_5.sce new file mode 100644 index 000000000..7ec584068 --- /dev/null +++ b/3176/CH3/EX3.5/Ex3_5.sce @@ -0,0 +1,56 @@ +//Ex3_5
+// A Simple Illustration of Histogram Equalization
+// 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).
+r=[0 1 2 3 4 5 6 7]; // Intensity
+nk=[790 1023 850 656 329 245 122 81]; //Total No. of Pixels having Same Intensity
+M=sum(nk);
+probability_r=nk/M; // Probability calculation
+for i=1:length(r)
+ sum_1=0;
+ for j=1:i
+ sum_1=sum_1+probability_r(j);
+ end
+ s(i)=max(r)*sum_1;
+end
+s=round(s); // Rounding Approach
+disp(s);
+[nr nc]=size(s);
+
+
+for i=0:max(r)
+ [row col]=find(s==i);
+ len=length(row);
+ if(len>0)
+ sum_1=0;
+ for j=1:len
+ sum_1=sum_1+probability_r(row(j)); //Addition of Probability of same intensity after Equalization
+ end
+ Hist_equ(i+1)=sum_1;
+ else
+ Hist_equ(i+1)=0;
+ end
+end
+disp('Histogram Equalization:')
+disp(Hist_equ);
+
+figure,bar(r,probability_r,0.1);
+title('Original Histogram','color','blue','fontsize',4);
+xlabel('Intensity');
+ylabel('Probability of Same Intensity');
+
+figure,bar(r,Hist_equ,0.1);
+title('Equalized Histogram','color','blue','fontsize',4);
+xlabel('Intensity');
+ylabel('Probability of Same Intensity');
diff --git a/3176/CH3/EX3.6/Ex3_6.sce b/3176/CH3/EX3.6/Ex3_6.sce new file mode 100644 index 000000000..7a9af7a65 --- /dev/null +++ b/3176/CH3/EX3.6/Ex3_6.sce @@ -0,0 +1,67 @@ +//Ex3_6
+// Histogram Equalization
+// 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('Ex3_6.tif');
+[P Q]=size(a);
+[count cell]=imhist(a);
+figure,ShowImage(a,'Original Image');
+title('Original Image','color','blue','fontsize',4);
+
+r=cell'; // Transpose of matrix
+nk=round(count)'; // Transpose of matrix
+
+//r=[0 1 2 3 4 5 6 7]; // Intensity
+//nk=[790 1023 850 656 329 245 122 81]; //Total No. of Pixels having Same Intensity
+M=sum(nk);
+probeblity_r=nk/M; // Probablity calculation
+for i=1:length(r)
+ sum_1=0;
+ for j=1:i
+ sum_1=sum_1+probeblity_r(j);
+ end
+ s(i)=max(r)*sum_1;
+end
+s=round(s); // Rounding Approach
+disp(s);
+[nr nc]=size(s);
+temp=s'; // Transpose of matrix
+for i=1:P // Intensity Replacement in Original Image
+ for j=1:Q
+ b(i,j)=temp(double(a(i,j))+1);
+ end
+end
+figure,ShowImage(b,'histogram Equlized Image');
+title('histogram Equlized Image','color','blue','fontsize',4);
+
+for i=0:max(r)
+ [row col]=find(s==i);
+ len=length(row);
+ if(len>0)
+ sum_1=0;
+ for j=1:len
+ sum_1=sum_1+probeblity_r(row(j)); //Addition of Probability of same intensity after Equqlization
+ end
+ Hist_equ(i+1)=sum_1;
+ else
+ Hist_equ(i+1)=0;
+ end
+end
+disp('Histogram Equlization:')
+disp(Hist_equ);
+
+figure,bar(r,Hist_equ,0.1);
+title('Equalized Histogram','color','blue','fontsize',4);
+xlabel('Intensity');
+ylabel('Probability of Same Intensity');
diff --git a/3176/CH3/EX3.8/Ex3_8.sce b/3176/CH3/EX3.8/Ex3_8.sce new file mode 100644 index 000000000..b730075a1 --- /dev/null +++ b/3176/CH3/EX3.8/Ex3_8.sce @@ -0,0 +1,74 @@ +//Ex3_8
+// Histogram Specification
+// 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).
+r=[0 1 2 3 4 5 6 7]; // Intensity
+nk=[790 1023 850 656 329 245 122 81]; //Total No. of Pixels having Same Intensity
+probability_Specified=[0.00 0.00 0.00 0.15 0.20 0.30 0.20 0.15]; // Histogram Specification
+M=sum(nk);
+probability_r=nk/M; // Probablity calculation
+for i=1:length(r)
+ sum_1=0;
+ sum_2=0;
+ for j=1:i
+ sum_1=sum_1+probability_r(j); // Histogram Equalization
+ sum_2=sum_2+probability_Specified(j); // Histogram Specification
+ end
+ s(i)=max(r)*sum_1;
+ G(i)=max(r)*sum_2;
+end
+
+s=round(s); // Rounding Approach
+disp('Histogram Equalization:')
+disp(s);
+G=round(G); // Rounding Approach
+disp('Histogram Specification G(Zq):')
+disp(G);
+[nr nc]=size(s);
+
+for i=0:max(r)
+ [row col]=find(G(i+1)==s);
+ len=length(row);
+ if(len>0)
+ sum_1=0;
+ for j=1:len
+ sum_1=sum_1+probability_r(row(j));
+ end
+ Hist_Spe(i+1)=sum_1;
+ end
+ if(len==0)
+ if(G(i+1)==0)
+ Hist_Spe(i+1)=0;
+ else
+ Hist_Spe(i+1)=probability_r(G(i+1));
+ end
+end
+end
+disp('Histogram After Matching:')
+disp(Hist_Spe);
+
+figure,bar(r,probability_r,0.1);
+title('Original Histrogram','color','blue','fontsize',4);
+xlabel('Intensity');
+ylabel('Probability of Same Intensity');
+
+figure,bar(r,probability_Specified,0.1);
+title('Specified Histogram','color','blue','fontsize',4);
+xlabel('Intensity');
+ylabel('Probability of Same Intensity');
+
+figure,bar(r,Hist_Spe,0.1);
+title('Histogram matching','color','blue','fontsize',4);
+xlabel('Intensity');
+ylabel('Probability of Same Intensity');
diff --git a/3176/CH3/EX3.8/Ex_3_8_1.jpeg b/3176/CH3/EX3.8/Ex_3_8_1.jpeg Binary files differnew file mode 100644 index 000000000..ed3a18eba --- /dev/null +++ b/3176/CH3/EX3.8/Ex_3_8_1.jpeg diff --git a/3176/CH3/EX3.8/Ex_3_8_2.jpeg b/3176/CH3/EX3.8/Ex_3_8_2.jpeg Binary files differnew file mode 100644 index 000000000..46527c48c --- /dev/null +++ b/3176/CH3/EX3.8/Ex_3_8_2.jpeg |