資源簡介
基于Matlab的KL變換程序。有對應的解釋說明,圖像自選。

代碼片段和文件信息
f?=?imread(‘newlena.jpg‘);
%f?=?rgb2gray(f);
[MN]?=?size(f);
f?=?im2double(f);
f1?=?f;
m?=?mean(f12);%均值
c?=?cov(f1‘);%協方差
[BD]?=?eig(c);%特征向量
[Dsindex]=sort(diag(D)‘descend‘);%對特征向量進行排序
B?=?B(:index);%排序
B?=?B‘;%轉置
m=repmat(m1N);%復制平鋪
%歸一化
b?=?sqrt(sum(B.*B2));
b?=?repmat(b1N);
A?=?B./b;
%主分量
g?=?A*(f1-m);
%重建圖像
figure
subplot(221);
img1?=?klf(Af1m8);
imshow(img1);
title(‘8維‘);
subplot(222)
img2?=?klf(Af1m16);
imshow(img2);
title(‘16維‘);
subplot(223)
img3?=?klf(Af1m32);
imshow(img3);
title(‘32維‘);
subplot(224);
img4?=?klf(Af1m64);
imshow(img4);
title(‘64維‘);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????684??2019-04-16?20:47??KLtransform.m
-----------?---------??----------?-----??----
??????????????????684????????????????????1
- 上一篇:基于Multisim 12.0的數字時鐘
- 下一篇:BCD碼優先編碼電路設計
評論
共有 條評論