pcafea.m

来自「matlab获取PCA特征的小程序」· M 代码 · 共 20 行

M
20
字号
%this function is used to obtain PCA feature of a single image
%feature:   obtained pca feature of the immat as return value (m*1 vector)
%immat:     the image wati to be processed (n*1 vector)
%averface:  average face as parameter (n*1 vector)
%eigenface: eigenface as parameter (n*m matrix)

function feature=pcafea(immat,averface,eigenface)

[idim,iline] = size(immat);
[adim,aline] = size(averface);
[edim,eline] = size(eigenface);

if ( idim~=adim | edim~=adim | idim~=edim )
   fprintf(1,'Input parameter error when calculating pca feature!');
   pause
end

differ  = immat - averface;
feature = eigenface'*differ;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?