summaryrefslogtreecommitdiff
path: root/3176/CH6/EX6.9/Ex6_9.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /3176/CH6/EX6.9/Ex6_9.sce
downloadScilab-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/CH6/EX6.9/Ex6_9.sce')
-rw-r--r--3176/CH6/EX6.9/Ex6_9.sce81
1 files changed, 81 insertions, 0 deletions
diff --git a/3176/CH6/EX6.9/Ex6_9.sce b/3176/CH6/EX6.9/Ex6_9.sce
new file mode 100644
index 000000000..d02619162
--- /dev/null
+++ b/3176/CH6/EX6.9/Ex6_9.sce
@@ -0,0 +1,81 @@
+//Ex6_9 :
+//Tonal Transformations.
+
+// 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).
+
+////////////////// Tonal Correction for the Flat Image ////////////////////////
+Color=imread("Ex6_9_1.tif");
+Color=imresize(Color,0.5);
+[nr nc]=size(Color);
+figure,ShowColorImage(Color,'Gray Image');
+title('Original Image');
+D=0:256;
+D0=155;// Cut-off Number
+n=2; // Order of Butter Wirth Approximation
+H1 = 1-ones(1,1)./(1+(D./D0).^(2*n)); // Transfer Function (Design from the Butterworth Approximation)
+figure,plot(H1);
+title('RGB Intensity Transformation Function');
+Slice_Image=[];
+for i=1:nr
+ for j=1:nc
+ Slice_Image(i,j,1)=H1(uint16(Color(i,j,1))+1);
+ Slice_Image(i,j,2)=H1(uint16(Color(i,j,2))+1);
+ Slice_Image(i,j,3)=H1(uint16(Color(i,j,3))+1);
+ end
+end
+ShowColorImage(Slice_Image,'RGB Image');
+title('Tonal Corrected image');
+
+////////////////// Tonal Correction for the Light Image ////////////////////////
+Color=imread("Ex6_9_2.tif");
+Color=imresize(Color,0.5);
+[nr nc]=size(Color);
+figure,ShowColorImage(Color,'Gray Image');
+title('Original Image');
+D=0:1/256:1;
+H2=1*D^3.0; // Transfer Function (Design from the Gamma Funcetion).
+figure,plot(H2);
+title('RGB Intensity Transformation Function');
+Slice_Image=[];
+for i=1:nr
+ for j=1:nc
+ Slice_Image(i,j,1)=H2(uint16(Color(i,j,1))+1);
+ Slice_Image(i,j,2)=H2(uint16(Color(i,j,2))+1);
+ Slice_Image(i,j,3)=H2(uint16(Color(i,j,3))+1);
+ end
+end
+ShowColorImage(Slice_Image,'RGB Image');
+title('Tonal Corrected image');
+
+////////////////// Tonal Correction for the Dark Image ////////////////////////
+Color=imread("Ex6_9_3.tif");
+Color=imresize(Color,0.5);
+[nr nc]=size(Color);
+figure,ShowColorImage(Color,'Gray Image');
+title('Original Image');
+D=0:1/256:1;
+H3=1*D^0.35;
+figure,plot(H3);
+title('RGB Intensity Transformation Function');
+Slice_Image=[];
+for i=1:nr
+ for j=1:nc
+ Slice_Image(i,j,1)=H3(uint16(Color(i,j,1))+1);
+ Slice_Image(i,j,2)=H3(uint16(Color(i,j,2))+1);
+ Slice_Image(i,j,3)=H3(uint16(Color(i,j,3))+1);
+ end
+end
+ShowColorImage(Slice_Image,'RGB Image');
+title('Tonal Corrected image');
+
+