Back AAM-API documentation The AAM-Site

In file AAMShapeCollection.h:

class CAAMShapeCollection

Shape collection container and shape-aligner.

Inheritance:

CAAMShapeCollection - CAAMObject


Public Fields

[more] Assignment operator

Public Methods

[more]int AlignShapes( bool use_tangentspace )
[more] CAAMShapeCollection()
Constructor.
[more]void Expand( int nPixels )
Expands all shapes (contraction can be done by using a negative nPixels).
[more]void FromFile( FILE* fh )
Reads a set of shapes from a file.
[more]void FromFile(const CString& sFilename)
Reads a set of shapes from a file.
[more]void Insert(const CAAMShape &s)
Inserts a shape into the collection.
[more]double MaxX() const
Find the maximum x component of all shapes.
[more]double MaxY() const
Find the maximum y component of all shapes.
[more]void MeanShape(CAAMShape &meanShape) const
Calcs the mean shape of all shapes.
[more]double MeanSize() const
Returns the average shape size *before* the aligment process
[more]double MinX() const
Find the minimum x component of all shapes.
[more]double MinY() const
Find the minimum x component of all shapes.
[more]inline int NPoints() const
The number of points in each of shape
[more]inline int NShapes() const
The number of shapes in the collection
[more]const CString& Path() const
Returns the path of all shapes
[more]bool ReadDir( const CString &path, bool validate )
Scans a dir for annotations (.asf) and read shapes.
[more]bool ReadShapes( const std::vector<CString> &asfFiles, bool validate )
Reads a set of shapes.
[more]void ReferenceShape(CAAMShape &refShape) const
Calcs the mean shape of all aligned shapes and size it to mean size.
[more]void Rel2Abs( int rfactor )
Converts all shapes with relative coordinates to absolute.
[more]void Scale( const double s, const bool aroundCOG )
Scale all shapes.
[more]void ToFile(const CString& sFilename) const
Write the set of shapes to a binary file.
[more]void ToFile( FILE* fh ) const
Write the set of shapes to a binary file.
[more]int ToMatlab(const CString& sFilename, const CString& sName, const CString& sComment, bool fAppend) const
[more] ~CAAMShapeCollection()
Destructor.

Private Fields

[more]CAAMShape m_MeanShapeBeforeTS
The meanshape prior to tangent space projection (calculated during alignment)
[more]double m_dAvgSize
The average shape size (calculated during alignment)
[more]CString m_szPath
Path to the asf files (if any)


Inherited from CAAMObject:

Public Methods

ovoid Dump( const char* szPath ) const


Documentation

This class act as a container for a set of shapes. Secondary it can align the set of shapes to a normalised reference frame with respect to position, scale and orientation.

oCAAMShape m_MeanShapeBeforeTS
The meanshape prior to tangent space projection (calculated during alignment)

odouble m_dAvgSize
The average shape size (calculated during alignment)

oCString m_szPath
Path to the asf files (if any)

oinline int NShapes() const
The number of shapes in the collection

oinline int NPoints() const
The number of points in each of shape

odouble MeanSize() const
Returns the average shape size *before* the aligment process

oconst CString& Path() const
Returns the path of all shapes

o Assignment operator
Assignment operator

o CAAMShapeCollection()

Constructor.

Author:
Mikkel B. Stegmann
Version:
7-27-2000

o ~CAAMShapeCollection()

Destructor.

Author:
Mikkel B. Stegmann
Version:
7-27-2000

ovoid Insert(const CAAMShape &s)

Parameters:
s - The input shape.
Author:
Mikkel B. Stegmann
Version:
7-27-2000

oint ToMatlab(const CString& sFilename, const CString& sName, const CString& sComment, bool fAppend) const

Writes the shapes in a (NShapes x 2*NPoints) matrix in Matlab (*.m) format. The i-th row thus contains the i-th shape in xxxyy format.

Parameters:
sFilename - Filename including path to be written.
sName - The matlab variable name of the matrix.
sComment - An optional comment.
fAppend - Addend to an existing file or overwrite.
Returns:
Zero on sucess, non-zero if no shapes are stored in the collection.
Author:
Mikkel B. Stegmann
Version:
02-09-2000

oint AlignShapes( bool use_tangentspace )

Normalizes all shapes with respect to position, scale and orientation. Position normalization are done by a translation of the center of gravity to origo. Scale normalization are done by a scaling of 1/<norm2>. Rotation normalization are done by minimizing the sum of squared point distances, as described by Goodall using Singular Value Decomposition (SVD).

Returns:
Zero on succes.
Author:
Mikkel B. Stegmann
Version:
02-09-2000

ovoid MeanShape(CAAMShape &meanShape) const

Calcs the mean shape of all shapes.

Parameters:
meanShape - The output mean shape.
Author:
Mikkel B. Stegmann
Version:
7-27-2000
See Also:

ovoid ReferenceShape(CAAMShape &refShape) const

Calcs the mean shape of all aligned shapes and size it to mean size.

Parameters:
refShape - The output reference shape.
Author:
Mikkel B. Stegmann
Version:
7-27-2000
See Also:

odouble MinX() const

Returns:
The x-minimum.
Author:
Mikkel B. Stegmann
Version:
5-15-2000

odouble MaxX() const

Returns:
The x-maximum.
Author:
Mikkel B. Stegmann
Version:
5-15-2000

odouble MinY() const

Returns:
The x-minimum.
Author:
Mikkel B. Stegmann
Version:
5-15-2000

odouble MaxY() const

Returns:
The y-maximum.
Author:
Mikkel B. Stegmann
Version:
5-15-2000

ovoid Scale( const double s, const bool aroundCOG )

Scale the shapes.

Parameters:
s - Scale factor.
aroundCOG - If true the scale is being done around the cog of the shape instead of around the global center.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
3-15-2000

ovoid Expand( int nPixels )

Expands all shapes by moving each model point 'nPixels' perperdicular to the shape contour (that is: along the model point normal).

This function will expand each outer (closed) path of the shape.

No tests for crossing contours are being made as of now.

Parameters:
nPixels - The number of pixel to expand the shape with.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
4-4-2000

ovoid ToFile(const CString& sFilename) const

Write the set of shapes to a binary file.

Parameters:
sFilename - Destination filename.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
5-4-2000
See Also:
FromFile

ovoid FromFile(const CString& sFilename)

Parameters:
sFilename - The filename.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
3-15-2000

ovoid ToFile( FILE* fh ) const

Write the set of shapes to a binary file.

Parameters:
fh - Destination file handle.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
5-4-2000
See Also:
FromFile

ovoid FromFile( FILE* fh )

Parameters:
fh - An open file handle.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
3-15-2000

obool ReadShapes( const std::vector<CString> &asfFiles, bool validate )

Reads a set of shapes in the order given in the vector of strings.

Parameters:
asfFiles - Vector of asf filenames.
validate - Validates that all shapes have the same number of points.
Returns:
True on a valid training set - otherwise false.
Author:
Mikkel B. Stegmann
Version:
10-24-2000

obool ReadDir( const CString &path, bool validate )

Scans a dir for annotations (.asf) and read shapes in alphabetical order.

Parameters:
path - Full path to annotations.
validate - Validates that all shapes have the same number of points.
Returns:
True on a valid training set - otherwise false.
Author:
Mikkel B. Stegmann
Version:
10-24-2000

ovoid Rel2Abs( int rfactor )

Converts all shapes with relative coordinates to absolute. Unfortunately this requires to read the headers of all host images. VisSDK does not provide any operation for this. Thus, all images are one by one read into memory and discarded again to obtain height and width. Very costly :-(

Parameters:
rfactor - Optional reduction factor. Performs a scaling of the the shape by 1/rfactor. Default 1 i.e. no scaling.
Returns:
Nothing.
Author:
Mikkel B. Stegmann
Version:
10-25-2000


This class has no child classes.
Author:
Mikkel B. Stegmann
Version:
02-08-2000
See Also:
CAAMShape

Alphabetic index Hierarchy of classes


Back AAM-API documentation The AAM-Site