Class CAAMModel
java.lang.Object
gov.nih.mipav.view.renderer.WildMagic.AAM.CAAMObject
gov.nih.mipav.view.renderer.WildMagic.AAM.CAAMModel
- Direct Known Subclasses:
C_AAMMODEL,CAAMModelMS,CAAMModelSeq
This is the Java modified version of C++ active appearance model API
(AAM_API). It is modified with a subset of required functions for automatic
MRI prostate segmentation.
AAM-API LICENSE - file: license.txt
This software is freely available for non-commercial use such as
research and education. Please see the full disclaimer below.
All publications describing work using this software should cite
the reference given below.
Copyright (c) 2000-2003 Mikkel B. Stegmann, mbs@imm.dtu.dk
IMM, Informatics invalid input: '&' Mathematical Modelling
DTU, Technical University of Denmark
Richard Petersens Plads, Building 321
DK-2800 Lyngby, Denmark
http://www.imm.dtu.dk/~aam/
REFERENCES
Please use the reference below, when writing articles, reports etc. where
the AAM-API has been used. A draft version the article is available from
the homepage.
I will be happy to receive pre- or reprints of such articles.
/Mikkel
-------------
M. B. Stegmann, B. K. Ersboll, R. Larsen, "FAME -- A Flexible Appearance
Modelling Environment", IEEE Transactions on Medical Imaging, IEEE, 2003
(to appear)
-------------
3RD PART SOFTWARE
The software is partly based on the following libraries:
- The Microsoft(tm) Vision Software Developers Kit, VisSDK
- LAPACK
DISCLAIMER
This software is provided 'as-is', without any express or implied warranty.
In no event will the author be held liable for any damages arising from the
use of this software.
Permission is granted to anyone to use this software for any non-commercial
purpose, and to alter it, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
--
No guarantees of performance accompany this software, nor is any
responsibility assumed on the part of the author or IMM.
This software is provided by Mikkel B. Stegmann and IMM ``as is'' and any
express or implied warranties, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose are
disclaimed. In no event shall IMM or Mikkel B. Stegmann be liable for any
direct, indirect, incidental, special, exemplary, or consequential damages
(including, but not limited to, procurement of substitute goods or services;
loss of use, data, or profits; or business interruption) however caused and
on any theory of liability, whether in contract, strict liability, or tort
(including negligence or otherwise) arising in any way out of the use of
this software, even if advised of the possibility of such damage.
$Revision: 1.4 $
$Date: 2003/04/23 14:49:15 $
The core Active Appearance Model object that hold all eigenmodels, prediction
matrices etc. Build by a CAAMBuilder.
- Author:
- Ruida Cheng
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanflag to use convexhull.protected booleanflag to use targent space.protected CAAMDeformPCAThe combined PCA.protected doubleflag to add extents.protected doubleThe AMF format version.protected doublemodel build time.protected CAAMDeformPCAdeform displacement PCA.protected doublemean shape size.protected intcombined truncation.protected intwhich learning method to use.protected intflag for model reduction.protected intthe number of shapes.protected intshape truncation.protected intThe number of texture samples in the model.protected inttexture truncation.protected CDMatrixThe texture part of the combined eigenvectors.protected CDMatrixThe shape part of the combined eigenvectors.protected CDMatrixThe shape-to-pixel weights.protected CDMatrixCache shape matrix.protected CDMatrixCache texture matrix.protected CAAMAnalyzeSynthesizeAAM synthesize analysis.protected CAAMReferenceFrameAAM reference frame.protected CAAMDeformThe shape basis.protected CAAMDeformThe texture basis.protected CAAMTransferFunctionThe texture transfer function.protected CDMatrixThe parameter prediction matrixprotected CDMatrixprotected StringCurrent analyzer name.protected CAAMDeformPCAThe shape PCA.protected CAAMShapeCached mean shape.protected CAAMDeformPCAThe texture PCA.protected CDVectorThe mean texture.protected CDVectorthe mean texture original.protected CDVectorpose parameters update.protected CDVectorshape parameters upate.protected CDVectorprotected CDVectorThe variance of each normalized pixel in the texture model. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the amount shape extents added (warning: shape extents will be remove in later versions).booleanApproxExample(String filename, ModelSimpleImage outImg) Doing model approximation of an (unseen) example.Assignment operator.voidCombined2ShapeParam(CDVector c, CDVector b_s) Converts combined model parameters to shape parameters.voidCombined2TexParam(CDVector c, CDVector b_g) Converts combined model parameters to texture parameters.Returns the combined PCA.voidConstrainSearchParameters(CDVector c, CDVector pose) Constrain the pose and model parameters to be within some reasonable limits.voiddispose()dispose memorybooleanEstimatePose(ModelSimpleImage image, CAAMShape shape, CDVector pose) Estimate the pose of a shape using the pose regression matrix.intGet the the number of eigen values in PCA.booleanReturns true if the texture model is based on the convex hull.Returns the mean shape.doubleReturns the mean shape size, i.e. the size of the reference shape.Returns the mean texture.doubleModelEstimateTexDiff(ModelSimpleImage image, CDVector c, CAAMShape estimate, CDVector diff, int similaritym) Wrapper to calculate the pixel difference from a model instance and an image.doubleModelEstimateTexDiff(ModelSimpleImage image, CDVector c, CAAMShape estimate, CDVector diff, int similaritym, boolean useInterpolation) Calculates the pixel difference from a model instance and an image.voidModelImage(CDVector c, ModelSimpleImage outImg, CAAMShape matchPose) Generate model instance (match pose to 'shape') and render the instance into the image 'img'.voidModelImage(CDVector c, ModelSimpleImage outImg, CAAMShape matchPose, boolean fitTexture) Generates a model image based on the parameters in 'c' with various options.voidModelImageEx(CAAMShape shape, CDVector texture, ModelSimpleImage outImg, boolean renderImage, boolean fitTexture) Generates a synthetic image from the AAM using the model parameters in 'c'.intReturn model reduction.intNBands()Returns the number of bands in the modelvoidNormalizeTexture(CDVector texture) Normalizes a texture vector.intReturns the number of samples in the texture model.OptimizeModel(ModelSimpleImage image, CAAMShape s, CDVector c) Wrapper for model optimization.OptimizeModel(ModelSimpleImage image, CAAMShape s, CDVector c, int maxIterations, Vector<CAAMOptState> pOptStates) Wrapper for model optimizationOptimizeModel(ModelSimpleImage image, CAAMShape s, CDVector c, int maxIterations, Vector<CAAMOptState> pOptStates, boolean disableDamping) Performs AAM optimization of a shape containing initial pose and a set of model parameters (c).OptimizeModelByFineTuning(ModelSimpleImage image, CAAMShape s, CDVector c, int maxIterations, int similaritym, int optimizer) Perform general-purpose optimization of the AAM using simulated annealing, conjugate gradient, steepest descent, BGFS or pattern search.Qg()The texture part of the combined PCA eigenvectors.Qs()The shape part of the combined PCA eigenvectors.Rc()Texture parameter update prediction matrix.booleanReads the complete AAMModel from disk.intReturns the reduction factor of the training set that this model wasReturns the reference frame of the model.final CAAMShapeReturns the reference shape where all texture sampling and comparison should be done.Rt()Pose parameter update prediction matrix.intSampleShape(ModelSimpleImage image, CAAMShape shape, CDVector textureSamples) Wrapper to build a texture vector from an image and a shape.intSampleShape(ModelSimpleImage image, CAAMShape shape, CDVector textureSamples, boolean normalize) Wrapper to build a texture vector from an image and a shape.intSampleShape(ModelSimpleImage image, CAAMShape shape, CDVector textureSamples, boolean normalize, boolean useInterpolation) Wrapper to build a texture vector from an image and a shape.intSampleShape(ModelSimpleImage image, CAAMShape shape, CDVector textureSamples, boolean normalize, boolean useInterpolation, boolean map) Builds a texture vector from an image and a shape.voidSets constraints on the pose parameter updates.voidSets user-specified shape parameter update constraints.voidShape2Combined(CAAMShape shape, ModelSimpleImage image, CDVector c) Projects a shape into a set of c parameters.voidShape2Param(CAAMShape shape, CDVector b_s) Projects a shape into a set of shape parameters,Return shape to pixel weight.Returns the shape PCA.ShapeFreeImage(CDVector textureSamples, ModelSimpleImage outImg) Wrapper to generates a shape free image using a vector of texture samples.ShapeFreeImage(CDVector textureSamples, ModelSimpleImage outImg, boolean deMap) Generates a shape free image (that is; a mean shape image) using a vector of texture samples.voidShapeFreeImage(CDVector textureSamples, CDMatrix m, boolean deMap, boolean normalize) Generates a shape free image (that is; a mean shape image) using a vector of texture samples.voidShapeInstance(CDVector c, CAAMShape outShape) Generates a shape based on a set of model parameters.final CAAMDeformPCAShapePCA()Returns the shape PCA.voidShapePCAInstance(CDVector b_s, CAAMShape outShape) Generates a shape based on a set of shape b-parameters.voidShapeTex2Combined(CAAMShape shape, CDVector texture, CDVector c) Projects the shape and texture into c-space i.e. the combined model parameters.voidShapeTex2Param(CAAMShape shape, CDVector texture, CDVector b) Extract the b-parameters from a shape and corresponding texture by inverting the shape and texture pca projection.voidTransforms the concatenated b-parameters into combined model parameters.voidShapeTexParam2Combined(CDVector b_s, CDVector b_g, CDVector c) Projects shape and texture parameters into the combined eigenspace.voidShapeTexParam2Combined(Vector<CDVector> bVectors, Vector<CDVector> cVectors) Converts a set of b-vectors to combined model parameters (c-vectors).Returns the texture PCA.voidTextureInstance(CDVector c, CDVector outTexture) Generates a texture based on a set of model parameters.final CAAMDeformPCAReturns the texture PCA.Return texture transfer function.booleanWriteModel(String filename) Write the AAM model to text file or binary file.booleanWriteModel(String filename, boolean txt_only) Writes the complete AAMModel to disk as a .txt and an .amf file.voidWriteVarianceMap(String filename) Plots the variance of each pixel in the model over the training set into the mean shape and saves the image.Methods inherited from class gov.nih.mipav.view.renderer.WildMagic.AAM.CAAMObject
FromFile, ToFile
-
Field Details
-
m_pAnalyzeSynthesize
AAM synthesize analysis. -
m_pReferenceFrame
AAM reference frame. -
m_pShapeBasis
The shape basis. -
m_pTextureBasis
The texture basis. -
m_ShapePCA
The shape PCA. -
m_TexturePCA
The texture PCA. -
m_CombinedPCA
The combined PCA. -
m_mShape2PixelWeights
The shape-to-pixel weights. -
m_dAMFVersion
protected double m_dAMFVersionThe AMF format version. -
m_mQsEV
The shape part of the combined eigenvectors. -
m_mQgEV
The texture part of the combined eigenvectors. -
m_vMeanTexture
The mean texture. -
m_vMeanTextureOrg
the mean texture original. -
m_sMeanAShape
Cached mean shape. -
m_mShapeInstance
Cache shape matrix. -
m_mTextureInstance
Cache texture matrix. -
m_vTextureVar
The variance of each normalized pixel in the texture model. -
m_iTextureSamples
protected int m_iTextureSamplesThe number of texture samples in the model. -
m_iNShapes
protected int m_iNShapesthe number of shapes. -
m_dMeanShapeSize
protected double m_dMeanShapeSizemean shape size. -
m_R_c
The parameter prediction matrix -
m_R_t
-
m_pTextureTF
The texture transfer function. -
m_iModelReduction
protected int m_iModelReductionflag for model reduction. -
m_dAddExtents
protected double m_dAddExtentsflag to add extents. -
m_bUseConvexHull
protected boolean m_bUseConvexHullflag to use convexhull. -
m_bUseTangentSpace
protected boolean m_bUseTangentSpaceflag to use targent space. -
m_iLearningMethod
protected int m_iLearningMethodwhich learning method to use. -
m_iShapeTrunc
protected int m_iShapeTruncshape truncation. -
m_iTextureTrunc
protected int m_iTextureTrunctexture truncation. -
m_iCombinedTrunc
protected int m_iCombinedTrunccombined truncation. -
m_sCurrentAnalyzeId
Current analyzer name. -
m_dBuildTime
protected double m_dBuildTimemodel build time. -
m_vPoseParameterUpdateConstraints
pose parameters update. -
m_vShapeParameterConstraintsMean
shape parameters upate. -
m_vShapeParameterConstraintsSD
-
m_DisplacementPCA
deform displacement PCA.
-
-
Constructor Details
-
CAAMModel
public CAAMModel()Constructor. Set up the default settings. -
CAAMModel
Copy constructor.- Parameters:
m- Object to copy from.
-
-
Method Details
-
Rc
Texture parameter update prediction matrix.- Returns:
- texture prediction matrix
-
Rt
Pose parameter update prediction matrix.- Returns:
- pose prediction matrix
-
Qg
The texture part of the combined PCA eigenvectors.- Returns:
- combined texture PCA
-
Qs
The shape part of the combined PCA eigenvectors.- Returns:
- combined shape PCA
-
ReferenceFrame
Returns the reference frame of the model.- Returns:
- refrence frame
-
NBands
public int NBands()Returns the number of bands in the model- Returns:
- single channel to represent the gray scal intensity.
-
TextureTF
Return texture transfer function.- Returns:
- return texture transfer function
-
NTextureSamples
public int NTextureSamples()Returns the number of samples in the texture model.- Returns:
- sample numbers
-
IsConvexHullUsed
public boolean IsConvexHullUsed()Returns true if the texture model is based on the convex hull.- Returns:
- ture convex hull, false not
-
AddExtents
public double AddExtents()Returns the amount shape extents added (warning: shape extents will be remove in later versions).- Returns:
- shape extents
-
MeanShape
Returns the mean shape.- Returns:
- mean shape
-
MeanTexture
Returns the mean texture.- Returns:
- mean texture
-
Shape2PixelWeights
Return shape to pixel weight.- Returns:
- weight
-
ShapePCA
Returns the shape PCA.- Returns:
- shape PCA
-
TexturePCA
Returns the texture PCA.- Returns:
- texture PCA
-
ShapeBasis
Returns the shape PCA.- Returns:
- shape PCA.
-
TextureBasis
Returns the texture PCA.- Returns:
- texture PCA.
-
CombinedPCA
Returns the combined PCA.- Returns:
- combined PCA.
-
ModelReduction
public int ModelReduction()Return model reduction.- Returns:
- flag for model reduction.
-
MeanShapeSize
public double MeanShapeSize()Returns the mean shape size, i.e. the size of the reference shape.- Returns:
- mean shape size.
-
dispose
public void dispose()dispose memory -
ApproxExample
Doing model approximation of an (unseen) example. Synthesizes an unseen example by projecting the shape and (normalized) texture into c-parameter space, generating a model instance and assigning it the appropriate pose (incl. denormalization).- Parameters:
filename- The base filename of an annotation. Ex. "scan.asf"outImg- The output image where the model approximation has been overlaid.- Returns:
- true on success, false if the image and/or annotation could not be read.
-
SetPoseParameterUpdateConstraints
Sets constraints on the pose parameter updates. NOTICE: Currently, these are *not* saved along with the model and thus must be set each time a model is loaded.- Parameters:
pc- Parameter constraints (in absolute numbers).
-
SetShapeParameterUpdateConstraints
Sets user-specified shape parameter update constraints. NOTICE: These are currently not saved with the model.- Parameters:
mean- Some shape parameter configuration.sd- The standard diviations of the 'mean'.
-
ConstrainSearchParameters
Constrain the pose and model parameters to be within some reasonable limits.- Parameters:
c- The model parameters.pose- The pose parameters.
-
EstimatePose
Estimate the pose of a shape using the pose regression matrix.- Parameters:
image- The image to search in.shape- The shape to determine the pose from.pose- The output pose vector.- Returns:
- True is ok, false if the shape is outside the image.
-
ModelImage
Generate model instance (match pose to 'shape') and render the instance into the image 'img'.- Parameters:
c- combined model parametersoutImg- result imagematchPose- matched shape
-
ModelImage
public void ModelImage(CDVector c, ModelSimpleImage outImg, CAAMShape matchPose, boolean fitTexture) Generates a model image based on the parameters in 'c' with various options.- Parameters:
c- A set of model parameters.outImg- The output imge.matchPose- A pointer to a shape. If not NULL the model generated by the set of c-parameters will be aligned wrt. pose to this shape.fitTexture- If matchPose is not NULL, the de-mapped and de-normalized texture will be fitted in a least squares sense to the texture in outImg given by the shape. Default true.
-
ModelImageEx
public void ModelImageEx(CAAMShape shape, CDVector texture, ModelSimpleImage outImg, boolean renderImage, boolean fitTexture) Generates a synthetic image from the AAM using the model parameters in 'c'.- Parameters:
shape- The shape the texture vector should be mapped to.outImg- The output image (sized correctly inside this method, if renderInImage is false).renderImage- If true: 1) outImg is expected to be allocated. 2) the model is rendered with it's pose unchanged, thus the shape is expected to lie within the outImg This option is used for drawing the final optimization into the image or to draw a model approximation into the image 'outImg'. Default false.fitTexture- If renderImage is true, the de-mapped and de-normalized texture will be fitted in a least squares sense to the texture in outImg given by the shape. Default true.textureSamples- The texture vector to be warped into an image. Will be de-mapped and de-normalized.
-
ShapeFreeImage
Wrapper to generates a shape free image using a vector of texture samples.- Parameters:
textureSamples- texture samplesoutImg- result image- Returns:
- shape free image
-
ShapeFreeImage
public ModelSimpleImage ShapeFreeImage(CDVector textureSamples, ModelSimpleImage outImg, boolean deMap) Generates a shape free image (that is; a mean shape image) using a vector of texture samples.- Parameters:
textureSamples- The texture vector to be warped into an image. De-normalizes (and demaps) inside this method.outImg- A reference to an output image. Resize of the image is done inside this method.- Returns:
- shape free image.
-
ShapeFreeImage
Generates a shape free image (that is; a mean shape image) using a vector of texture samples.- Parameters:
textureSamples- The texture vector to be warped into an image. De-normalizes (and demaps) inside this method.m- A reference to an output image on matrix form. Resize of the matrix is done inside this method.deMap-
-
ModelEstimateTexDiff
public double ModelEstimateTexDiff(ModelSimpleImage image, CDVector c, CAAMShape estimate, CDVector diff, int similaritym) Wrapper to calculate the pixel difference from a model instance and an image.- Parameters:
image- model imagec- parameter vectorestimate- estimaed shapediff- difference vectorsimilaritym- similarity measure type- Returns:
- similarity measure
-
ModelEstimateTexDiff
public double ModelEstimateTexDiff(ModelSimpleImage image, CDVector c, CAAMShape estimate, CDVector diff, int similaritym, boolean useInterpolation) Calculates the pixel difference from a model instance and an image.- Parameters:
image- The image (input)c- Model parameters (in/output).estimate- The shape estimate (in/output).diff- The pixel difference vector (output) Resized inside.similaritym- Set the used similarity measure: 0 Non-normalised L_2 norm (default) 1 The "Mahalanobis" distance (texture samples are regarded independent to increase performance). 2 The Lorentzian error norm. 3 Absolute auto correlation of the residuals.- Returns:
- The similarity measure.
-
NormalizeTexture
Normalizes a texture vector.- Parameters:
texture- Texture to be normalized.
-
OptimizeModel
Wrapper for model optimization.- Parameters:
image- search images- init shapec- init model parameters- Returns:
- optimization result
-
OptimizeModel
public CAAMOptRes OptimizeModel(ModelSimpleImage image, CAAMShape s, CDVector c, int maxIterations, Vector<CAAMOptState> pOptStates) Wrapper for model optimization- Parameters:
image- search images- init shapec- init parametersmaxIterations- max iterationspOptStates- optimization state- Returns:
- optimization result
-
OptimizeModel
public CAAMOptRes OptimizeModel(ModelSimpleImage image, CAAMShape s, CDVector c, int maxIterations, Vector<CAAMOptState> pOptStates, boolean disableDamping) Performs AAM optimization of a shape containing initial pose and a set of model parameters (c).- Parameters:
image- The image to search in.s- The initial shape (also containing the inital pose, thus; not a normalized shape). Actually only the pose of 's' is used (to align the reference shape as the initial shape). NOTE: The optimal shape is returned in 's' after execution.c- The initial model parameters. If this vector is empty, it is resized correctly and set equal to zero, thus the mean model. NOTE: The optimal model parameters are returned in 'c' after execution.maxIterations- The maximum iterations allowed.pOptStates- Optional parameter all convergence info can be returned in. See CAAMOptState.disableDamping- Disables the damping steps (default false).- Returns:
- The results of the optimization in the form of a 'CAAMOptRes' instance.
-
OptimizeModelByFineTuning
public CAAMOptRes OptimizeModelByFineTuning(ModelSimpleImage image, CAAMShape s, CDVector c, int maxIterations, int similaritym, int optimizer) Perform general-purpose optimization of the AAM using simulated annealing, conjugate gradient, steepest descent, BGFS or pattern search.- Parameters:
image- The image beeing searched in.s- The inital shape pose.c- The initial model parameters.maxIterations- The maximum allowed number of iterations.similaritym- The used similarity measure for the optimization: 0 Non-normalized L_2 norm (default). 1 The "Mahalanobis" distance (texture samples are regarded independent to increase performance). 2 The Lorentzian error norm.optimizer- Sets the optimer to use: 1 Steepest Descent (default) 2 Conjugate Gradient 3 Quasi-Newton, BFGS 4 Pattern search 5 Simulated annealing- Returns:
- The final fit.
-
ReadModel
Reads the complete AAMModel from disk.- Parameters:
filename- Input filename without any extension. E.g. if the files on disk are 'model.txt' invalid input: '&' 'model.amf' -> filename = 'model'- Returns:
- true on success, false on file errors.
-
ReductionFactor
public int ReductionFactor()Returns the reduction factor of the training set that this model was- Returns:
- model reduction
-
SampleShape
Wrapper to build a texture vector from an image and a shape.- Parameters:
image- model imageshape- voitextureSamples- texture samples- Returns:
- shape inside or outside the image
-
SampleShape
public int SampleShape(ModelSimpleImage image, CAAMShape shape, CDVector textureSamples, boolean normalize) Wrapper to build a texture vector from an image and a shape.- Parameters:
image- model imageshape- VIOtextureSamples- texture samplesnormalize- normalization- Returns:
- shape inside or outside the image
-
SampleShape
public int SampleShape(ModelSimpleImage image, CAAMShape shape, CDVector textureSamples, boolean normalize, boolean useInterpolation) Wrapper to build a texture vector from an image and a shape.- Parameters:
image- model imageshape- VIOtextureSamples- texture samplesnormalize- normalizationuseInterpolation- interpolation or not.- Returns:
- shape inside or outside the image
-
SampleShape
public int SampleShape(ModelSimpleImage image, CAAMShape shape, CDVector textureSamples, boolean normalize, boolean useInterpolation, boolean map) Builds a texture vector from an image and a shape.- Parameters:
image- The image to sample in.shape- The shape to sample from (in image coordinates).textureSamples- The normalized destination texture vector.normalize- Perform normalization after sampling. Default true.map- Perform mapping after sampling. Default true.- Returns:
- The number of samples done (zero if the shape is outside the image).
-
ShapeInstance
Generates a shape based on a set of model parameters.- Parameters:
c- Input model parameters.outShape- The generated shape (resizing are done inside this method).
-
TextureInstance
Generates a texture based on a set of model parameters.- Parameters:
c- Input model parameters.outShape- The generated texture (resizing are done inside this method).
-
ShapePCAInstance
Generates a shape based on a set of shape b-parameters.- Parameters:
b_s- Shape parametersoutShape- Output shape (resized inside method).
-
ShapeTex2Combined
Projects the shape and texture into c-space i.e. the combined model parameters.- Parameters:
shape- The input shape aligned to the (aligned) mean shape.texture- The corresponding normalized texture.c- The resulting model parameters.
-
ShapeTex2Param
Extract the b-parameters from a shape and corresponding texture by inverting the shape and texture pca projection. Assumes that the shape and texture PCA are done beforehand.- Parameters:
shape- The input shape aligned to the (aligned) mean shape.texture- The corresponding normalized texture.b- The resulting concatenated b vector.
-
ShapeTexParam2Combined
Transforms the concatenated b-parameters into combined model parameters.- Parameters:
b- Concatenated shape (weighted) and texture parametersc- Combined model parameters (resized inside function).- See Also:
-
WriteModel
Write the AAM model to text file or binary file.- Parameters:
filename- file name- Returns:
- success or not
-
WriteModel
Writes the complete AAMModel to disk as a .txt and an .amf file.- Parameters:
filename- Output filename without any extension.txt_only- If true binary model data is not written.- Returns:
- true on success, false on file errors.
-
getNumberShapeParameters
public int getNumberShapeParameters()Get the the number of eigen values in PCA.- Returns:
- number of eigen values in PCA
-
WriteVarianceMap
Plots the variance of each pixel in the model over the training set into the mean shape and saves the image.- Parameters:
filename- Output image filename.
-
ReferenceShape
Returns the reference shape where all texture sampling and comparison should be done. The reference shape is defined as the mean shape size to mean size and moved to the fourth quadrant.- Returns:
- The reference shape.
-
ShapeTexParam2Combined
Converts a set of b-vectors to combined model parameters (c-vectors).- Parameters:
bVectors- The input b-vectors.cVectors- The output c-vectors.
-
assign
Assignment operator.- Parameters:
m- Object to copy from.- Returns:
- This;
-
Shape2Combined
Projects a shape into a set of c parameters.- Parameters:
shape- The input shape (assumed to be in abs coordinates).image- The image where the shape is placed.c- The output combined model parameters.
-
Shape2Param
Projects a shape into a set of shape parameters,- Parameters:
shape- The input shape (assumed to be in abs parameters).b- The output shape model parameters.
-
Combined2ShapeParam
Converts combined model parameters to shape parameters.- Parameters:
c- Combined model parameters.b_s- Output non-weighted shape parameters.
-
Combined2TexParam
Converts combined model parameters to texture parameters.- Parameters:
c- Combined model parameters.b_g- Output texture parameters.
-
ShapeTexParam2Combined
Projects shape and texture parameters into the combined eigenspace.- Parameters:
b_s- Input shape parameters.b_g- Input texture parameters.c- Resulting combined model parameters.
-