filename=uigetfile('.jpg');I=imread(filename);I=imresize(I,[256 256]);figure,imshow(I);title('input image')%----imnoise
I_n=I;J=zeros(size(I_n));for iclr=1:3I_n = I(:,:,iclr);[m n]=size(I_n);BH=imhist(I_n);[v p1]=max(BH);pn=find(BH~=v);[v p2]=max(BH(pn));s_p=[p1-1 p2-1];I_sp=zeros([m n]);sp1=find(I_n==s_p(1));I_sp(sp1)=1;sp2=find(I_n==s_p(2));I_sp(sp2)=1;J(:,:,iclr)=I_n;for i=2:m-1 for j=2:n-1 b_3=I_n(i-1:i+1,j-1:j+1); if I_sp(i,j)==1 J(i,j,iclr)=median(double(b_3(:))); end endendend%-----filtered image
figure,imshow(uint8(J));
MATLAB: I am new to matlab can anyone please explain this lines
noise removal
Best Answer