資源描述:
《Matlab小波去噪實例》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在學(xué)術(shù)論文-天天文庫。
1、第四章圖像增強[4,6]4.6小波去噪舉例4.6.1MATLAB中用wnoise函數(shù)測試去噪算法%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')%產(chǎn)生一個長為2**11點,包含高斯白噪聲的正弦信號,噪聲的的標(biāo)準(zhǔn)%偏差為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利用小波對一維信號進行自動降噪,就是對小波系數(shù)閾值比較后。%返回輸入信號X降噪后的處理信號XD,以及XD的小波分解結(jié)構(gòu){CXD,LXD}%TPTR(containsthresholdselectionrule)='heursure',%'heursure'isanheuristicvariantofthefirstoption%(選擇基
5、于Stein無偏估計理論的自適應(yīng)閾的啟發(fā)式改進)%SORH('s'or'h')isforsoftorhardthresholding(決定閾值的使用方式)%SCAL決定閾值是否隨噪聲變化:%SCAL='one'fornorescaling%SCAL='sln'for對第一層系數(shù)的層噪聲分別進行估計和調(diào)整;%SCAL='mln'for對各層系數(shù)的層噪聲分別進行估計和調(diào)整;%'wname'='sym8'subplot(3,2,3),plot(xd)title('Onede-noisedfunction')%利用’sym8’小波對信號分解,在分解的第5層上,利用啟發(fā)式SURE%閾值選擇法對信號
6、去噪。xd=wden(x,'heursure','s','sln',lev,'sym8');%'sln'forrescalingusingasingleestimation%oflevelnoisebasedonfirstlevelcoefficients(根據(jù)第一層小波分解的噪聲方%差調(diào)整閾值)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