请各位高手帮忙看看这个小波图像去噪程序
请各位高手帮忙看看这个小波图像去噪程序,能运行,但我想求图像及去噪后图像的峰值信噪比和最小均方误差I=imread('concordaerial.png');
figure(2);
subplot(3,2,1);
imshow(I);
title('原始图象');
I=rgb2gray(I);
v=0.01;
J=imnoise(I2,'gaussian',v);
subplot(3,2,2);
imshow(J);
title('含噪图象');
=wavedec2(J,3,'db4');
n=;
p=;
nc=wthcoef2('h',C,S,n,p,'h');
nc=wthcoef2('v',C,S,n,p,'h');
nc=wthcoef2('d',C,S,n,p,'h');
I3=waverec2(nc,S,'db4');
nc2=wthcoef2('h',C,S,n,p,'s');
nc2=wthcoef2('v',C,S,n,p,'s');
nc2=wthcoef2('d',C,S,n,p,'s');
I4=waverec2(nc2,S,'db4');
subplot(3,2,3);
imshow(I3);
title('硬阈值去噪后的图象');
subplot(3,2,4);
imshow(I4);
title('软阈值去噪后的图象');
%求CA3.CH3.CV3.CD3经阈值处理后的系数
for j=1:5776
T3=0.22800447;
N=5000;
if abs(C(1,j))<T3
C(1,j)=0;
else
k1=abs(C(1,j));
k2=exp(sqrt(C(1,j)*C(1,j)-T3*T3)/N);
u3=T3/(k1*k2);
C(1,j)=(1-u3)*C(1,j)+u3*sign(C(1,j))*;
end
end
%求CH2.CV2.CD2经阈值处理后的系数
for j=5777:20059
T2=0.45600894;
N=5000;
if abs(C(1,j))<T2
C(1,j)=0;
else
k1=abs(C(1,j));
k2=exp(sqrt(C(1,j)*C(1,j)-T2*T2)/N);
u2=T2/(k1*k2);
C(1,j)=(1-u3)*C(1,j)+u3*sign(C(1,j))*;
end
end
%求CH1.CV1.CD1经阈值处理后的系数
for j=20060:71542
T1=0.91201787;
N=5000;
if abs(C(1,j))<T1
C(1,j)=0;
else
k1=abs(C(1,j));
k2=exp(sqrt(C(1,j)*C(1,j)-T1*T1)/N);
u1=T1/(k1*k2);
C(1,j)=(1-u1)*C(1,j)+u1*sign(C(1,j))*;
end
end
I5=waverec2(C,S,'db4');
subplot(3,2,5);
imshow(I5);
title('阈值去噪后的图象');
页:
[1]