资源简介
针对传统小波阈值函数的缺点,提出改进的阈值函数,代码实现
代码片段和文件信息
% 软阈值,硬阈值及改进的阈值小波图像去噪方法比较
% 采用全局阈值,各层的阈值一样
%% ==============初始化======
clcclear;close all;
I = imread(‘lena.jpg‘);
I_noise = imnoise(I‘gaussian‘00.06);
I1_noise = double(I_noise);
figure(‘color‘‘w‘);
imshow(I);title(‘Original Image‘)
figure(‘color‘‘w‘);
imshow(I_noise);title(‘Noisy Image‘);axis square;
w = ‘bior2.4‘;%小波类型
N = 2;%层数
% ------ 小波分解 ---
[cs] = wavedec2(I1_noiseNw);%s=n+2行
% --------小波阈值获取--------
c1 = c;
i = prod(s(1:))+1:length(c);
h = length(c)-prod(s(N+1:));%D(1)的起点位置,即HH1
delta = median(abs(c(h:end)))/0.6745;%最高细节子带小波系数绝对中值,即HH1噪声标准差
[m1n1] = size(I);
n = prod([m1 n1]);
thr = delta*sqrt(2*log(n));
%% ======软阈值去噪==============
sorh = ‘s‘;
c1(i) = wthresh(c(i)sorhthr); %
% 阈值去噪
Id = waverec2(c1sw);
% [thrsorhkeepapp] = ddencmp(‘den‘‘wv‘I1_noise);
% Id = wdencmp(‘gbl‘cswNthrsorhkeepapp);
figure(‘color‘‘w‘);
imshow(uint8(Id));title(‘soft denoisy Image‘)axis off;
%% =======硬阈值去噪结果==========
sorh = ‘h‘;
c2 = c;
c2(i) = wthresh(c(i)sor
- 上一篇:matlab程序信噪比
- 下一篇:QPSK调制解调+误码率统计+成型滤波+匹配滤波
评论
共有 条评论