• 大小: 618B
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-20
  • 语言: Matlab
  • 标签: eigenface  

资源简介

做人脸识别常用到的基本算法,提取特征脸的较好算法,用matlab实现

资源截图

代码片段和文件信息

function [disc_setdisc_valueMean_Image]=Eigenface_f(Train_SETEigen_NUM)

% the magnitude of eigenvalues of this function is corrected right !!!!!!!!!
% Centralized PCA
[NNTrain_NUM]=size(Train_SET);

if NN<=Train_NUM % for small sample size case
    
   Mean_Image=mean(Train_SET2);  
   Train_SET=Train_SET-Mean_Image*ones(1Train_NUM);
   R=Train_SET*Train_SET‘/(Train_NUM-1);
   
   [VS]=Find_K_Max_Eigen(REigen_NUM);
   disc_value=S;
   disc_set=V;

else % for small sample size case
    
   Mean_Image=mean(Train_SET2);  
   Train_SET=Train_SET-Mean_Image*ones(1Train_NUM);

  R=Train_SET‘*Train_SET/(Train_NUM-1);
  
  [VS]=Find_K_Max_Eigen(REigen_NUM);
  disc_value=S;
  disc_set=zeros(NNEigen_NUM);
  
  Train_SET=Train_SET/sqrt(Train_NUM-1);
  for k=1:Eigen_NUM
    disc_set(:k)=(1/sqrt(disc_value(k)))*Train_SET*V(:k);
  end

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [Eigen_VectorEigen_Value]=Find_K_Max_Eigen(MatrixEigen_NUM)

[NNNN]=size(Matrix);
[VS]=eig(Matrix); %Note this is equivalent to; [VS]=eig(StSL); also equivalent to [VS]=eig(SnSt); %

S=diag(S);
[Sindex]=sort(S);

Eigen_Vector=zeros(NNEigen_NUM);
Eigen_Value=zeros(1Eigen_NUM);

p=NN;
for t=1:Eigen_NUM
    Eigen_Vector(:t)=V(:index(p));
    Eigen_Value(t)=S(p);
    p=p-1;
end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    I.A....      1521  2006-12-19 06:13  Eigenface_f.m

----------- ---------  ---------- -----  ----

                 1521                    1


评论

共有 条评论