This class defined the geomtrical reference frame of an
AAM. Hence, it is the spatial layout where all texture
sampling takes place.
The main objective of this class is to provide fast
conversions from a shape-free image to a texture vector
and vice versa.
bool UseConvexHull() const
- Returns true of the convex hull determines the shape extent
const CAAMShape& RefShape() const
- Returns the reference shape
int NTextureSamples() const
- Returns the number of texture samples in the texture model
const CAAMMesh& RefMesh() const
- Returns the reference mesh
const CDMultiBand<TAAMPixel> & MaskImage() const
- Returns the mask image
CAAMReferenceFrame()
-
Constructor. Sets up an empty reference frame.
Use Setup() to make such an object any useful.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
CAAMReferenceFrame& operator=(const CAAMReferenceFrame &rf)
-
Assignment operator.
- Parameters:
- rf - Object to copy from.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-13-2002
CAAMReferenceFrame( const CAAMReferenceFrame &rf )
-
Copy constructor.
- Parameters:
- rf - Reference frame object to be copied by construction.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-13-2002
void Setup( const CAAMShape &referenceShape, const bool useConvexHull )
-
Sets up the class with the reference shape
and information about how to determine the extent
of the shape.
- Parameters:
- referenceShape - The reference shape.
useConvexHull - If true the convex hull of the reference
shape is used to determine its extent.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
void ToFile( FILE* fh ) const
-
This method writes the class data to disk. Actually it is
only the reference shape and the convex hull option that
is written. The rest is reconstructed during read.
- Parameters:
- fh - Open file handle to a binary file.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-13-2002
void FromFile( FILE* fh )
-
This method reads the class data from disk. Actually it is
only the reference shape and the convex hull option that
is read. The rest is reconstructed.
- Parameters:
- fh - Open file handle to a binary file.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-13-2002
void DebugDump()
-
This method writes the reference shape, the mask image
and a test of the Image2Vector() and Vector2image() to
the current directory.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
~CAAMReferenceFrame()
-
Destructor. Deletes any reference shape, mesh and mask image.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
void CalcMaskImage( const bool useConvexHull )
-
This method calculates a reference mask image, where the
shape area is set to 255 and the background to zero.
The resulting image is stored in 'm_pMaskImage'.
- Parameters:
- useConvexHull - If true the convex hull is used to define
the extent of the reference shape.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
void CalcScanLines()
-
This method calculates the scanlines of the mask image.
A scanline is a subpart of a horsontal image line that
is occupied but a subpart of the reference shape.
The resulting scanlines are used for quick'n'easy conversion
from spatial to vector layout (and back).
Scanlines are stored in 'm_ScanlineParts'.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
double RefShapeWidth() const
-
Returns the width of the reference shape.
- Returns:
- The width.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
double RefShapeHeight() const
-
Returns the height of the reference shape.
- Returns:
- The height.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
void Image2Vector( const CDMultiBand<TAAMPixel> &refImg, CDVector &v ) const
-
This method performs a quick conversion from a
shape-free image to a texture vector.
- Parameters:
- refImg - Destination reference image.
v - Input texture vector.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
- See Also:
- Vector2Image
void Vector2Image( const CDVector &v, CDMultiBand<TAAMPixel> &outImg ) const
-
This method performs a quick conversion from a
texture vector to a shape-free image.
- Parameters:
- refImg - Destination reference image.
v - Input texture vector.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
- See Also:
- Vector2Matrix, Image2Vector
void Vector2Matrix( const CDVector &v, CDMatrix &m ) const
-
This method performs a quick conversion from a
texture vector to a shape-free image on matrix
form.
Will currently only work on single band AAMs.
- Parameters:
- refImg - Destination reference image.
v - Input texture vector.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
- See Also:
- Vector2Matrix, Image2Vector
int RefImageWidth() const
-
Returns the width of the reference image.
- Returns:
- The width.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
int RefImageHeight() const
-
Returns the height of the reference image.
- Returns:
- The height.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002
bool FindTriangle( const CAAMPoint &p, unsigned short &triangle, double &alpha, double &beta, double &gamma ) const
-
Find the corresponding triangle in the source mesh for a point.
- Parameters:
- p - Input point
triangle - Triangle index.
alpha - Relative position on triangle (barycentric coordinate).
beta - Relative position on triangle (barycentric coordinate).
gamma - Relative position on triangle (barycentric coordinate).
- Returns:
- True if the point is inside the source mesh.
- Author:
- Mikkel B. Stegmann
- Version:
- 6-7-2002