static double Deg2Rad( double deg )
- Converts from degrees to radians
static double Rad2Deg( double rad )
- Convert from radians to degrees
void PlotMeshIntoImage( CDMultiBand<TAAMPixel> image, const CAAMMesh &mesh, TAAMPixel* point_color, TAAMPixel* line_color )
-
Plots a mesh into an image.
- Parameters:
- image - The image in which the shape should be plotted.
shape - The shape to be plotted.
point_color - The point color of the mesh.
line_color - The line color of the mesh.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-3-2000
- See Also:
- PlotShapeIntoImage
void PlotShapeIntoImage( CDMultiBand<TAAMPixel> image, const CAAMShape &shape, TAAMPixel* point_color, TAAMPixel* line_color, bool drawNormals, bool drawArea, bool drawPoints, bool drawLines )
-
Draws the shape into an image with a given color.
- Parameters:
- image - The image in which the shape should be plotted.
shape - The shape to be plotted.
point_color - The point color of the shape.
line_color - The line color of the shape.
drawNormals - If true the point normals are drawn.
drawArea - If true the inside area of the shape is drawn.
drawPoints - If true the points of the shape is drawn.
drawLines - If true the lines of the shape is drawn.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-27-2000
- See Also:
- PlotMeshIntoImage
void VecCat3( CDVector &dest, const CDVector &v1, const CDVector &v2, const CDVector &v3 )
-
Concatenates three vectors.
- Parameters:
- dest - Output vector.
v1 - First input vector.
v2 - Second input vector.
v3 - Third input vector.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-14-2000
std::vector<CString> ScanSortDir( const CString &path, const CString &extension )
-
Scans and sorts a directory for files with a specfied extension.
- Parameters:
- path - Path to read from.
extension - The file extension to search for. ex. "hips".
- Returns:
- The filenames found without any path.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-27-2000
void ReadExample( const CString &filename, CDMultiBand<TAAMPixel> &img, CAAMShape &shape, int rfactor )
-
Reads an image and a shape (in the corrosponding .m-file).
- Parameters:
- filename - The filename of an annotation. Ex. "horse.asf".
img - Output image.
shape - Output shape.
rfactor - The reduction factor. Performs a scaling of the
input of 1/rfactor.
- Returns:
- Nothing (but throws CVisError)
@throws CVisError
- Author:
- Mikkel B. Stegmann
- Version:
- 3-10-2000
- See Also:
double DistEuclidianPoints(const CAAMShape &s1, const CAAMShape &s2 )
-
Calculates the point to point error between two shapes.
- Parameters:
- s1 - Shape 1.
s2 - Shape 2.
- Returns:
- The average point to point error.
- Author:
- Rune Fisker
- Version:
- 4-6-2000
- See Also:
- DistEuclidianAssBorder
double DistEuclidianAssBorder(const CAAMShape &s1, const CAAMShape &s2, CDVector* pvDist )
-
Calculates the point to curve error between two shapes.
- Parameters:
- s1 - Shape 1.
s2 - Shape 2.
pvDist - Optional pointer to an output vector containing
all point to curve distances (one for each landmark).
- Returns:
- The average point to curve error.
- Author:
- Rune Fisker
- Version:
- 4-6-2000
- See Also:
- DistEuclidianPoints
double DistEuclidianPoints(const CDVector& vX1, const CDVector& vY1, const CDVector& vX2, const CDVector& vY2 )
-
Calculates the point to point error between two shapes.
- Parameters:
- vX1 - X-positions of shape 1.
vY1 - Y-positions of shape 1.
vX2 - X-positions of shape 2.
vY2 - Y-positions of shape 2.
- Returns:
- The average point to point error.
- Author:
- Rune Fisker
- Version:
- 4-6-2000
- See Also:
- DistEuclidianAssBorder
double DistEuclidianAssBorder(const CDVector& vX1, const CDVector& vY1, const CDVector& vX2, const CDVector& vY2, CDVector* pvDist )
-
Calculates the point to curve error between two shapes.
- Parameters:
- vX1 - X-positions of shape 1.
vY1 - Y-positions of shape 1.
vX2 - X-positions of shape 2.
vY2 - Y-positions of shape 2.
pvDist - Optional pointer to an output vector containing
all point to curve distances (one for each landmark).
- Returns:
- The average point to curve error.
- Author:
- Rune Fisker
- Version:
- 4-6-2000
- See Also:
- DistEuclidianPoints
void PointOnAssBorder(const CDVector& vX1, const CDVector& vY1, const CDVector& vX2, const CDVector& vY2, CDVector& vXBorder, CDVector& vYBorder, CDVector& vDist )
-
Calculates the point to curve error between two shapes.
- Parameters:
- vX1 - X-positions of shape 1.
vY1 - Y-positions of shape 1.
vX2 - X-positions of shape 2.
vY2 - Y-positions of shape 2.
vXBorder - Output x border.
vYBorder - Output y border.
vDist - Point to curve distance for each landmark.
- Returns:
- Nothing.
- Author:
- Rune Fisker
- Version:
- 4-6-2000
- See Also:
- DistEuclidianPoints
double ProjPointOnLine(const double dXL1, const double dYL1, const double dXL2, const double dYL2, const double dXP, const double dYP, double& dXProj, double& dYProj)
-
Find the projection dProj of the point dP on the line
through dL1 and dL2. Returns the distance between dProj
and dP, if the dProj lays between dL1 and dL2 otherwise DBL_MAX.
dXL1,dYL1,dXL2,dYL2: points on line
dXP,dYP: points to project
dXProj,dYProj: projected point on the line
- Returns:
- The distance.
- Author:
- Rune Fisker
- Version:
- 11-22-1999
CString RemoveExt( const CString &s )
-
Removes the extension of a file name.
- Parameters:
- s - Input file name.
- Returns:
- File name without extension.
- Author:
- Mikkel B. Stegmann
- Version:
- 1-17-2003
CString GetExt( const CString &s )
-
Returns the extension of a file name.
- Parameters:
- s - Input filename
- Returns:
- The extension.
- Author:
- Mikkel B. Stegmann
- Version:
- 1-17-2003
bool CreateTest( const CString &file )
-
Tests if a file can be created for writing.
- Parameters:
- file - Input file name.
- Returns:
- True, if the file could be created (and deleted again).
- Author:
- Mikkel B. Stegmann
- Version:
- 1-17-2003
CString AddBackSlash( const CString &path )
-
Ensures that a string is terminated with a backslash.
If the already has a terminating backslash, nothing
is done.
- Parameters:
- path - Input string.
- Returns:
- Backslash-terminated output string.
- Author:
- Mikkel B. Stegmann
- Version:
- 1-17-2003
CString GetPath( const CString &fullfilename )
-
Returns the path of a filename.
- Parameters:
- fullfilename - Filename including any path.
- Returns:
- The path to the filename.
- Author:
- Mikkel B. Stegmann
- Version:
- 1-17-2003
CString GetFilename( const CString &filename )
-
Returns the file name of a path+file name string.
- Parameters:
- filename - Full qualified filename including path.
- Returns:
- The file name including any extension, but without any path.
- Author:
- Mikkel B. Stegmann
- Version:
- 1-17-2003
CString ForceExt( const CString &filename, const CString &ext )
-
The method tests the extension of a filename.
If the wanted extension is presented nothing is done.
If not, the extension is appended.
- Parameters:
- filename - Input file name.
ext - Wanted extension.
- Returns:
- The file name including the wanted extension.
- Author:
- Mikkel B. Stegmann
- Version:
- 1-17-2003
bool FileExists( const CString &filename )
-
Tests if a file exists.
- Parameters:
- filename - File name to test.
- Returns:
- True if the file exists.
- Author:
- Mikkel B. Stegmann
- Version:
- 1-17-2003
void ExpandImg2DyadicSize( const CDMultiBand<TAAMPixel> &img, CDMultiBand<TAAMPixel> &out )
-
The method expands an image by using zero-padding
so that the resulting image ´has width and height
that are powers of two.
- Parameters:
- img - Input image.
out - Output dyadic image.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-22-2002
void MirrorEdge( CDMatrix &m, const CDMultiBand<TAAMPixel> &mask, int edgeWidth )
-
Mirrors the edge of an arbitrary shape mask in a matrix
using poor-mans mirroring.
- Parameters:
- img - Input matrix. Overwritten by mirrored version.
mask - Image mask defining the shape.
edgeWidth - The width of the edge.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-25-2002
void MirrorEdge( CDMultiBand<TAAMPixel> &img, const CDMultiBand<TAAMPixel> &mask, int edgeWidth )
-
Mirrors the edge of an arbitrary shape mask in an image
using poor-mans mirroring.
- Parameters:
- img - Input image. Overwritten by mirrored version.
mask - Image mask defining the shape.
edgeWidth - The width of the edge.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-25-2002
bool ShapeInsideImage( const CAAMShape &s, const CDMultiBand<TAAMPixel> &img )
-
Tests if a shape is fully inside an image.
- Parameters:
- s - Input shape.
img - Input image.
- Returns:
- True if the shape is fully inside the image.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-7-2002
void CalcShapeDistances( const CAAMShape &optimized, const CAAMShape &groundTruth, double &ptpt, double &ptcrv, CDVector* pvDists )
-
Calculates optimization results.
- Parameters:
- optimized - Model shape.
groundTruth - Ground truth shape.
ptpt - Average point to point landmark error.
ptcrv - Average point to curve landmark error.
NOTICE: This is not a symmetric measure!
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-10-2000
CString Secs2Mins( double secs )
-
Converts seconds to a MM:SS string.
- Parameters:
- secs - Time in seconds.
- Returns:
- The time in MM:SS.
- Author:
- Mikkel B. Stegmann
- Version:
- 8-2-2002
CString FindVacantFilename( const CString &filename_suggestion )
-
This method finds a file name that is not 'occupied' by
adding at number to the base part of the suggested
file name.
- Parameters:
- filename_suggestion - Suggestion including extension.
- Returns:
- An unused filename resembling the suggstion.
- Author:
- Mikkel B. Stegmann
- Version:
- 9-3-2002
void SampleTextures( const CAAMShapeCollection &unalignedShapes, std::vector< CDVector > &vTextures, CAAMReferenceFrame &outputRF, const int imageReduction, const bool removeMean, const bool useTSP, const bool useConvexHull )
-
Samples a set of texture vectors given a set of
shape in absolute (i.e. image) coordinates.
- Parameters:
- unalignedShapes - Shapes in absolute coordinates.
vTextures - The set of textures.
outputRF - The output reference frame
generated for sampling the textures.
removeMean - If true the mean from each
texture vector (i.e. the DC) is
removed.
useTSP - Use tangent space projection to
align the shapes.
useConvexHull - If true the convex hull is used
to determine the extent of a shape.
- Returns:
-
- Author:
- Mikkel B. Stegmann
- Version:
- 10-29-2002
void RegistrationMovie( const CString &filename, const std::vector<CDVector> &vTexture, const CAAMReferenceFrame &rf )
-
Writes a movie file containing a set of textures
warped to their mean shape.
- Parameters:
- filename - Output movie filename.
vTexture - The set of textures.
rf - The reference frame used for sampling
the textures.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 10-29-2002
void RegistrationMovie( const CString &filename, const CString asfPath, const bool useConvexHull, const bool writeRefShape )
-
Writes a movie file containing all shapes from a
directory warped to their mean shape.
- Parameters:
- filename - Output movie filename.
asfPath - Path to annotation files.
useConvexHull - If true the convex hull is used
to determine the extent of a shape.
writeRefShape - If true the reference shape corresponding
to the movie file is written as
"regshape.asf".
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 10-29-2002
void ASF2PTS( const CString &path )
-
Converts AAM-API shape files (.asf) to the ISBE .pts format.
Output is written in the directory 'pts'.
- Parameters:
- path - Path to .asf files.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 12-3-2002
double SymmetricPtCrv( const CAAMShape &s1, const CAAMShape &s2 )
-
A symmetric poin- to-curve measure, i.e.
SymmetricPtCrv(a,b) == SymmetricPtCrv( b,a );
- Parameters:
- s1 - First shape
s2 - Second shape
- Returns:
- The average symmetric point-to-curve error over all landmarks.
- Author:
- Mikkel B. Stegmann
- Version:
- 2-9-2003
- See Also:
- DistEuclidianAssBorder
double ShapeOverlap( const CAAMShape &model, const CAAMShape > )
-
Calculates the overlap between two shapes as specified in
"Active Shape Model Segmentation With Optimal Features"
Bram van Ginneken et al., IEEE TMI 21(8) Aug. 2002.
Notice that this only makes sense for one-path closed shapes.
- Parameters:
- model - Model shape
gt - Ground truth shape
- Returns:
- The shape overlap (1 = perfect match, 0 = no overlap).
- Author:
- Mikkel B. Stegmann
- Version:
- 2-9-2003
std::vector<CString> ReadLines( const CString &filename )
-
Reads a file into an array of lines.
- Parameters:
- filename - Name of input file.
- Returns:
- A vector of text lines.
- Author:
- Mikkel B. Stegmann
- Version:
- 2-22-2003