The base class for shape models. More...
#include <BeoSub/CannyModel.H>
Public Member Functions | |
ShapeModel (const int ndims, const double thresh, double *dims, const bool debug=false) | |
Constructor. | |
virtual | ~ShapeModel () |
Destructor. | |
double | calcDist (double p[], const Image< float > &distMap) const |
Compute distance between model (defined by p) and distance map. | |
double | getThreshold () const |
Get the distance threshold. | |
int | getNumDims () const |
Get the number of dimensions. | |
double * | getDimensions () const |
Get the dimension vector. | |
void | setDimensions (double *in) |
Set the dimension vector. | |
Protected Member Functions | |
float | getDistVal (const double x, const double y, const Image< float > &distMap, Image< PixRGB< byte > > &xdisp) const |
get distance value at one location, with optional display | |
virtual float | getDist (double p[], const Image< float > &distMap, Image< PixRGB< byte > > &xdisp) const =0 |
Core of the distance computation. |
The base class for shape models.
This base class defines a basic interface by which an shape optimizer may mathematically represent a shape and get a measurement of how well the current shape matches with a Canny edge map.
Definition at line 60 of file CannyModel.H.
ShapeModel::ShapeModel | ( | const int | ndims, | |
const double | thresh, | |||
double * | dims, | |||
const bool | debug = false | |||
) |
Constructor.
Constructor
ndims | number of dimensions in the model | |
thresh | threshold for a shape match | |
debug | if true, open an XWindow and show debug drawings. |
Definition at line 45 of file CannyModel.C.
ShapeModel::~ShapeModel | ( | ) | [virtual] |
double ShapeModel::calcDist | ( | double | p[], | |
const Image< float > & | distMap | |||
) | const |
Compute distance between model (defined by p) and distance map.
Programmer's note: calcDist() is a wrapper around getDist() which does the actual distance computation. Do not overload calcDist(), overload getDist() instead.
Definition at line 122 of file CannyModel.C.
References rutz::shared_ptr< T >::get(), Image< T >::getDims(), getDist(), Image< T >::getWidth(), rutz::shared_ptr< T >::reset(), and toRGB().
double * ShapeModel::getDimensions | ( | ) | const |
Get the dimension vector.
Definition at line 73 of file CannyModel.C.
virtual float ShapeModel::getDist | ( | double | p[], | |
const Image< float > & | distMap, | |||
Image< PixRGB< byte > > & | xdisp | |||
) | const [protected, pure virtual] |
Core of the distance computation.
This is a pure virtual function, derived classes need to implement it.
Implemented in RectangleShape, SquareShape, OctagonShape, CircleShape, and ParallelShape.
Referenced by calcDist().
float ShapeModel::getDistVal | ( | const double | x, | |
const double | y, | |||
const Image< float > & | distMap, | |||
Image< PixRGB< byte > > & | xdisp | |||
) | const [protected] |
get distance value at one location, with optional display
Definition at line 91 of file CannyModel.C.
References Image< T >::coordsOk(), drawDisk(), Image< T >::getHeight(), Image< T >::getValInterp(), and Image< T >::getWidth().
Referenced by ParallelShape::getDist(), RectangleShape::getDist(), CircleShape::getDist(), OctagonShape::getDist(), and SquareShape::getDist().
int ShapeModel::getNumDims | ( | ) | const |
Get the number of dimensions.
Definition at line 70 of file CannyModel.C.
double ShapeModel::getThreshold | ( | ) | const |
Get the distance threshold.
Definition at line 66 of file CannyModel.C.
void ShapeModel::setDimensions | ( | double * | in | ) |
Set the dimension vector.
Definition at line 83 of file CannyModel.C.