『壹』 小波阈值去噪MATLAB
不知道怎么改啊,我也在做小波去噪,是对信号进行处理,可是出来的结果不对
『贰』 急~!求助 matlab小波图像去噪的源程序...处理.bmp格式的图像....真的很急!!!邮箱:[email protected] ...
%利用小波变换对8位灰度图像进行去噪去噪处理,最后显示信噪比和均方误差
clear all;clc;
A=imread('d:/photo/fabric/cd4 - 复制.bmp');
subplot(121),imshow(A);title('original imge');
[m,n]=size(A);
A=double(A);
%选取分解小波
display('选择分解的小波:');
display('enter 1 for haar wavelet');
display('enter 2 for db2 wavelet');
display('enter 3 for db4 wavelet');
display('enter 4 for sym wavelet');
display('enter 5 for sym wavelet');
display('enter 6 for bior wavelet');
display('enter 7 for bior wavelet');
display('enter 8 for mexh wavelet');
display('enter 9 for coif wavelet');
display('enter 10 for meyr wavelet');
display('enter 11 for morl wavelet');
display('enter 12 for rbio wavelet');
display('press any key to quit');
ww=input('enter your choice: ');
switch ww
case 1
wv='haar';
case 2
wv='db2';
case 3
wv='db4' ;
case 4
wv='sym2'
case 5
wv='sym4';
case 6
wv='bior1.1';
case 7
wv='bior6.8';
case 8
wv='mexh';
case 9
wv='coif5';
case 10
wv='dmey';
case 11
wv='mor1';
case 12
wv='jpeg9.7';
otherwise
quit;
end
%选取分解的层数
display('选择分解层数:');
levels=input('enter 1 or 2 : ');
filtertype=wv;
[C,S]=wavedec2(A,levels,filtertype); %小波分解
var=length(C)-S(size(S,1)-1,1)^2+1;
%{
%第一中去噪方法:用此种方法时,效果与选取分解的层数没有关系,只与选取的小波有关系
C(var:length(C))=0; %将对角线的高频系数置零
B=waverec2(C,S,filtertype); %重构图像
%}
%{
%第二种去噪方法:贝叶斯阈值去噪,对各个高频系数进行贝叶斯阈值去噪
display('选择软阈值或者硬阈值:');
display('enter 1 for soft thresholding');
display('enter 2 for hard thresholding');
sorh=input('sorh: ');
sigmahat=median(abs(C(var:length(C))))/0.6745; %Calculating sigmahat
st=(S(1,1)^2)+1; %低频系数的个数
bayesC=[C(1:st-1),zeros(1,length(st:1:length(C)))]; %只是保留低频信息
for jj=2:size(S,1)-1 %行数
%对于水平高频系数
coeh=C(st:st+S(jj,1)^2-1);
thr=bayes(coeh,sigmahat);
if sorh==1
bayesC(st:st+S(jj,1)^2-1)=sthresh(coeh,thr);
end
if sorh==2
bayesC(st:st+S(jj,1)^2-1)=hthresh(coeh,thr);
end
st=st+S(jj,1)^2;
%对于垂直高频系数
coev=C(st:st+S(jj,1)^2-1);
thr=bayes(coev,sigmahat);
if sorh==1
bayesC(st:st+S(jj,1)^2-1)=sthresh(coev,thr);
end
if sorh==2
bayesC(st:st+S(jj,1)^2-1)=hthresh(coev,thr);
end
st=st+S(jj,1)^2;
%对于对角高频系数
coed=C(st:st+S(jj,1)^2-1);
thr=bayes(coed,sigmahat);
if sorh==1
bayesC(st:st+S(jj,1)^2-1)=sthresh(coed,thr);
end
if sorh==2
bayesC(st:st+S(jj,1)^2-1)=hthresh(coed,thr);
end
st=st+S(jj,1)^2;
end
B=waverec2(bayesC,S,filtertype); %重构图像
%}
%{
%第三种方法:采用Donoho和Johnstone提出的固定阈值的方法进行去噪处理
display('选择软阈值或者硬阈值:');
display('enter 1 for soft thresholding');
display('enter 2 for hard thresholding');
sorh=input('sorh: ');
st=(S(1,1)^2)+1; %低频系数的个数
djC=[C(1:st-1),zeros(1,length(st:1:length(C)))]; %只是保留低频信息
for jj=2:size(S,1)-1 %行数
%对于水平高频系数
coeh=C(st:st+S(jj,1)^2-1);
sigmah=median(abs(coeh))/0.6745;
thr=sigmah*sqrt(2*log10(length(coeh)));
if sorh==1
djC(st:st+S(jj,1)^2-1)=sthresh(coeh,thr);
end
if sorh==2
djC(st:st+S(jj,1)^2-1)=hthresh(coeh,thr);
end
st=st+S(jj,1)^2;
%对于垂直高频系数
coev=C(st:st+S(jj,1)^2-1);
sigmav=median(abs(coev))/0.6745;
thr=sigmav*sqrt(2*log10(length(coev)));
if sorh==1
djC(st:st+S(jj,1)^2-1)=sthresh(coev,thr);
end
if sorh==2
djC(st:st+S(jj,1)^2-1)=hthresh(coev,thr);
end
st=st+S(jj,1)^2;
%对于对角高频系数
coed=C(st:st+S(jj,1)^2-1);
sigmad=median(abs(coed))/0.6745;
thr=sigmav*sqrt(2*log10(length(coed)));
if sorh==1
djC(st:st+S(jj,1)^2-1)=sthresh(coed,thr);
end
if sorh==2
djC(st:st+S(jj,1)^2-1)=hthresh(coed,thr);
end
st=st+S(jj,1)^2;
end
B=waverec2(djC,S,filtertype); %重构图像
%}
subplot(122),imshow(uint8(B));title('de-noised image');
%imwrite(B,'fab5.bmp'); %保存图像在m文件的路径中
%计算信噪比
t=0;
for i=1:m
for j=1:n
t=t+(abs(B(i,j)-A(i,j)))^2;
end
end
mse=t/(m*n); %图像均方误差
psnr=10*log10((255^2)/mse); %峰值信噪比
display('mse:');
mse
display('psnr:');
psnr
『叁』 小波阈值图像去噪程序为什么每次运行类似程序都有这个结果
File "barbara.png" does not exist. Error in ==> wavedenoise_main at 5意思是在主程序wavedenoise_main 第五行出错,出错原因是barbara.png文件不存在;
解决方法:第一种方法:你可以把文件barbara.png放在主程序wavedenoise_main这个文件夹;
第二种方法:im=imread('barbara.png'); 改为im=imread('路径\barbara.png'); 路径即为你图片存放的路径如:d:image\..\
『肆』 matlab中的小波工具箱怎么用,希望能详细介绍
将原始数据文件夹到装有matlab的电脑
打开matlab软件,进入软件主界面
在软件的左下方找到start按钮,点击选择toolbox,然后选择wavelet
进入wavemenu界面,选择一维小波中的wavelet1-D并进入
5.将数据文件(.Mat格式)托到matlab软件主界面的workspace
6.在wavemenu主界面中选择file-load signal或者import from workspace—import signal
7.选择要处理的信号,界面出现loaded信号,这就是没有去噪前的原
始信号
8.右上角选择用于小波分析的小波基以及分解层数并点击analyse开始分析
9.分析后在左边栏目中出现s,a*,d*,其中s为原信号,a*为近似信号,d*为细节信号
10.然后点击denoise去噪
11.阈值方法常用的有4种fixed(固定阈值),rigorsure,heusure,minmax根据需要选择,一般情况下rigorsure方式去噪效果较好
12.oft(软阈值),hard(硬阈值)一般选择软阈值去噪后的信号较为平滑
13.在噪声结构中选择unscaled white noise,因为在工程应用中的噪声一般不仅仅含有白噪声
14.在噪声结构下面的数值不要随意改,这是系统默认的去噪幅度
15.点击denoise开始正式去噪
16.在此窗口下点击file-save denoised singal,保存输出去噪后的信号
17.去噪结束
18.去噪结束后,把去噪后信号(.mat格式)拖至matlab主界面的workspace中,与原信号一起打包,以便以后计算统计量
19.Matlab编程计算相关统计量以及特征量
20.得出统计量和特征量后结束
『伍』 Matlab中的小波分析工具箱电子书txt全集下载
Matlab中的小波分析工来具箱 txt全集小说源附件已上传到网络网盘,点击免费下载:
内容预览:
『陆』 谁有比较新版本的小波工具箱wavelet toolbox能分享一下吗
首先,将下载的工具箱文件解压,将文件夹复制到MATLAB安装目录下toolbox文件夹下。
其次,在版MATLAB命令行中输入权如下命令: >>cd D:\MATLAB7\toolbox\piotr_toolbox % 找到你的工具箱 >> addpath(genpath('D:\MATLAB7\toolbox\piotr_toolbox')) %。
『柒』 跪求用MATLAB编写的关于小波变换的阈值图像去噪方法的程序
去找一些国外的博士或是研究生的论文,自己改改就可以了。很简单的。
『捌』 用matlab实现基于边缘检测的图象小波阈值去噪方法
Press the "Start" button to see a demonstration of
denoising tools in the Wavelet Toolbox.
This demo uses Wavelet Toolbox functions.
% Set signal to noise ratio and set rand seed.
sqrt_snr = 3; init = 2055615866;
% Generate original signal and a noisy version adding
% a standard Gaussian white noise.
[xref,x] = wnoise(3,11,sqrt_snr,init);
% Denoise noisy signal using soft heuristic SURE thresholding
% and scaled noise option, on detail coefficients obtained
% from the decomposition of x, at level 5 by sym8 wavelet.
% Generate original signal and a noisy version adding
% a standard Gaussian white noise.
lev = 5;
xd = wden(x,'heursure','s','one',lev,'sym8');
% Denoise noisy signal using soft SURE thresholding.
xd = wden(x,'rigrsure','s','one',lev,'sym8');
% Denoise noisy signal using fixed form threshold with
% a single level estimation of noise standard deviation.
xd = wden(x,'sqtwolog','s','sln',lev,'sym8');
% Denoise noisy signal using fixed minimax threshold with
% a multiple level estimation of noise standard deviation.
xd = wden(x,'minimaxi','s','sln',lev,'sym8');
% If many trials are necessary, it is better to perform
% decomposition one time and threshold it many times :
% decomposition.
[c,l] = wavedec(x,lev,'sym8');
% threshold the decomposition structure [c,l].
xd = wden(c,l,'minimaxi','s','sln',lev,'sym8');
% Load electrical signal and select a part.
load leleccum; indx = 2600:3100;
x = leleccum(indx);
% Use wdencmp for signal de-noising.
% find default values (see ddencmp).
[thr,sorh,keepapp] = ddencmp('den','wv',x);
% denoise signal using global thresholding option.
xd = wdencmp('gbl',x,'db3',2,thr,sorh,keepapp);
% Some trial examples without commands counterpart.
% Rand initialization: init = 2055615866;
% Square root of signal to noise ratio: sqrt_snr = 5;
% [xref,x] = wnoise(1,11,sqrt_snr,init);
% Some trial examples without commands counterpart (more).
% Rand initialization: init = 2055615866;
% Square root of signal to noise ratio: sqrt_snr = 4;
% [xref,x] = wnoise(2,11,sqrt_snr,init);
% Some trial examples without commands counterpart (more).
% Rand initialization: init = 2055615866;
% Square root of signal to noise ratio: sqrt_snr = 3;
% [xref,x] = wnoise(3,11,sqrt_snr,init);
% Some trial examples without commands counterpart (more).
% Rand initialization: init = 2055615866;
% Square root of signal to noise ratio: sqrt_snr = 3;
% [xref,x] = wnoise(3,11,sqrt_snr,init);
% Some trial examples without commands counterpart (more).
% Rand initialization: init = 2055615866;
% Square root of signal to noise ratio: sqrt_snr = 3;
% [xref,x] = wnoise(3,11,sqrt_snr,init);
% Some trial examples without commands counterpart (more).
% Rand initialization: init = 2055615866;
% Square root of signal to noise ratio: sqrt_snr = 3;
% [xref,x] = wnoise(3,11,sqrt_snr,init);
『玖』 要对图像进行小波变换去噪,可以用哪些图像处理库(C/C++)
1.最简单的方法:
public static String reverse1(String str)
{
return new StringBuffer(str).reverse().toString();
}
2.最常用的方法:
public static String reverse3(String s)
{
char[] array = s.toCharArray();
String reverse = ""; //注意这是空串,不是null
for (int i = array.length - 1; i >= 0; i--)
reverse += array[i];
return reverse;
}
3.常用方法的变形:
public static String reverse2(String s)
{
int length = s.length();
String reverse = ""; //注意这是空串,不是null
for (int i = 0; i < length; i++)
reverse = s.charAt(i) + reverse;//在字符串前面连接, 而非常见的后面
return reverse;
}
4.C语言中常用的方法:
public static String reverse5(String orig)
{
char[] s = orig.toCharArray();
int n = s.length - 1;
int halfLength = n / 2;
for (int i = 0; i <= halfLength; i++) {
char temp = s[i];
s[i] = s[n - i];
s[n - i] = temp;
}
return new String(s); //知道 char数组和String相互转化
}
『拾』 求助matlab中的小波工具包
打开matlab软件,进入软件主界面在软件的左下方找到start按钮,点击选择toolbox,然后选择wavelet进入wavemenu界面,选择一维小波中的wavelet1-D并进入 7.选择要处理的信号,界面出现loaded信号,这就是没有去噪前的原9.分析后在左边栏目中出现s,a*,d*,其中s为原信号,a*为近似信号,d*为细节信号11.阈值方法常用的有4种fixed(固定阈值),rigorsure,heusure,minmax根据需要选择,一般情况下rigorsure方式去噪效果较好12.oft(软阈值),hard(硬阈值)一般选择软阈值去噪后的信号较为平滑13.在噪声结构中选择unscaled white noise,因为在工程应用中的噪声一般不仅仅含有白噪声14.在噪声结构下面的数值不要随意改,这是系统默认的去噪幅度16.在此窗口下点击file-save denoised singal,保存输出去噪后的信号18.去噪结束后,把去噪后信号(.mat格式)拖至matlab主界面的workspace中,与原信号一起打包,以便以后计算统计量不会用就查帮助文档啊!waverec函数是不需要你自己加零延拓的,上面的代码完全不知所谓,waverec函数的使用是要依赖wavedec函数得到的CL组构的,CL组构中存放小波系数的数组C本身就已经延拓了,而且你不知道它对数据延拓了多少,延拓的方式有多种根本不是你这样直接加零就行的。我发现你很有才,经常提问和编出一些匪夷所思的问题和代码,不耻下问的精神是好的,但我个人是很不提倡这种做法的,有时间在这打字提问,不如找几本基础参考书看看,不了解就查吗,不明白就往明白搞吗,但看你这些“新奇”的问题和代码真很抓狂,自己对于这些基本问题都懒得琢磨,打着勤奋好学,不耻下问的幌子,太没劲了!哦,看错了,waverec函数是可以用上面的代码的,我看成wrcoef函数了,wrcoef函数可以实现waverec、upwlev和upcoef三个函数的功能之和,所以比waverec函数应用简单,不需要你将其他分量置零,用它实现小波工具箱功能最方便。