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 /125/CH6/EX6.21 | |
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 '125/CH6/EX6.21')
-rwxr-xr-x | 125/CH6/EX6.21/Fig6_21.sce | 49 | ||||
-rwxr-xr-x | 125/CH6/EX6.21/Fig6_21_Median_Filtering_GrayImage.JPG | bin | 0 -> 19829 bytes |
2 files changed, 49 insertions, 0 deletions
diff --git a/125/CH6/EX6.21/Fig6_21.sce b/125/CH6/EX6.21/Fig6_21.sce new file mode 100755 index 000000000..aead6967b --- /dev/null +++ b/125/CH6/EX6.21/Fig6_21.sce @@ -0,0 +1,49 @@ +//Caption:Scilab code to Perform median filtering
+//Fig6.21
+//page 352
+clc;
+close;
+c = imread('E:\DIP_JAYARAMAN\Chapter6\cameraman.jpg');//SIVP toolbox
+N = input('Enter the window size');
+a = double(imnoise(c,'salt & pepper',0.2));
+[m,n] = size(a);
+b = a;
+if(modulo(N,2)==1)
+ Start = (N+1)/2;
+ End = Start;
+ limit1 = (N-1)/2;
+ limit2 = limit1;
+else
+ Start = N/2;
+ End = Start+1;
+ limit1 = (N/2)-1;
+ limit2 = limit1+1;
+end
+for i = Start:(m-End+1)
+ for j = Start:(n-End+1)
+ I =1;
+ for k = -limit1:limit2
+ for l = -limit1:limit2
+ mat(I)= a(i+k,j+1)
+ I = I+1;
+ end
+ end
+ mat = gsort(mat);
+ if(modulo(N,2)==1)
+ b(i,j) = (mat(((N^2)+1)/2));
+ else
+ b(i,j) = (mat((N^2)/2)+mat(((N^2)/2)+1))/2;
+ end
+ end
+end
+a = uint8(a);
+b = uint8(b);
+figure
+ShowImage(c,'Original Image')
+title('Original Image')
+figure
+ShowImage(a,'noisy image')
+title('noisy image')
+figure
+ShowImage(b,'Median Filtered Image')
+title('5x5 Median Filtered Image')
\ No newline at end of file diff --git a/125/CH6/EX6.21/Fig6_21_Median_Filtering_GrayImage.JPG b/125/CH6/EX6.21/Fig6_21_Median_Filtering_GrayImage.JPG Binary files differnew file mode 100755 index 000000000..b858a1054 --- /dev/null +++ b/125/CH6/EX6.21/Fig6_21_Median_Filtering_GrayImage.JPG |