CAAMShapeCollection m_Shapes
- The raw (unaligned) shapes
CAAMShapeCollection m_AlignedShapes
- The aligned shapes
std::vector<CDVector> m_vTexture
- The texture samples
CAAMModel* m_pModel
- Pointer to the model we're building
void BuildFromFiles( CAAMModel &model, const CString &inDir, const CString &acf, const int modelReduction, const int excludeShape )
-
This method automates the model generation as much as possible
by using the various class methods for all the sequences in the
task of producing a model.
- Parameters:
- model - The generated model.
inDir - Input directory where annotations (.asf) resides.
acf - Filename of an AAM configuration file.
If omitted defaults are used.
modelReduction - Model reduction multiplier. Default off == 1.
Useful when building multi-scale AAMs.
excludeShape - Excludes one shape number 'excludeShape'
from the input directory. Default -1, i.e.
no shapes are removed.
Used to perform leave-one-out testing.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-14-2000
void BuildFromFiles( CAAMModel &model, const std::vector<CString> &asfFiles, const CString &acf, const int modelReduction, const int excludeShape )
-
This method automates the model generation as much as possible
by using the various class methods for all the sequences in the
task of producing a model.
- Parameters:
- model - The generated model.
asfFiles - Vector of asf filenames.
acf - Filename of an AAM configuration file.
If omitted defaults are used.
modelReduction - Model reduction multiplier. Default off == 1.
Useful when building multi-scale AAMs.
excludeShape - Excludes one shape number 'excludeShape'
from the input directory. Default -1, i.e.
no shapes are removed.
Used to perform leave-one-out testing.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-14-2000
bool LoadShapes( const std::vector<CString> &asfFiles, CAAMShapeCollection &destination, int modelReduction, bool addCompleteImage, double addExtents, int excludeShape )
-
Loads (and preprocess) all training shapes into a CAAMShapeCollection.
This could as well be placed in CAAMUtil actually.
- Parameters:
- asfFiles - An array of asf filenames.
destination - Output shape collection.
modelReduction - Optional size reduction. Default 1, i.e. no reduction.
addCompleteImage - Set this to true if you (for wird reasons) would like
add the corners of the image to the shape. Default false.
addExtents - Simple and somewhat hacked way to add a shape neighborhood
(will be removed in later versions).
excludeShape - If != -1 the the 'excludeShape'-th shape will be excluded.
Zero is the first shape. Used for leave-one-out evaluation.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 11-4-2002
void MapTextures()
-
Performs a mapping of all textures in 'm_vTexture' using
the texture transfer class of the model.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 1-28-2002
void DumpModelDoc( std::vector<CDVector> bVectors )
-
Write additional documentation output.
- Parameters:
- bVectors - Concatenated and weighted shape and texture vectors
over the training set.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 1-28-2002
void EstRegressionMatrices( const std::vector<CDVector> &bVectors, const int ts_subsampling )
-
Build the regression matrices for pose and parameter prediction.
I.e. calculates the member variables 'regR_c', 'regR_t'.
using principal component regression.
- Parameters:
- bVectors - The b-vectors for the training set the current AAM
is built upon.
[Can be optained from the DoCombinedPCA() call]
ts_subsampling - Controls the sub sampling of the training set -
i.e. to use every fifth shape to build the
regression matrices upon, set
shape_subsampling = 5;
The motivation for doing this is reduction of
model building time -- and perhaps most
importantly -- conservation of memory resources.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-14-2000
void DoPoseExperiments( const std::vector<CDVector> &vPoseDisps, const std::vector<CDVector> &cVectors, CDMatrix &X, CDMatrix &C, const int ts_subsampling ) const
-
Performs a set of pose parameter displacement experiments on the
training set given a set of displacment vectors.
- Parameters:
- vPoseDisps - A vector of displacement vectors as obtained from
PoseDispVectors() or DisplacementSets().
cVectors - The set of optimum c vectors for the training examples.
X - Output matrix containing the texture difference vectors
obtained from the displacements.
Y - Output matrix containing the model parameter displacements
carried out.
ts_subsampling -
Subsampling factor, i.e. ts_subsampling==n will carry out
displacements on every n-th example in the training set.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-13-2002
- See Also:
- DoPoseExperiments
void DoCParamExperiments( const std::vector<CDVector> &vCDisps, const std::vector<CDVector> &cVectors, CDMatrix &X, CDMatrix &C, const int ts_subsampling ) const
-
Performs a set of model parameter displacement experiments on the
training set given a set of displacment vectors.
- Parameters:
- vCDisps - A vector of displacement vectors as obtained from
CParamDispVectors() or DisplacementSets().
cVectors - The set of optimum c vectors for the training examples.
X - Output matrix containing the texture difference vectors
obtained from the displacements.
Y - Output matrix containing the model parameter displacements
carried out.
ts_subsampling -
Subsampling factor, i.e. ts_subsampling==n will carry out
displacements on every n-th example in the training set.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-13-2002
- See Also:
- DoPoseExperiments
void DisplacementSets( std::vector<CDVector> &vCDisps, std::vector<CDVector> &vPoseDisps, const std::vector<CDVector> &cVectors ) const
-
Generates model parameter and pose displacement sets.
- Parameters:
- vCDisps - Resulting model parameter displacement set.
vPoseDisps - Resulting pose parameter displacement set.
cVectors - The set of c vectors over the training set.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-14-2000
- See Also:
- CParamDispVectors, PoseDispVectors
std::vector<CDVector> CParamDispVectors( const CDVector &vStdDisp, const std::vector<CDVector> &cVectors, const int pStart, const int pLen ) const
-
Generates a set combined model parameter displacement vectors
where each parameter is displaced at a time according to the
values in vStdDisp.
- Parameters:
- vStdDisp - A vector of parameter displacements in
standard deviations of the corresponding
parameter.
cVectors - The set of c vectors over the training set.
pStart - The first parameter to displace.
(default 0).
pLen - The number of parameters to displace.
(default 0, which means all parameters).
- Returns:
- A vector of displacement vectors.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-14-2000
- See Also:
- CParamDispVectors
std::vector<CDVector> PoseDispVectors( const CDVector &vXDisp, const CDVector &vYDisp, const CDVector &vScaleDisp, const CDVector &vRotDisp ) const
-
Generates a set pose displacement vectors.
- Parameters:
- vXDisp - A vector of x displacements in pixels.
vYDisp - A vector of y displacements in pixels.
vScaleDisp - A vector of scale displacements (1.0=no scaling).
vRotDisp - A vector of rotation displacements in degrees.
- Returns:
- A vector of displacement vectors.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-14-2000
- See Also:
- CParamDispVectors
void BuildTextureVectors()
-
Initializes the private member: 'm_vTexture' by sampling all shapes
using a warp function.
Note that this method calculates the mean texture.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 2-21-2000
CAAMBuilder()
-
Constructor. Sets up default values for the settings usally
given by an acf file.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 10-26-2000
~CAAMBuilder()
-
Destructor.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 10-26-2000
void CalcPixel2ShapeWeights()
-
Calculates the pixel-to-shape weights used in the combined PCA.
Currently the simple 'split even' strategy is employed, i.e.
normalise shape and texture variance to be equal.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-6-2000
void PoseDisplacement( const CDMultiBand<TAAMPixel> &image, const CAAMShape &shape, const CDVector &c0, const CDVector &t, CDVector &pixel_diff ) const
-
Performs one pose regression experiment.
- Parameters:
- image - The image corresponding to the equibrilium shape.
shape - The equibrilium shape.
c0 - The equibrilium model parameters.
t - The pose displacement parameters.
pixel_diff - The normalized pixel differences resulting from
the pose displacement.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-14-2000
- See Also:
- ModelDisplacement
void ModelDisplacement( const CDMultiBand<TAAMPixel> &image, const CAAMShape &shape, const CDVector &c0, const CDVector &delta_c, CDVector &pixel_diff ) const
-
Performs one model parameter regression experiment.
- Parameters:
- image - The image corresponding to the equibrilium shape.
shape - The equibrilium shape.
c0 - The equibrilium model parameters.
delta_c - The model parameter displacements.
pixel_diff - The normalized pixel differences resulting from
the pose displacement.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-14-2000
- See Also:
- PoseDisplacement
void DoShapeAlignment( const bool fUseTangentSpace )
-
Alignes shapes and calc mean- and reference-shape.
I.e. initializes 'm_AlignedShapes', 'm_sMeanAShape' and
'm_sReferenceShape'.
- Parameters:
- fUseTangentSpace - Use the tangent space projection (bool).
- Returns:
- Noting.
- Author:
- Mikkel B. Stegmann
- Version:
- 10-24-2000
void DumpPCA( const std::vector<CDVector> &bVectors )
-
Dumps the PC scores of the shape, texture and combined PCA.
These are written to the current directory in Matlab format
as shape_pc.m, texture_pc.m and combined_pc, respectively.
param bVectors The b-parameters for all training examples.
As obtained from DoCombinedPCA().
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-17-2000
void NormalizeTextureVectors()
-
Performs normalization of the texture vectors as described
by Cootes et al. in "Active Appearance Models" sec. 2.
Recalculates the mean texture.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 2-22-2000
bool ReadACF( const CString &filename )
-
Reads and parses an ACF file. In this way the AAM can be
configured using different setting for model generation.
Note that all parsing is very primitive and in no way
robust :-( So be careful about the configuration files.
- Parameters:
- filename - The acf file to open.
- Returns:
- true on success, false on file errors.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-17-2000
void RecalcMeanTexture( )
-
Recalculates the mean texture vector 'm_vMeanTexture'.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 2-22-2000
std::vector<CDVector> DoCombinedPCA()
-
Performs principal component analysis on the shape and the
texture data.
Uses the Eckhart-Young theorem described in appendix A of
"Statistical Models of Appearance of Computer Vision" by
T.F. Cootes et al. if we have fewer samples than dimensions
which is typically the case.
- Returns:
- The b-parameters for all training examples. The format is
a vector of b-parameter vectors. This vector is used in the
BuildRegressionMatrices() call.
- Author:
- Mikkel B. Stegmann
- Version:
- 2-23-2000
void EstPredictionMatrices( const std::vector<CDVector> &bVectors, const int ts_subsampling )
-
Build the prediction matrices for pose and parameter prediction.
I.e. calculates the member variables 'regR_c', 'regR_t'.
using estimates of the gradient matrices.
- Parameters:
- bVectors - The b-vectors for the training set the current AAM
is built upon.
[Can be optained from the DoCombinedPCA() call]
ts_subsampling - Controls the sub sampling of the training set -
i.e. to use every fifth shape to build the
regression matrices upon, set
shape_subsampling = 5;
The motivation for doing this is reduction of
model building time.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 7-18-2002
void EstPoseGradientMatrix( const std::vector<CDVector> &vPoseDisps, const std::vector<CDVector> &cVectors, CDMatrix &Gpose, const int ts_subsampling ) const
-
Estimates the Jacobian of the pose parameters given a set
of displacement vectors and the optimum model parameters for
the training set.
- Parameters:
- vPoseDisps - A vector of displacement vectors as obtained from
PoseDispVectors() or DisplacementSets().
cVectors - The set of optimum c vectors for the training examples.
Gpose - The output Jacobian matrix (or gradient matrix if you like).
ts_subsampling -
Subsampling factor, i.e. ts_subsampling==n will carry out
displacements on every n-th example in the training set.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 7-18-2002
- See Also:
- EstCParamGradientMatrix
void EstCParamGradientMatrix( const std::vector<CDVector> &vCDisps, const std::vector<CDVector> &cVectors, CDMatrix &Gparam, const int ts_subsampling) const
-
Estimates the Jacobian of the model parameters given a set
of displacement vectors and the optimum model parameters for
the training set.
- Parameters:
- vCDisps - A vector of displacement vectors as obtained from
CParamDispVectors() or DisplacementSets().
cVectors - The set of optimum c vectors for the training examples.
Gparam - The output Jacobian matrix (or gradient matrix if you like).
ts_subsampling -
Subsampling factor, i.e. ts_subsampling==n will carry out
displacements on every n-th example in the training set.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 7-18-2002
- See Also:
- EstPoseGradientMatrix