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/CH4/EX4.24 | |
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/CH4/EX4.24')
-rw-r--r-- | 3176/CH4/EX4.24/Ex4_24.sce | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/3176/CH4/EX4.24/Ex4_24.sce b/3176/CH4/EX4.24/Ex4_24.sce new file mode 100644 index 000000000..1e50e6749 --- /dev/null +++ b/3176/CH4/EX4.24/Ex4_24.sce @@ -0,0 +1,66 @@ +//Ex4_24
+// Enhancement of Corrupted Cassini Saturn Image by Notch 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).
+
+function[H]=notchfilter(M,N,W)//notchfilter is used to filter an image .
+ H=ones(M,N);
+ H(1:ceil(M/2-5),ceil(N/2-W/2):ceil(N/2+W/2))=0;
+ H(ceil(M/2+5):M,ceil(N/2-W/2):ceil(N/2+W/2))=0;
+
+endfunction
+
+
+
+/////////////////////////////////// Main Programm ////////////////////////////////
+a=imread("Ex4_24.tif");
+//gray=rgb2gray(a);
+gray=im2double(a);
+
+figure,ShowImage(gray,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(gray);
+
+h=fft2(gray);//fft2() is used to find 2-Dimensional Fast Fourier Transform of an matrix
+i=log(1+abs(h));
+in=fftshift(i);//fftshift() is used to rearrange the fft output, moving the zero frequency to the center of the spectrum.
+inm=mat2gray(in)
+figure,ShowImage(inm,'Frequency Spectrum');
+title('Frequency Spectrum','color','blue','fontsize',4);
+
+filt=notchfilter(M,N,7); // User Define Function which generate Filter Mask Corresponding to Low Frequency
+filt_pass=1-filt;
+//filt_shift=fftshift(filt);
+figure,ShowImage(filt,'Filter Mask');
+title('Filter Mask (Band stop) to Specific Cut-Off Frequency','color','blue','fontsize',4);
+
+n=filt.*fftshift(h);//Multiply the Original Spectrum with the Filter Mask.
+Image_filter=real(ifft(fftshift(n)));
+Image_filter=mat2gray(Image_filter)
+figure,ShowImage(Image_filter,'Filtered Image');
+title('Filtered Image with Specific Cut-Off Frequency','color','blue','fontsize',4);
+
+
+figure,ShowImage(filt_pass,'Filter Mask');
+title('Filter Mask (Band Pass) to Specific Cut-Off Frequency','color','blue','fontsize',4);
+
+n=filt_pass.*fftshift(h);//Multiply the Original Spectrum with the Filter Mask.
+Image_filter=real(ifft(fftshift(n)));
+Image_filter=mat2gray(Image_filter)
+figure,ShowImage(Image_filter,'Filtered Image');
+title('Filtered Image (Noise Pattern) with Specific Cut-Off Frequency','color','blue','fontsize',4);
+
+
+
+
+
+
|