⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcaclassifier.m

📁 PCA、LDA人脸检测
💻 M
字号:
function k=PCAClassifier(n,m,classcenter,x)
% PCACLASSIFIER is the implementation of the classifier based on PCA
% n denotes the dimension of the problem
% m is the number of classes
% classcenter is a matrix(n*m),classcenter(i,j) represents the i-th 
% component of the j-th class
% x is a incoming pattern
% 
% the function will return the number k into which x is classified 
if nargout>1
    error('Too many output arguments.');
end
if nargin~=4
    error('Wrong number of input arguments.');
end
[cn,cm]=size(classcenter);
if cm~=m | cn~=n
    error('Wrong input data.');
end

%从相应文件读取变换矩阵Wt
fid=fopen('pcawt','r');
[eignum,count]=fread(fid,1,'short');
[Wt,count]=fread(fid,[eignum,n],'float');
Wt=reshape(Wt,eignum,n);
fclose(fid);

k=MinDisClassifier(eignum,m,Wt*classcenter,Wt*x);

⌨️ 快捷键说明

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