内容:
matlab编程小波变换进行图像去噪处理,包括各种软硬阈值的选取函数,%小波阈值去噪
clear all
clc;
f=imread('graylena.bmp');
f=double(f);
s=size(f);
r=imnoise2('gaussian',s(1),s(2),0,20);%填加高斯白噪声
fnoisy=f+r;
%对图像进行三层小波分解
[c,s]=wavedec2(fnoisy,3,'db8');
%cA3=appcoef2(c,s,'db8',3);
[cH3,cV3,cD3]=detcoef2('all',c,s,3);c3=[cH3,cV3,cD3];
[cH2,cV2,cD2]=detcoef2('all',c,s,2);c2=[cH2,cV2,cD2];
[cH1,cV1,cD1]=detcoef2('all',c,s,1);c1=[cH1,cV1,cD1];
%固定阈值(VisuShrink阈值):thr=delta*sqrt(2*log(n));
delta=median(abs(cD1(:)))/0.6745;
thr1c=delta*thselect(c,'minimaxi');
%thr1c=delta*3.5;
%thr1c3=delta*thselect(c3,'sqtwolog');
%thr1c2=delta*thselect(c2,