資源簡介
包含K-SVD和MOD兩種算法對信號和圖像處理代碼例子。使用DCT字典,使用OMP算法計算稀疏系數。

代碼片段和文件信息
%============================================================
%???????????????demo2?-?denoise?an?image
%?this?is?a?run_file?the?demonstrate?how?to?denoise?an?image?
%?using?dictionaries.?The?methods?implemented?here?are?the?same
%?one?as?described?in?“Image?Denoising?Via?Sparse?and?Redundant
%?representations?over?Learned?Dictionaries“?(appeared?in?the?
%?IEEE?Trans.?on?Image?Processing?Vol.?15?no.?12?December?2006).
%?============================================================
clear
bb=8;?%?block?size
RR=4;?%?redundancy?factor??冗余因素
K=RR*bb^2;?%?number?of?atoms?in?the?dictionary
sigma?=?50;?
%pathForImages?=‘‘;
%imageName?=?‘barbara.png‘;
%???[IMin0pp]=imread(‘cameraman.tif‘);
?[IMin0pp]=imread(‘w.jpg‘);
IMin0=im2double(IMin0);
if?(length(size(IMin0))>2)
????IMin0?=?rgb2gray(IMin0);
end
if?(max(IMin0(:))<2)
????IMin0?=?IMin0*255;
end
IMin=IMin0+sigma*randn(size(IMin0));%%%%%%此處有隨機函數
PSNRIn?=?20*log10(255/sqrt(mean((IMin(:)-IMin0(:)).^2)));
%?%==========================================================================
%?%???P?E?R?F?O?R?M???D?E?N?O?I?S?I?N?G???U?S?I?N?G???O?V?E?R?C?O?M?P?L?E?T?E?
%?%????????????????????????D?C?T????D?I?C?T?I?O?N?A?R?Y
%?%==========================================================================
%?tic
%?[IoutDCToutputCoefs]?=?denoiseImageDCT(IMin?sigma?K);
%?
%?PSNROut?=?20*log10(255/sqrt(mean((IoutDCT(:)-IMin0(:)).^2)));
%?figure;
%?subplot(131);?imshow(IMin0[]);?title(‘Original?clean?image‘);
%?subplot(132);?imshow(IMin[]);?title(strcat([‘Noisy?image?‘num2str(PSNRIn)‘dB‘]));
%?subplot(133);?
%?imshow(IoutDCT[]);?title(strcat([‘Clean?Image?by?DCT?dictionary?‘num2str(PSNROut)‘dB‘]));
%?figure;
%?I?=?displayDictionaryElementsAsImage(output.D?floor(sqrt(K))?floor(size(output.D2)/floor(sqrt(K)))bbbb0);%當不輸入0時,效果不一樣,具體的看內部代碼
%?title(‘The?DCT?dictionary‘);
%?toc
%==========================================================================
%???P?E?R?F?O?R?M???D?E?N?O?I?S?I?N?G???U?S?I?N?G???G?L?O?B?A?L?
%???????????(?O?R???G?I?V?E?N?)???D?I?C?T?I?O?N?A?R?Y
%==========================================================================
%?tic
%?[IoutGlobaloutput]?=?denoiseImageGlobal(IMin?sigmaK);
%?
%?PSNROut?=?20*log10(255/sqrt(mean((IoutGlobal(:)-IMin0(:)).^2)));
%?figure;
%?subplot(131);?imshow(IMin0[]);?title(‘Original?clean?image‘);
%?subplot(132);?imshow(IMin[]);?title(strcat([‘Noisy?image?‘num2str(PSNRIn)‘dB‘]));
%?subplot(133);
%?imshow(IoutGlobal[]);?title(strcat([‘Clean?Image?by?Global?Trained?dictionary?‘num2str(PSNROut)‘dB‘]));
%?figure;
%?I?=?displayDictionaryElementsAsImage(output.D?floor(sqrt(K))?floor(size(output.D2)/floor(sqrt(K)))bbbb);
%?title(‘The?dictionary?trained?on?patches?from?natural?images‘);
%?toc
%==========================================================================
%???P?E?R?F?O?R?M???D?E?N?O?I?S?I?N?G???U?S?I?N?G???A???D?I?C?T??I?O?N?A?R?Y
%??????????????????T?R?A?I?N
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3779??2015-11-13?18:43??KSVD\allkindsofmethodscompare.m
?????文件??????41080??2018-01-19?16:12??KSVD\BJ200_14.BMP
?????文件????????218??2015-10-30?20:40??KSVD\DCT_test.m
?????文件???????1907??2018-03-28?16:31??KSVD\demo1.m
?????文件???????3594??2018-01-19?16:28??KSVD\demo2.m
?????文件???????8504??2006-12-28?13:57??KSVD\demo3.m
?????文件???????6840??2018-01-23?15:40??KSVD\denoiseImageDCT.m
?????文件???????6565??2018-01-23?14:12??KSVD\denoiseImageGlobal.m
?????文件??????10446??2018-03-28?16:45??KSVD\denoiseImageKSVD.m
?????文件???????4337??2018-01-22?11:42??KSVD\displayDictionaryElementsAsImage.m
?????文件???????1896??2006-12-11?14:25??KSVD\gererateSyntheticDictionaryAndData.m
?????文件????5749450??2005-09-21?08:35??KSVD\globalTrainedDictionary.mat
?????文件??????16429??2018-03-28?15:28??KSVD\KSVD.m
?????文件??????11585??2006-12-28?14:02??KSVD\KSVD_NN.m
?????文件?????263222??2015-11-04?16:05??KSVD\lena.bmp
?????文件???????8053??2006-12-12?08:35??KSVD\MOD.m
?????文件????????857??2018-01-23?13:43??KSVD\my_im2col.m
?????文件???????1105??2006-12-24?16:00??KSVD\NN_BP.m
?????文件????????954??2007-04-29?10:17??KSVD\OMP.m
?????文件???????1372??2015-11-12?17:13??KSVD\OMPerr.m
?????文件??????22408??2015-11-04?17:20??KSVD\w.jpg
????..A..H.???????162??2018-04-17?15:52??KSVD\~$表示KSVD.docx
????.....H.?????15605??2018-01-24?19:37??KSVD\~WRL1849.tmp
?????文件?????116486??2018-04-17?15:52??KSVD\稀疏表示KSVD.docx
?????目錄??????????0??2018-04-17?15:52??KSVD
-----------?---------??----------?-----??----
??????????????6296854????????????????????25
評論
共有 條評論