asmlib-opencv
an ASM(Active Shape Model) implementation by C++ & OpenCV
StatModel::ShapeModel Class Reference

The Statistical Shape model for training sets. More...

#include <shapemodel.h>

Inheritance diagram for StatModel::ShapeModel:
StatModel::ASMModel

List of all members.

Classes

struct  ModelViewInfo
 Used for viewing model. More...

Public Member Functions

 ShapeModel ()
virtual void saveToFile (ModelFile &file)
 Save the model into a file.
virtual void loadFromFile (ModelFile &file)
 Load the model from a file.
void readTrainData (const char *listFileName)
 File names are stored in the list file.
void loadShapeInfo (const char *shapeFileName)
 Load shape information.
void setPyramidLevel (int l)
 Set the level for the image pyramid.
void projectParamToShape (const Mat_< double > &paramVec, ShapeVec &shapeVec)
 Project a parameter vector to a shape.
void projectShapeToParam (const ShapeVec &shapeVec, Mat_< double > &paramVec)
 Project a shape to a parameter vector.
ShapeInfogetShapeInfo ()
Mat_< double > normalizeParam (const Mat_< double > &p)
 Normalize an parameter vector(0..1)
Mat_< double > reConFromNorm (const Mat_< double > &p)
 Reconstruct parameter vector from normalized vector.
void viewShapeModel ()
 An interactive UI for viewing the statistical model.
void viewShapeModelUpdate (ModelViewInfo *pInfo)
 Update viewing UI with new parameters. (called by callbacks)

Protected Member Functions

void clampParamVec (Mat_< double > &paramVec)
 Refine a parameter vector by clamping.
void buildModel (const string &shapeDefFile, const string &ptsListFile)
 Align the shapes and build a model.

Protected Attributes

int pyramidLevel
 level for the image pyramid.
int nMarkPoints
 Number of landmark points in a image.
int nTrain
 Number of training images.
vector< ModelImageimageSet
 All the images, with labelled markpoints.
ShapeInfo shapeInfo
 Path info for shapes;.
ShapeVec meanShape
 Mean shape after aligning.
PCA * pcaShape
 PCA model for shapes.
int nShapeParams
 Number of eigen vectors reserved for shape model.
double sigma2
 Data for BTSM: $\sigma^2$.
PCA * pcaFullShape
 Data for BTSM: Full $\phi$.
double searchYOffset
 r.y -= r.height*?
double searchXOffset
 r.x -= r.width*?
double searchWScale
 r.width *= ?
double searchHScale
 r.height *= ?
double searchStepAreaRatio
 step: ?*100/sqrt(area)
double searchScaleRatio
 init scale ratio when searching
double searchInitXOffset
 init X offset when searching
double searchInitYOffset
 init Y offset when searching

Detailed Description

The Statistical Shape model for training sets.

After all the training shapes are aligned, a PCA model is built so that a shape can be roughly described by a few parameters (PCA coefficients).

This class is responsible for building the statistical shape model and provides some helper functions.


Constructor & Destructor Documentation

Todo:
Make the "3" here a constant or a configurable variable.

Member Function Documentation

void StatModel::ShapeModel::buildModel ( const string &  shapeDefFile,
const string &  ptsListFile 
) [protected]

Align the shapes and build a model.

Parameters:
shapeDefFileShape definition file.
ptsListFileFile containting a list of pts files.

Reimplemented in StatModel::ASMModel.

void StatModel::ShapeModel::clampParamVec ( Mat_< double > &  paramVec) [protected]

Refine a parameter vector by clamping.

: Change "3" to a configurable variable.

void StatModel::ShapeModel::loadFromFile ( ModelFile file) [virtual]

Load the model from a file.

void StatModel::ShapeModel::loadShapeInfo ( const char *  shapeFileName)

Load shape information.

Mat_< double > StatModel::ShapeModel::normalizeParam ( const Mat_< double > &  p) [inline]

Normalize an parameter vector(0..1)

void StatModel::ShapeModel::projectParamToShape ( const Mat_< double > &  paramVec,
ShapeVec shapeVec 
)

Project a parameter vector to a shape.

Parameters:
paramVecparameter vector.
shapeVecthe shape corresponding to the parameter vector
void StatModel::ShapeModel::projectShapeToParam ( const ShapeVec shapeVec,
Mat_< double > &  paramVec 
)

Project a shape to a parameter vector.

Parameters:
shapeVecthe shape corresponding to the parameter vector
paramVecparameter vector.
void StatModel::ShapeModel::readTrainData ( const char *  listFileName)

File names are stored in the list file.

Mat_< double > StatModel::ShapeModel::reConFromNorm ( const Mat_< double > &  p) [inline]

Reconstruct parameter vector from normalized vector.

void StatModel::ShapeModel::saveToFile ( ModelFile file) [virtual]

Save the model into a file.

void StatModel::ShapeModel::setPyramidLevel ( int  l) [inline]

Set the level for the image pyramid.

Parameters:
lImage from level 0 to l will be considered during training and searching.

An interactive UI for viewing the statistical model.

Update viewing UI with new parameters. (called by callbacks)


Member Data Documentation

All the images, with labelled markpoints.

Mean shape after aligning.

Number of landmark points in a image.

Number of eigen vectors reserved for shape model.

Number of training images.

Data for BTSM: Full $\phi$.

PCA model for shapes.

level for the image pyramid.

r.height *= ?

init X offset when searching

init Y offset when searching

init scale ratio when searching

step: ?*100/sqrt(area)

r.width *= ?

r.x -= r.width*?

r.y -= r.height*?

Path info for shapes;.

double StatModel::ShapeModel::sigma2 [protected]

Data for BTSM: $\sigma^2$.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Defines