Back AAM-API documentation The AAM-Site

In file AAMDeform.h:

class CAAMDeformPCA

Performs Principal Component Analysis on a set of data vectors.

Inheritance:

CAAMDeformPCA - CAAMDeform - CAAMObject


Public Methods

[more]void BackProject( const CDVector &param, CDVector &synth_obs ) const
Back projects a set of PCA model parameters into the original space.
[more]int CalcNParam( const double retained_variance ) const
Calulates the needed number of parameters.
[more]void ClearDataItems()
Deletes the data matrix
[more]void Deform( const CDVector &params, CDVector &object ) const
Projects a set of PC scores to the original space.
[more]void DoPCA( bool bWriteCoVarMarix )
Performs the principal component analysis.
[more]void Dump( const char* szPath ) const
Writes eigen vectors and eigen values to matlab text files: pca_eigenvectors.m pca_eigenvalues.m pca_eigenvalues_org.m
[more]inline const CDVector& EigenValues() const
Returns the eigen values in const vector form
[more]inline CDVector& EigenValues()
Returns the eigen values in vector form
[more]inline const CDVector& EigenValuesOrg() const
Returns the orignal eigen values in const vector form
[more]inline CDMatrix& EigenVectors()
Returns the eigen vectors in matrix form
[more]inline const CDMatrix& EigenVectors() const
Returns the eigen vectors in const matrix form
[more]void Filter( CDVector &obs ) const
Projects an observation into the PCA space and back.
[more]void FromFile( FILE* fh )
Reads a PCA object from file.
[more]void InsertDataItem( const CDVector &v )
Inserts a data vector.
[more]double MahalanobisDistance( const CDVector &params ) const
Returns the Mahalanobis distance of a set of PCA parameters.
[more]const CDVector& MeanDataItem() const
Returns the sample mean.
[more]const int NDataItems() const
Returns the number of data items this basis is based on
[more]inline int NParameters() const
Returns the number of princal parameters
[more]inline int NParametersOrg() const
Returns the number of princal parameters before any truncation
[more]double ParameterWeight( const int i, bool asPercentage ) const
Returns the eigenvalue of the i-th parameter.
[more]double ParameterWeightOrg( const int i, bool asPercentage ) const
Returns the eigenvalue of the i-th parameter.
[more]void Project( const CDVector &obs, CDVector &param ) const
Projects an observation into the PCA space.
[more]void ShuffleData()
Shuffle each dimension in all data items.
[more]void ToFile( FILE* fh ) const
Writes a PCA object to file.
[more]int TruncateParallel()
Truncate eigenvectors and eigenvalues using parallel analysis.
[more]int TruncateVar( const double retained_variance )
Truncate eigenvectors and eigenvalues to retain 'retained_variance'.
[more]void UseIdentityTransformation()
Makes the object use an identity basis instead of PCA basis.


Inherited from CAAMDeform:

Protected Fields

obool m_bValid


Inherited from CAAMObject:


Documentation

Performs Principal Component Analysis on a set of data vectors. The PCA basis can then be used for e.g. shape deformation.

oinline CDVector& EigenValues()
Returns the eigen values in vector form

oinline const CDVector& EigenValues() const
Returns the eigen values in const vector form

oinline const CDVector& EigenValuesOrg() const
Returns the orignal eigen values in const vector form

oinline CDMatrix& EigenVectors()
Returns the eigen vectors in matrix form

oinline const CDMatrix& EigenVectors() const
Returns the eigen vectors in const matrix form

oinline int NParameters() const
Returns the number of princal parameters

oinline int NParametersOrg() const
Returns the number of princal parameters before any truncation

ovoid ClearDataItems()
Deletes the data matrix

oconst int NDataItems() const
Returns the number of data items this basis is based on

odouble ParameterWeight( const int i, bool asPercentage ) const

Returns the eigenvalue of the i-th parameter in absolute numbers or as percentage.

Returns:
The eigenvalue.
Author:
Mikkel B. Stegmann
Version:
10-17-2000
See Also:
ParameterWeightOrg

odouble ParameterWeightOrg( const int i, bool asPercentage ) const

Returns the eigenvalue of the i-th parameter in absolute numbers or as percentage.

Returns:
The eigenvalue.
Author:
Mikkel B. Stegmann
Version:
10-17-2000
See Also:
ParameterWeightOrg

ovoid InsertDataItem( const CDVector &v )

Inserts a data vector.

Parameters:
v - A data vector.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
10-17-2000

ovoid UseIdentityTransformation()

Makes the object use an identity basis instead of PCA basis, i.e. essentially a by-pass of this object.

Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
10-30-2002

ovoid DoPCA( bool bWriteCoVarMarix )

Performs the principal component analysis on the data items. Uses the Eckhart-Young theorem if necessary for reduced memory and computational requirements.

Parameters:
bWriteCoVarMarix - If true the covariance matrix is written to the current dir. NOTE: Only in the case of more data items than dimensions (samples).
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
10-17-2000

oconst CDVector& MeanDataItem() const

Returns the mean of all sample vectors.

Returns:
A mean vector.
Author:
Mikkel B. Stegmann
Version:
10-17-2000

ovoid ToFile( FILE* fh ) const

Writes a PCA object to a binary file.

Parameters:
fh - File handle to binary file open for writing.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
10-18-2000
See Also:
FromFile

ovoid FromFile( FILE* fh )

Reads a PCA object from a binary file.

Parameters:
fh - File handle to binary file open for reading.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
10-18-2000
See Also:
ToFile

ovoid Dump( const char* szPath ) const

Debug method that provides a human readable file dump of the object data.

Parameters:
szPath - Path including terminating backslash where the data is dumped.
Returns:
Nothing. @throws VisError
Author:
Mikkel B. Stegmann
Version:
10-18-2000

ovoid Deform( const CDVector &params, CDVector &object ) const

Projects a set of PC scores to the original space.

Parameters:
params - PC scores, i.e. the model paramerisation.
object - Resulting projection into the original space, e.g. a shape.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
10-18-2000

odouble MahalanobisDistance( const CDVector &params ) const

Returns the Mahalanobis distance of a set of PCA parameters.

Parameters:
params - A set of PCA parameters.
Returns:
The Mahalanobis distance.
Author:
Mikkel B. Stegmann
Version:
6-11-2000

ovoid ShuffleData()

Shuffle each dimension in all data items over all observations.

Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
7-17-2002

oint TruncateParallel()

Truncate eigenvectors and eigenvalues using parallel analysis.

Also known as Horn's parallel analysis or Humphrey-Ilgen parallel analysis.

Assumes the data items have not been cleared.

Returns:
The number of parameters in the truncated basis.
Author:
Mikkel B. Stegmann
Version:
7-15-2002
See Also:
TruncateVar

oint TruncateVar( const double retained_variance )

Truncate eigenvectors and eigenvalues to retain 'retained_variance'.

I.e. if retained_variance = .95 this function calculates how many eigenvectors we need to explain 95% of the total variation in the PCA training set.

Parameters:
retained_variance - Amount of variance to retain [0<x<1].
Returns:
The number of parameters in the truncated basis.
Author:
Mikkel B. Stegmann
Version:
6-11-2000

oint CalcNParam( const double retained_variance ) const

Calulates the needed number of parameters to retain 'retained_variance'. I.e. if retained_variance = .95 then this function calculates how many eigenvectors we need to explain 95% of the total variation in the PCA training set.

Assumes that no eigenvalue cutoff has been done prior to the call.

Parameters:
retained_variance - Amount of variance to retain [0<x<1].
Returns:
The number of model parameters.
Author:
Mikkel B. Stegmann
Version:
6-5-2000

ovoid Project( const CDVector &obs, CDVector &param ) const

Projects an observation into the PCA space.

Notice: Costly, due to the non-cached transpose of the eigenvectors.

Parameters:
obs - Input observation.
param - Output model parameters of the (possibly truncated) basis.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
3-6-2003
See Also:
BackProject, Filter

ovoid BackProject( const CDVector &param, CDVector &synth_obs ) const

Back projects a set of PCA model parameters into the original space.

Parameters:
param - Input PCA model parameters.
synth_obs - Synthesized output observation.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
3-6-2003
See Also:
Project, Filter

ovoid Filter( CDVector &obs ) const

Projects an observation into the PCA space and back.

Notice: Costly, due to the non-cached transpose of the eigenvectors in the project call.

Parameters:
obs - Input observation.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
3-6-2003
See Also:
Project, BackProject


This class has no child classes.
Author:
Mikkel B. Stegmann
Version:
10-17-2000
See Also:
CAAMDeform

Alphabetic index Hierarchy of classes


Back AAM-API documentation The AAM-Site