資源簡介
小波omp,壓縮感知程序,用于壓縮感知的認識,對初學(xué)者和很有用

代碼片段和文件信息
function?Demo_CS_CoSaMP()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%?the?DCT?basis?is?selected?as?the?sparse?representation?dictionary
%?instead?of?seting?the?whole?image?as?a?vector?I?process?the?image?in?the
%?fashion?of?column-by-column?so?as?to?reduce?the?complexity.
%?Author:?Chengfu?Huo?roy@mail.ustc.edu.cn?http://home.ustc.edu.cn/~roy
%?Reference:?D.?Deedell?andJ.?Tropp?“COSAMP:?Iterative?Signal?Recovery?from
%?Incomplete?and?Inaccurate?Samples”?2008.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------------?read?in?the?image?--------------
img=imread(‘lena.bmp‘);?????%?testing?image
img=double(img);
[heightwidth]=size(img);
%------------?form?the?measurement?matrix?and?base?matrix?---------------
Phi=randn(floor(height/3)width);??%?only?keep?one?third?of?the?original?data??
Phi?=?Phi./repmat(sqrt(sum(Phi.^21))[floor(height/3)1]);?%?normalize?each?column
mat_dct_1d=zeros(256256);??%?building?the?DCT?basis?(corresponding?to?each?column)
for?k=0:1:255?
????dct_1d=cos([0:1:255]‘*k*pi/256);
????if?k>0
????????dct_1d=dct_1d-mean(dct_1d);?
????end;
????mat_dct_1d(:k+1)=dct_1d/norm(dct_1d);
end
%---------?projection?---------
img_cs_1d=Phi*img;??????????%?treat?each?column?as?a?independent?signal
%--------?recover?using?omp?------------
sparse_rec_1d=zeros(heightwidth);????????????
Theta_1d=Phi*mat_dct_1d;
for?i=1:width
????column_rec=cs_cosamp(img_cs_1d(:i)Theta_1dheight);
????sparse_rec_1d(:i)=column_rec‘;???????????%?sparse?representation
end
img_rec_1d=mat_dct_1d*sparse_rec_1d;??????????%?inverse?transform
%------------?show?the?results?--------------------
figure(1)
subplot(221)imagesc(img)title(‘original?image‘)
subplot(222)imagesc(Phi)title(‘measurement?mat‘)
subplot(223)imagesc(mat_dct_1d)title(‘1d?dct?mat‘)
psnr?=?20*log10(255/sqrt(mean((img(:)-img_rec_1d(:)).^2)))
subplot(224)imagesc(img_rec_1d)title(strcat(‘1d?rec?img?‘num2str(psnr)‘dB‘))
disp(‘over‘)
%************************************************************************%
function?hat_x=cs_cosamp(yT_Matm)
%?y=T_Mat*x?T_Mat?is?n-by-m
%?y?-?measurements
%?T_Mat?-?combination?of?random?matrix?and?sparse?representation?basis
%?m?-?size?of?the?original?signal
%?the?sparsity?is?length(y)/4
n=length(y);???????????????????????????%?length?of?measurements
s=floor(n/4);?????????????????????????????????%?sparsity??????????????????
r_n=y;?????????????????????????????????%?initial?residuals
sig_pos_lt=[];?????????????????????????%?significant?pos?for?last?time?iteration
for?times=1:s??????????????????????????%?number?of?iterations
????
????product=abs(T_Mat‘*r_n);
????[valpos]=sort(product‘descend‘);
????sig_pos_cr=pos(1:2*s);?????????????%?significant?pos?for?curretn?iteration
????
????sig_pos=union(sig_pos_crsig_pos_lt);
????
????Aug_t=T_Mat(:sig_pos);????????????%?current?selected?entries?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3456??2010-07-16?14:45??Wavelet_OMP\Demo_CS_CoSaMP.m
?????文件???????1065??2009-10-14?18:27??Wavelet_OMP\DWT.m
?????文件??????66614??2009-06-08?18:00??Wavelet_OMP\lena256.bmp
?????文件???????2499??2009-10-14?18:13??Wavelet_OMP\Wavelet_OMP.m
?????目錄??????????0??2016-01-24?18:19??Wavelet_OMP
-----------?---------??----------?-----??----
????????????????73634????????????????????5
- 上一篇:f28335最小系統(tǒng)原理圖
- 下一篇:dxp單片機元件庫
評論
共有 條評論