clear all; close all; clc;

f = imread('cameraman.tif');

f = im2double(f);

[m n]=size(f);

f1=zeros(m,n);

f = imnoise(f,'gaussian',0,0.1);

D = std2(f);

M = mean2(f);

for i=3:m-2

for j=3:n-2

con=0; s=0; s1=0;

for k=i-2:i+2

for p=j-2:j+2

con=con+1;

s = s+f(k,p);

s1(con)=f(k,p);

end

end

lm=s/con;

ld = std(s1);

if ld >0

f1(i,j) = f(i,j)-((D*(f(i,j)-lm)/ld));

else

f1(i,j) = f(i,j)-0;

end

end

end

figure,imshow(f);

figure,imshow(f1);

## No comments:

Post a Comment