文档介绍:PCA 人脸识别算法 Matlab 版
2010-11-18 19:30
数据准备
function T = CreateDatabase(TrainDatabasePath)
Align a set ofaces.
%
% Description:
This function
gets a 2D
matrix,
containing
all
training
image
vectors
% and
returns 3 outputs
which
are
extracted
from
training
database.
%
% Argument:
T
- A
2D
matrix,
containing
all
1D
image
vectors.
%
Suppose
all
P
images
in
the
training
database
%
have
the
same
size
of
MxN.
So
the
length
of
1D
%
column
vectors
is
M*N
and 'T' will
be
a MNx P
2D matrix.
%
% Returns:
m
- (M*Nx1)
Mean
of
the
training
database
%
Eigenfaces
- (M*Nx(P-1))
Eigen
vectors
of
the
covariance
matrix
of the training
database
%
A
- (M*NxP)
Matrix
of centered
image
vectors
%
% See
also:
EIG
% Original
version
by
Amir
Hossein
Omidvarnia,
October
2007
%
Email:
******@
%%%%%%%%%%%%%%%%%%%%%%%% Calculating the mean image
m = mean(T,2); % Computing the average face image m = (1/P)*s