资源描述:
《Matlab小波去噪实例》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、第四章图像增强[4,6]4.6小波去噪举例4.6.1MATLAB中用wnoise函数测试去噪算法%waveletnoise.msqrt_snr=3;init=231434;[x,xn]=wnoise(3,11,sqrt_snr,init);%WNOISEgeneratenoisywavelettestdata.%X=WNOISE(FUN,N)returnsvaluesofthetestfunctiongivenbyFUN,ona%2^Nsampleof[0,1].%[X,XN]=WNOISE(FUN,N,SQRT_SNR)returnsvaluesofthetestfunction%gi
2、venbyFUNandrescaledsuchthatstd(x)=SQRT_SNR(standard%deviation).ThereturnedvectorXNcontainsthesametestvectorXcorrupted%byanadditiveGaussianwhitenoiseN(0,1).%ThenXNhasasignal-to-noiseratioof(SQRT_SNR^2).%[X,XN]=WNOISE(FUN,N,SQRT_SNR,INIT)returnspreviousvectorsX%andXN,butthegeneratorseedissettoINIva
3、lue.subplot(3,2,1),plot(x)title('originaltestfunction')subplot(3,2,2),plot(xn)title('noisedfunction')%产生一个长为2**11点,包含高斯白噪声的正弦信号,噪声的的标准%偏差为3。lev=5;xd=wden(x,'heursure','s','one',lev,'sym8');1第四章图像增强%[XD,CXD,LXD]=WDEN(X,TPTR,SORH,SCAL,N,'wname')%returnsade-noisedversionXDofinputsignalXobtainedbythr
4、esholdingthe%waveletcoefficients.Additionaloutputarguments[CXD,LXD]arethewavelet%decompositionstructureofde-noisedsignalXD.%WDEN利用小波对一维信号进行自动降噪,就是对小波系数阈值比较后。%返回输入信号X降噪后的处理信号XD,以及XD的小波分解结构{CXD,LXD}%TPTR(containsthresholdselectionrule)='heursure',%'heursure'isanheuristicvariantofthefirstoption%(选择基
5、于Stein无偏估计理论的自适应阈的启发式改进)%SORH('s'or'h')isforsoftorhardthresholding(决定阈值的使用方式)%SCAL决定阈值是否随噪声变化:%SCAL='one'fornorescaling%SCAL='sln'for对第一层系数的层噪声分别进行估计和调整;%SCAL='mln'for对各层系数的层噪声分别进行估计和调整;%'wname'='sym8'subplot(3,2,3),plot(xd)title('Onede-noisedfunction')%利用’sym8’小波对信号分解,在分解的第5层上,利用启发式SURE%阈值选择法对信号
6、去噪。xd=wden(x,'heursure','s','sln',lev,'sym8');%'sln'forrescalingusingasingleestimation%oflevelnoisebasedonfirstlevelcoefficients(根据第一层小波分解的噪声方%差调整阈值)subplot(3,2,4),plot(xd)title('Slnde-noisedfunction')2第四章图像增强%同上’sym8’小波对信号分解条件,但用软SURE阈值选择算法对信%号去噪。xd=wden(x,'sqtwolog','s','sln',lev,'sym8');%forun
7、iversalthresholdsqrt(2*log(.))(固定阈值选择算法去噪).subplot(3,2,5),plot(xd)title('Sqtwologde-noisedfunction')%同上’sym8’小波对信号分解条件,但用固定阈值选择算法去噪。[c,l]=wavedec(x,lev,'sym8');%WAVEDECperformsamultilevel1-Dwaveletanalysisusingeitheras