den1.m
上传用户:lcj80317
上传日期:2007-01-26
资源大小:625k
文件大小:1k
- function X = den1(x, wname, n, thr)
- % 半软阈值去噪方法
- thr1 = 0.5 * thr;
- [C, S] = wavedec2(x, n, wname); %对图像进行小波分解
- dcoef = C( prod(S(1, :)) + 1 : end); %高频部分系数
- ind = find( abs(dcoef) < thr1) + prod(S(1, :)); %小于thr1的系数
- C(ind) = 0; % 直接置零
- ind = find( abs(dcoef) >= thr1 & abs(dcoef) < thr )...
- + prod(S(1, :)); %大于thr1小于thr的系数
- C(ind) = sign(C(ind)) .* ...
- ( (thr / (thr - thr1)) * (abs(C(ind)) - thr1) );
- % ind = find( abs(dcoef) >= thr ) + prod(S(1, :)); %大于thr的系数
- % C(ind) = sign(C(ind)) .* ( abs(C(ind)) - alpha * thr );
- X = waverec2(C, S, wname); %重构图像