?? example75_eigenvalue.m
字號:
%%%example75_eigenvalue
b0(:,1)=reshape(double(rgb2gray(img1)),32*32,1);
b0(:,2)=reshape(double(rgb2gray(img2)),32*32,1);
%caculate the eigenvalues and the eigenvectors of the cov matrix
b=(b0(:,1)+b0(:,2))/2;
B1=b0';
C=cov(B1,1);
[V,D]=eig(C);
W0=V;
[m,n]=size(b0);
for j=1:m-1
for i=1:m-j
if D(i,i)<D(i+1,i+1)
temp1=D(i,i);
D(i,i)=D(i+1,i+1);
D(i+1,i+1)=temp1;
temp2=W0(:,i);
W0(:,i)=W0(:,i+1);
W0(:,i+1)=temp2;
end
end
end
cpts=16;
i=1:cpts;
W(:,i)=W0(:,i);
T=ones(16,1);
for x=1:16
T(x)=D(x,x);
end
figure('name','前16個特征值','numbertitle','off');
x=1:16;
plot(x,T(x));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -