std::vector<CAAMPointInfo> m_vPointAux
- Auxillary point data
std::vector<float> m_vUser1
- User-defined field 1
std::vector<float> m_vUser2
- User-defined field 2
std::vector<float> m_vUser3
- User-defined field 3
CString m_szASFVer
- Current ASF version number
int m_iNbPoints
- The number of points
bool m_bAbsPointCoordinates
- Indicates if the point coordinates is in relative or absolute format
CString m_szHostImage
- Optional 'host image' filename including full path.
inline const CString& HostImage() const
- Host image (if any)
void SetHostImage( const CString &hostImageFilename )
- Returns the host image (if any).
double Width() const
- Shape width
double Height() const
- Shape height
inline const int NPoints() const
- The number of shape points
bool IsAbs() const
- Returns true if the shape is in absolute coordinates
std::vector<CAAMPointInfo> & PointAux()
- Returns the complete point aux vector of the shape
const std::vector<CAAMPointInfo> & PointAux() const
- Returns the complete point aux vector of the shape
CAAMShape(int nbPoints)
-
Constructs a shape with 'nbPoints' points.
Defaults to absolute point coordinates and single closed path connectivity.
- Parameters:
- nbPoints - The number of points the shape should contain.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-8-2000
- See Also:
- SetClosedPathConnectivity
CAAMShape( const CDVector &v )
-
Constructs a shape from a vector.
Defaults to absolute point coordinates and single closed path connectivity.
- Parameters:
- v - The input vector.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-8-2000
- See Also:
- SetClosedPathConnectivity
CAAMShape( const CAAMShape &s )
-
Copy contructor.
- Parameters:
- s - The input shape.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-8-2000
void SetClosedPathConnectivity()
-
Manipulates the aux point info such that the shape points
is interpreted as one closed outer path defined clock-wise
with repect to it's normals.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-26-2000
CDVector& operator=(double value)
-
Sets all x and y compoments of a shape equal to a double.
[Actually only used when calculating a mean shape --
since we want to accumulate in an empty shape].
- Parameters:
- value - The value to set all shape points to.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-26-2000
CAAMShape& operator=(const CAAMShape &s)
-
Set one shape equal another.
- Parameters:
- s - The shape to copy.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-9-2000
void CopyData( const CAAMShape &s )
-
Copies all data from a shape to this.
Called from the assignment operator.
- Parameters:
- s - Shape to copy data from.
- Returns:
- Nothing,
- Author:
- Mikkel B. Stegmann
- Version:
- 10-20-2000
CDVector& operator=(const CVisDVector &vIn)
-
Set the shape to be equal an xxx-yyy formatted vector.
NOTE: this method does not manipulate any connectivity
(i.e. point aux) info. So, if the shape beforehand was
empty one should call SetClosedPathConnectivity() afterwards
this call to obtain sensible point aux info.
- Parameters:
- vIn - xxx-yyy formatted vector.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-26-2000
~CAAMShape()
-
- Author:
- Mikkel B. Stegmann
- Version:
- 5-15-2000
void Rotate( const double theta, const bool aroundCOG )
-
Rotates the shape 'theta' radians.
- Parameters:
- theta - Rotation angle in radians.
aroundCOG - If true the rotation 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
void Translate( const CAAMPoint &p )
-
- Parameters:
- p - The offset to translate.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-15-2000
void Translate( const double x, const double y )
-
- Parameters:
- - x X-translation.
- y Y-translation.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-15-2000
double ShapeSize() const
-
- Returns:
- The 2-norm.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-15-2000
double MinX() const
-
- Returns:
- The x-maximum.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-15-2000
double MaxX() const
-
- Returns:
- The x-maximum.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-15-2000
double MinY() const
-
- Returns:
- The y-minimum.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-15-2000
double MaxY() const
-
- Returns:
- The y-maximum.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-15-2000
void Scale( const double s, const bool aroundCOG )
-
Scales the shape.
- 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
CAAMPoint COG() const
-
Calculates the center of gravity of the shape
(actually it's the center of the centroid).
- Parameters:
- p - cog output.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-15-2000
void COG( double &x, double &y ) const
-
Calculates the center of gravity of the shape
(actually it's the center of the centroid).
- Parameters:
- - x X cog output.
- y X cog output.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-15-2000
double Normalize()
-
Normalizes the shape by translating it's center of gravity
to origo and scale by the reciprocal of the 2-norm.
- Returns:
- The 2-norm of the shape seen as a 2*nbPoint vector after
the translation to origo.
- Author:
- Mikkel B. Stegmann
- Version:
- 02-08-2000
int SetPoint( int i, const double &x, const double &y)
-
Overwrites the i'th point.
- Returns:
- Zero.
- Author:
- Mikkel B. Stegmann
- Version:
- 02-10-2000
int SetPoint( const int i, const CAAMPoint &p )
-
Overwrites the i'th point. If the point doesn't exists,
non-zero is returned.
- Returns:
- Zero on success, non-zero if the point doesn't exists.
- Author:
- Mikkel B. Stegmann
- Version:
- 02-10-2000
int GetPoint( int i, double &x, double &y) const
-
Returns the i'th point.
- Returns:
- Zero.
- Author:
- Mikkel B. Stegmann
- Version:
- 02-10-2000
CAAMPoint GetPoint( int i ) const
-
Returns the i'th point.
- Returns:
- The i'th point.
- Author:
- Mikkel B. Stegmann
- Version:
- 02-10-2000
void Resize(int length, double* storage)
-
Change number of shape points in the shape.
Note: Destroys *all* current point data and point info data.
- Parameters:
- length -
storage -
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-26-2000
- See Also:
void AlignTransformation( const CAAMShape &ref, double &scale, double &theta, CAAMPoint &t ) const
-
Returns the transformation that aligns this to 'ref' with respect to pose.
- Parameters:
- ref - The reference shape.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 03-06-2000
double AlignTo( const CAAMShape &ref, double* pTheta )
-
Aligns this to 'ref' with respect to pose.
- Parameters:
- ref - The reference shape.
pTheta - Optional pointer to return the rotation
carried out on this.
- Returns:
- The 2-norm of the this shape seen as a 2*nbPoint vector after
the translation to origo but before the scale done to fit
'ref'.
- Author:
- Mikkel B. Stegmann
- Version:
- 03-06-2000
double GetRotation( const CAAMShape &ref ) const
-
Get the rotation between two shapes by minimizing the sum of
squared point distances, as described by Goodall (and Bookstein)
using Singular Value Decomposition (SVD).
Note that both shapes must be normalized with respect to scale and
position beforehand. This could be done by using
CAAMSAhape::Normalize().
- Returns:
- The estimated angle, theta, between the two shapes.
- Author:
- Mikkel B. Stegmann
- Version:
- 02-09-2000
void FromFile( FILE* fh )
-
- Parameters:
- fh - An open file handle.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-15-2000
void ToFile( FILE* fh ) const
-
Write the shape to a binary file.
- Parameters:
- sFilename - Destination filename.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-4-2000
- See Also:
- FromFile
void Param2PoseVec( const double scale, const double theta, const double tx, const double ty, CDVector &poseVec )
-
Converts pose parameters: scale, theta, tx, ty to a pose vector.
The pose vector will be in the format:
[ s, theta, tx, ty ]
where s = scale-1
- Parameters:
- scale - Scale input.
theta - Rotational input.
tx - X translation input.
ty - Y translation input.
poseVec - The output pose vector.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-15-2000
- See Also:
- PoseVec2Param, Displace
void PoseVec2Param( const CDVector &poseVec, double &scale, double &theta, double &tx, double &ty )
-
Converts a pose vector to pose parameters: scale, theta, tx, ty.
The pose vector are expected to be in the format:
[ s, theta, tx, ty ]
where s = scale-1
- Parameters:
- poseVec - The input pose vector.
scale - Scale output.
theta - Rotational output.
tx - X translation output.
ty - Y translation output.
- Returns:
-
- Author:
- Mikkel B. Stegmann
- Version:
- 3-27-2000
- See Also:
- Param2PoseVec, Displace
void Displace( const CDVector &poseVec )
-
Displaces the shape around it's center of gravity using a
displacement vector.
- Parameters:
- poseVec - The input pose vector.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 3-15-2000
- See Also:
- PoseToParam
bool IsInsidePath( const CAAMPoint &p, const int path_start ) const
-
Tests if the point 'p' is inside the path starting at position
'path_start'. Rarely used. Primary a helper function to
IsInside.
- Parameters:
- p - The point to test for.
path_start - The point index where a path starts
- Returns:
- True if 'p' is inside
- Author:
- Mikkel B. Stegmann
- Version:
- 5-4-2000
- See Also:
- IsInside
bool IsInside( const CAAMPoint &p, bool bBoundTest ) const
-
Tests if the point 'p' belongs to the shape. In the current
version all shape points are assumes to be ordered points in
a n-point polygon with no holes.
For example used to clean up the meshes (removing unwanted
triangles from the triangulisation).
- Parameters:
- - 'p' The test point.
bBoundTest - Flags wheather a bounding box test should be
performed prior to the exact test.
- Returns:
- True if 'p' is inside.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-4-2000
void Expand( int nPixels )
-
Expands the shape 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
void Normal( const int i, CAAMPoint& p1, CAAMPoint& p2, const double dist ) const
-
Finds the normal to the i'th point on the shape.
If the point should be a single point the normal points
is defined to be equal to the point it self.
- Parameters:
- i - Index of point.
p1 - Reference to the outside normal point.
p2 - Reference to the inside normal point.
dist - The desired distance from p[1|2] to the i-th point.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-4-2000
void NormalDisplacement( const int i, const double dist )
-
Displaces the i-th point along the normal.
- Parameters:
- i - Index of point.
dist - The distance to move the point
(>0 move point outwards, <0 inwards).
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 12-6-2000
- See Also:
- Normal
bool WriteASF( const CString &filename, const int image_width, const int image_height )
-
Writes the shape to a ASF file. Remember asf's are always
in relative coordinates. Se format description else where.
- Parameters:
- filename - Output filename.
image_width - The image the coord. is relative to.
image_height - The image the coord. is relative to.
- Returns:
- true on success, false on errors
- Author:
- Mikkel B. Stegmann
- Version:
- 4-25-2000
- See Also:
- ReadASF
bool WriteASF0_90( const CString &filename, const int image_width, const int image_height )
-
Writes the shape to a ver. 0.90 ASF file. Remember asf's are always
in relative coordinates. Se format description else where.
- Parameters:
- filename - Output filename.
image_width - The image the coord. is relative to.
image_height - The image the coord. is relative to.
- Returns:
- true on success, false on errors
- Author:
- Mikkel B. Stegmann
- Version:
- 7-2-2001
- See Also:
- ReadASF
bool ReadASF( const CString &filename )
-
Reads an ver. 0.90 .asf into relative coordinates.
Se format description else where.
- Parameters:
- filename - Input filename.
- Returns:
- true on success, false on errors
- Author:
- Mikkel B. Stegmann
- Version:
- 4-25-2000
- See Also:
- WriteASF
bool ReadASF0_90( const CString &filename )
-
Reads an ver. 0.90 .asf into relative coordinates.
Se format description else where.
- Parameters:
- filename - Input filename.
- Returns:
- true on success, false on errors
- Author:
- Mikkel B. Stegmann
- Version:
- 4-25-2000
- See Also:
- WriteASF
void Abs2Rel( const CString hostImagePath )
-
Converts shape coordinates from absolute to relative by
using the hostimage.
- Author:
- Mikkel B. Stegmann
- Version:
- 11-15-2000
void Rel2Abs( const CString hostImagePath )
-
Converts shape coordinates from relative to absolute by
using the hostimage.
- Author:
- Mikkel B. Stegmann
- Version:
- 11-15-2000
void Abs2Rel( const int image_width, const int image_height )
-
Converts shape coordinates from absolute to relative.
Relative coordinates are specified as:
x_relative = x_abs/image_width
y_relative = y_abs/image_height
- Parameters:
- image_width - The image the coord. should be relative to.
image_height - The image the coord. should be relative to.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-25-2000
- See Also:
- Rel2Abs
void Rel2Abs( const int image_width, const int image_height )
-
Converts shape coordinates from relative to absolute.
Relative coordinates are specified as:
x_relative = x_abs/image_width
y_relative = y_abs/image_height
- Parameters:
- image_width - The image the coord. is relative to.
image_height - The image the coord. is relative to.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-25-2000
- See Also:
- Abs2Rel
void AddPath( const CAAMShape &shape, const CAAMPointInfo &pointType )
-
Adds a path to the shape. All added point inherits the
given pointtype.
- Parameters:
- shape - A shape containing one path.
pointType - The pointtype of the added points.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 4-26-2000
void ReversePointOrder()
-
Reverses the point point ordering.
Used when a clock-wise outer path shall converted to a
counter-clock wise hole.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-2-2000
std::vector<int> GetPaths() const
-
Extracts the starting positions of each path in the shape by
a simple linear search. The starting position is identified
by a change in path id (saved in the m_vPointAux member).
- Returns:
- A vector of path starting positions.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-3-2000
int PathLen( const int startPosition ) const
-
Returns the length of a path.
- Parameters:
- startPosition - The starting position of the path.
- Returns:
- The path length.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-5-2000
- See Also:
- GetPaths
CAAMShape ExtractPath( const int startPosition ) const
-
Extracts one path from a shape into a new shape.
- Parameters:
- startPosition - The starting position of the path.
- Returns:
- The path as a new shape.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-5-2000
- See Also:
- PathLen, GetPaths
void AddShapeExtends( int nPixels )
-
Adds an extra outer path on each outer path in the
distance of 'nPixels' along the point normal.
This method is primary used in conjunction with
the "do not use the convex hull" feature. In such
a case one often still wants a certain neighborhood
of the shape to be included in the model.
- Parameters:
- nPixels - The size of the extents.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-5-2000
void SetPointInfoFlagsInPath( const int startPosition, const int flags )
-
Sets all flags in one path to the same value.
- Parameters:
- startPosition - Starting position of the path.
flags - The flags.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-9-2000
void AddInterior(const int interations)
-
Add articifial interior points to the shape by making a
Delaunay triangulation and adding the centroid of each
triangle. This is done iteratively. Default is one iteration
- Parameters:
- interations - Controls the number of artificial points.
One iteration equals one triangulation.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 12-12-2000
bool ConsistencyCheck()
-
Tests if any interior points has gone outside
outer path of the shape.
- Returns:
- True if the shape looks ok, false if not.
- Author:
- Mikkel B. Stegmann
- Version:
- 12-12-2000
void MakeBorderShape( int size )
-
Converts a one path shape into a border shape by adding
two symmetric borders: an inside (a hole) and an outside
border.
No checks for folding paths are done as of now.
- Parameters:
- size - The size of the border in pixels.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 7-27-2000
CAAMShape operator+(const CVisDVector &v) const
-
Plus operator.
- Parameters:
- v - Vector to add.
- Returns:
- The addition of this and 'v'.
- Author:
- Mikkel B. Stegmann
- Version:
- 10-20-2000
CAAMShape operator-(const CVisDVector &v) const
-
Minus operator.
- Parameters:
- v - Vector to add.
- Returns:
- The subtraction of this and 'v'.
- Author:
- Mikkel B. Stegmann
- Version:
- 10-20-2000
void GetHostImage( CDMultiBand<TAAMPixel> &dest, const CString &path, const int rfactor ) const
-
Retrives the image connected to the shape.
As of now it's loaded from disk using the HostImage() member
in the shape.
- Parameters:
- dest - The destination image.
path - The path to the .asf file.
rfactor - Optional reduction factor. Performs a scaling of the
the shape by 1/rfactor. Default 1 i.e. no scaling.
- Returns:
- Nothing.
@throws CVisFileIOError
- Author:
- Mikkel B. Stegmann
- Version:
- 10-24-2000
double Area( bool use_covex_hull ) const
-
Returns the total area of the shape (with holes excluded).
- Parameters:
- use_covex_hull - Use the convex hull of the shape for
area calculation (default false).
- Returns:
- The area.
- Author:
- Mikkel B. Stegmann
- Version:
- 11-15-2000
CAAMShape CalcConvexHull() const
-
Calculates the convex hull of each path in the shape.
The calulation is built upon the geometrical fact that the
homogenous point matrix: [ p1x p2x p3x ; p1y p2y p3y ; 1 1 1 ]
is positive if p1, p2, p3 is a convex segment and negative if
concave. Note: this holds for a clock-wise ordering of p1,p2,p3.
Any open paths are considered cyclic in the concavity calulation.
Remember that paths should be defined clock-wise in the asf format.
BUG COMMENT: This does not seem to work with multiple paths.
- Returns:
- A convex version of this shape w.r.t. each path.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-2-2001
- See Also:
- IsConvex
bool IsConvex() const
-
Tests if the shap is convex w.r.t. each path.
This call is rather expensive, since it spaws a call to CalcConvexHull().
- Returns:
- True on convex, false on concave.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-2-2001
- See Also:
- CalcConvexHull
void RemovePoint( const int i )
-
Removes the i-th point from the shape. Since this require
massive reordering of the preceeding point connectivity this is
actually a very expensive call [a fairly ugly in it's implementation] :-(
- Parameters:
- i - The index of the point to remove.
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 5-2-2001
std::vector<float> & UserField( const int field_nb )
-
Returns the reference of the
user defined field vector number 'field_nb'.
- Parameters:
- field_nb - Field number [1-3].
- Returns:
- A reference to the specified field vector.
- Author:
- Mikkel B. Stegmann
- Version:
- 7-2-2001
- See Also:
const std::vector<float> & UserField( const int field_nb ) const
-
Returns the value of the user defined field
vector number 'field_nb'.
- Parameters:
- field_nb - Field number [1-3].
- Returns:
- A float holding the value of the field.
- Author:
- Mikkel B. Stegmann
- Version:
- 7-2-2001
- See Also:
void AllocateUserFields()
-
Allocates room for the three user defined fields.
Notice that the user defined fields is *not* allocated by default.
In order to preserved memory the user must to this explicitly by
using AllocateUserFields();
- Returns:
- Nothing.
- Author:
- Mikkel B. Stegmann
- Version:
- 7-2-2001