資源簡介
圖像稀疏表示matlab,可用于壓縮感知
代碼片段和文件信息
?function?[Ax?]?=?KSVD(ycodebook_sizeerrGoal)
%==============================
%input?parameter
%??y?-?input?signal
%??codebook_size?-?count?of?atoms
%output?parameter
%??A?-?dictionary
%??x?-?coefficent
%==============================
%SIZ?=?size(y2);
if(size(y2)????disp(‘codebook_size?is?too?large?or?training?samples?is?too?small‘);
???return;
end
%?initialization
[rowscols]=size(y);
r=randperm(cols);???%隨機排列
A=y(:r(1:codebook_size));
A=A./repmat(sqrt(sum(A.^21))rows1);
ksvd_iter=10;
%?main?loop
for?k=1:ksvd_iter
????%?sparse?coding
????if?nargin==2
????????x=OMP(Ay5.0/6*rows);
??????
????elseif?nargin==3
????????x=OMPerr(AyerrGoal);
????end
????for?m=1:codebook_size
????????mindex=find(x(m:));
????????if?~isempty(mindex)
????????????mx=x(:mindex);
????????????mx(m:)=0;
????????????my=A*mx;
????????????resy=y(:mindex);
????????????mE=resy-my;
????????????[usv]=svds(mE1);
????????????A(:m)=u;
????????????x(mmindex)=s*v‘;
????????end
????end
end
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1057??2014-08-25?16:16??S_R\KSVD.m
?????文件???????1074??2014-08-25?11:13??S_R\MOD.m
?????文件????????536??2014-08-21?14:05??S_R\M_RGB_SPA.m
?????文件???????1662??2014-08-25?16:20??S_R\M_SPA.m
?????文件????????710??2014-06-22?15:44??S_R\OMP.m
?????文件???????1123??2014-06-22?15:40??S_R\OMPerr.m
?????目錄??????????0??2014-08-25?17:58??S_R
-----------?---------??----------?-----??----
?????????????????6162????????????????????7
- 上一篇:matlab BP神經網絡的動量梯度下降算法
- 下一篇:人臉分割matlab
評論
共有 條評論