clc; clear all; close all; a=imread('cameraman.tif'); figure(1),imshow(a),title('origanal image'); b=imnoise(a,'salt & pepper',.02) figure(2),imshow(b),title('noisy image'); Smax=9; for i=1:254 for j=1:254 n=b(i:i+2,j:j+2) Zmin=min(n(:)); Zmax=max(n(:)); Zmed=median(n(:)); sx=3; sy=3; A1=Zmed-Zmin; A2=Zmed-Zmax; if (A1>0) && (A2<0) B1 = Zxy-Zmin; B2 = Zxy-Zmax; if (B1>0) && (B2<0) b(i:i+2,j:j+2) = n(i, j); break; else b(i:i+2,j:j+2) = Zmed; break; end else sx=sx+2; sy=sy+2; if (sx > Smax) && (sy > Smax) b(i:i+2,j:j+2) = n(i, j); end end end end figure(3),imshow(b),title('denoised image');
? Notation Zmin = minimum gray level value in Sxy Zmax = maximum gray level value in Sxy Zmed = median of gray levels in Sxy Zxy = gray level at coordinates (x, y) Smax = maximum allowed size of Sxy ? Algorithm Level A: A1 = Zmed - Zmin A2 = Zmed - Zmax if A1 > 0 AND A2 < 0, go to level B else increase the window size if window size < Smax, repeat level A else output Zxy Level B: B1 = Zxy - Zmin B2 = Zxy - Zmax if B1 > 0 AND B2 < 0, output Zxy else output Zmed
% Determine window size. if (A1>0) && (A2<0) windowSize = standardSize; % 3 or whatever else windowSize = % your formula for bigger window end % Make the assignment. newImage(x,y) = GetMedian(x,y,windowSize)
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.