当前位置:首页 > 代码 > 正文

小波滤波代码(小波滤波原理)

admin 发布:2022-12-19 14:11 109


今天给各位分享小波滤波代码的知识,其中也会对小波滤波原理进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

matlab中小波滤波

Matlab之小波滤波函数 :

1 wfilters函数

[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('wname') computes four filters associated with the orthogonal or biorthogonal wavelet named in the string 'wname'. The four output filters are

Lo_D, the decomposition low-pass filter Hi_D, the decomposition high-pass filter Lo_R, the reconstruction low-pass filter

Hi_R, the reconstruction high-pass filter

2 biorfilt函数

The biorfilt command returns either four or eight filters associated with biorthogonal wavelets.

3 orthfilt函数

[Lo_D,Hi_D,Lo_R,Hi_R] = orthfilt(W) computes the four filters associated with the scaling filter W corresponding to a wavelet

4 biorwaef函数

[RF,DF] = biorwavf(W) returns two scaling filters associated with the biorthogonal wavelet specified by the string W.

5 coifwavf函数

F = coifwavf(W) returns the scaling filter associated with the Coiflet wavelet specified by the string W where W = 'coifN'. Possible values for N are 1, 2, 3, 4, or 5

6 dbaux函数

W = dbaux(N,SUMW) is the order N Daubechies scaling filter such that sum(W) = SUMW. Possible values for N are 1, 2, 3, ...

W = dbaux(N) is equivalent to W = dbaux(N,1) W = dbaux(N,0) is equivalent to W = dbaux(N,1)

7 dbwavf函数

F = dbwavf(W) returns the scaling filter associated with Daubechies wavelet specified by the string W where W = 'dbN'. Possible values for N are 1, 2, 3, ..., 45.

8 mexihat函数

[PSI,X] = mexihat(LB,UB,N) returns values of the Mexican hat wavelet on an N point regular grid, X, in the interval [LB,UB].

Output arguments are the wavelet function PSI computed on the grid X. This wavelet has [-5 5] as effective support.

急求大神帮助 相对一幅图像进行降噪处理 求能把自适应滤波和小波软阈值降噪的matlab代码

自适应滤波

clear all

I1=imread('1.jpg');

I=rgb2gray(I1);

J=imnoise(I,'gaussian',0,0.05); %添加均值为0,方差为0.05的高斯噪声

K1=wiener2(J,[5,5]);

figure

imshow(J);

title('加入高斯噪声图像');

figure

imshow(K1);

title('5*5窗口自适应滤波');

小波软阈值

clear all

I1=imread('1.jpg');

I=rgb2gray(I1);

J=imnoise(I,'gaussian',0,0.05); %添加均值为0,方差为0.05的高斯噪声

[Cr, Sr] = wavedec2(J, 2, 'sym4');

thr= Donoho(J);

J_soft = wdenoise(xr, 'gbl', 's', thr, 'sym4', 2);

figure; imshow(J_soft);

/////////////////////////////////用到的函数

function thr = Donoho(x)

%用Donoho通用阈值公式计算阈值 x为要进行处理的图像

% thr = delta * sqrt( 2 * log(n))

% n为信号的长度或尺寸

% delta = MAD / 0.6745 -经验公式,其中MAD为小波分解后高子带系数的中值

n = prod( size(x) ); %图像尺寸

%计算delta

[C, S] = wavedec2(x, 1, 'db1'); %小波分解

d = C( prod( S(1,:) ) + 2 * prod( S(2,:) ) + 1 : end); %HH子带系数

delta = median( abs(d) ) / 0.6745;

%计算阈值

thr = delta * sqrt(2*log(n));

////////////////////////////////////用到的函数

function X = wdenoise(x, measure, sorh, thr, wname, n)

% 阈值去噪函数

% x为带噪声图像

% measure表示全局或局部

% sorh表示软硬阈值方法

% thr为阈值

% wname为小波函数名

% n为分解层次

[C, S] = wavedec2(x, n, wname); % 对图像进行小波分解

switch measure

case 'gbl' % 全局阈值方法

dcoef = C( prod(S(1, :)) + 1 : end); % 提取细节部分系数

switch sorh

case 'h' % 硬阈值

dcoef = dcoef .* (abs(dcoef) thr);

case 's' % 软阈值

temp = abs(dcoef) - thr;

temp = (temp + abs(temp)) / 2;

dcoef = sign(dcoef) .* temp;

end

C( prod(S(1, :)) + 1 : end) = dcoef;

case 'lvd' % 局部阈值方法

for i = n:-1:1 % 每层单独处理

k = size(S,1) - i;

first = prod(S(1, :)) + ...

3 * sum(S(2:k-1, 1) .* S(2:k-1, 2)) + 1;

% 第i层细节系数的起始位置

last = first + 3*prod(S(k,:)) - 1; % 终止位置

dcoef = C(first : last); % 细节系数

switch sorh

case 'h' % 硬阈值

dcoef = dcoef .* (abs(dcoef) thr(i));

case 's' % 软阈值

temp = abs(dcoef) - thr(i);

temp = (temp + abs(temp)) / 2;

dcoef = sign(dcoef) .* temp;

end

C(first:last) = dcoef;

end

end

X = waverec2(C, S, wname); % 重构图像

小波变换法图像去除高斯噪声椒盐噪声的matlab代码

I=imread('**.bmp');

I=rgb2gray(I);

J=imnoise(I,'saltpepper',0.02);

subplot(231),imshow(I);title('原图像');

subplot(232),imshow(J);title('添加椒盐噪声图像');

k3=medfilt2(J,[7,7]); %进行7*7模板中值滤波

subplot(235),imshow(k3);title('7*7模板中值滤波');

小波滤波代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于小波滤波原理、小波滤波代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/9223.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载