函数wdencmp
功能:小波去噪,得到去噪后的图像
[XC,CXC,LXC,PERF0,PERFL2] = WDENCMP('gbl',X,'wname',N,THR,SORH,KEEPAPP) 其中XC为去噪后的图像信号
在wdencmp中通过xc = waverec2(cxc,lxc,w) ,重构函数得到信号xc
Waverec2如何工作的呢?
X = W A VEREC2(C,S,'wname') reconstructs the matrix X
based on the multi-level wavelet decomposition structure
[C,S]
利用经过阈值处理过得系数C和它对应的长度S按照分解时选择的小波来重构;Waverec2涉及到的函数x = appcoef2(c,s,varargin{:},0)
Appcoef2函数得到x的方法:x= idwt(a,d,Lo_R,Hi_R,l(imax-p)),综合滤波器重构
Idwt中包含了上采用和卷积函数upsconv1
x = upsconv1(a,Lo_R,lx,dwtEXTM,shift) + upsconv1(d,Hi_R,lx,dwtEXTM,shift);
里面分别调用了采样函数和卷积函数
完成!!
函数wavedec2
功能:返回N层小波分解系数,使用指定滤波器
[C,S] = WA VEDEC2(X,N,'wname') returns the wavelet decomposition of the matrix X at level N,using the wavelet named in string 'wname' ,输出C小波系数,S是对应的系数长度;Wavedec2中通过dwt获得低频系数和小波系数
for i=1:n
[x,h,v,d] = dwt2(x,Lo_D,Hi_D); % decomposition
c = [h(:)' v(:)' d(:)' c]; % store details
s = [size(x);s]; % store size
end
% Last approximation.
c = [x(:)' c];
s = [size(x) ; s];
Dwt2函数如何实现此功能?包含卷积conv2和下采样convdown函数
根据二维mallat变换
输入信号先与滤波器卷积conv2,再下采样得到系数[x,h,v,d] ;
Mallat算法,图像先小波分解。
经上面的低通滤波器后下采样(抽取某些位置的值)得到低频系数,经下面高通滤波器下采样后得到高频系数;
重构过程,上采样(在指定位置填0)后经过综合滤波器相加后得到去噪信号
不同滤波器(db,sym,bior)的分解和重构时得到的低通滤波器和高通滤波器
[F1,F2] = WFILTERS('wname','type') returns the following
filters:
LO_D and HI_D if 'type' = 'd' (Decomposition filters)
LO_R and HI_R if 'type' = 'r' (Reconstruction filters)
LO_D and LO_R if 'type' = 'l' (Low-pass filters)
HI_D and HI_R if 'type' = 'h' (High-pass filters)
客观评价峰值信噪比。