latest version v1.9 - last update 10 Apr 2010 |
Computes features, which describe some geometric properties of a 2D shape. More...
#include <ltiGeometricFeatures.h>
Classes | |
class | parameters |
the parameters for the class geometricFeatures More... | |
Public Types | |
enum | { areasize = 0, bordersize = 1, xcog = 2, ycog = 3, xmin = 4, xmax = 5, ymin = 6, ymax = 7, m02 = 8, m03 = 9, m11 = 10, m12 = 11, m20 = 12, m21 = 13, m30 = 14, hu1 = 15, hu2 = 16, hu3 = 17, hu4 = 18, hu5 = 19, hu6 = 20, hu7 = 21, j1 = 22, j2 = 23, orientation = 24, eccentricity = 25, compactness = 26, rmin = 27, rmax = 28, rmean = 29, dleft = 30, dright = 31, dfront = 32, drear = 33, numberOfFeatures = 34 } |
Public Member Functions | |
geometricFeatures () | |
geometricFeatures (const parameters &par) | |
geometricFeatures (const geometricFeatures &other) | |
virtual | ~geometricFeatures () |
virtual const char * | getTypeName () const |
bool | apply (const lti::areaPoints &ap, dvector &features) const |
bool | apply (const lti::borderPoints &borderPointList, dvector &features) const |
bool | apply (const lti::ioPoints &ioPointList, dvector &features) const |
bool | apply (const lti::areaPoints &ap, std::map< std::string, double > &features) const |
bool | apply (const lti::borderPoints &borderPointList, std::map< std::string, double > &features) const |
bool | apply (const lti::ioPoints &ioPointList, std::map< std::string, double > &features) const |
geometricFeatures & | copy (const geometricFeatures &other) |
geometricFeatures & | operator= (const geometricFeatures &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
float | getLength (const borderPoints &bp, const parameters::eBoundaryDefinition &boundaryDefinition) const |
Static Public Attributes | |
static const int | direction [3][3] |
static const int | outerBoundaryLength [8][8] |
static const double | centralBoundaryLength [3][3] |
Computes features, which describe some geometric properties of a 2D shape.
Results can be obtained as vector or map.
The shape object may be passed as areaPoints or borderPoints. The Features are grouped. Group 0 will always be calculated, the other groups only if indicated by the corresponding parameter. The following features are available:
(T,R,S,F indicate invariance against Translation, Rotation, Scaling, Flipping)
(The quoted "..." names are the key-names for accessing the result map and at the same time the const-aliases for indices of the result vector.)
Feature Group 0 (COG means "center of gravity").
Feature Group 1 (see Sonka, Hlavac, Boyle: Image Processing, Analysis, and Machine Vision).
Feature Group 2. These are the first 7 moment invariants as described in "Visual Pattern Recognition by Moment Invariants" by Ming-Kuei Hu (IRE Transactions on Information Theory, 1962). Since values can be very small, they have additionally been scaled by the function sign(x)*log(abs(x))
Feature Group 3. (note that "compactness" is now computed in feature group 0 and j1, j2, orientation, eccentricity are now computed in feature group 1 at no extra cost)
Empty now, but keept for compatibility with group 4
Feature Group 4. All the following distances are relative to the COG. Calculation of these features is always performed using BoundaryDefinition == CentralBoundary.
anonymous enum |
Labels for feature indices.
lti::geometricFeatures::geometricFeatures | ( | ) |
default constructor
lti::geometricFeatures::geometricFeatures | ( | const parameters & | par | ) |
Create functor with the given parameters.
lti::geometricFeatures::geometricFeatures | ( | const geometricFeatures & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::geometricFeatures::~geometricFeatures | ( | ) | [virtual] |
destructor
bool lti::geometricFeatures::apply | ( | const lti::ioPoints & | ioPointList, | |
std::map< std::string, double > & | features | |||
) | const |
Considers io Points for feature computation.
Warning! Working with a map is less efficient than with a vector, but easier to use. You can access a feature by its key-name (e.g. features["areasize"]). Please refer to Class Documentation for key-names.
ioPointList | list of ioPoints | |
features | a map with the extracted features |
bool lti::geometricFeatures::apply | ( | const lti::borderPoints & | borderPointList, | |
std::map< std::string, double > & | features | |||
) | const |
Considers border Points for feature computation.
Warning! Working with a map is less efficient than with a vector, but easier to use. You can access a feature by its key-name (e.g. features["areasize"]). Please refer to Class Documentation for key-names.
borderPointList | list of borderPoints | |
features | a map with the extracted features |
bool lti::geometricFeatures::apply | ( | const lti::areaPoints & | ap, | |
std::map< std::string, double > & | features | |||
) | const |
Considers all area Points for feature computation.
Warning! Working with a map is less efficient than with a vector, but easier to use.
You can access a feature by its key-name (e.g. features["areasize"]). Please refer to Class Documentation for key-names.
ap | list of areaPoints | |
features | a map with the extracted features |
bool lti::geometricFeatures::apply | ( | const lti::ioPoints & | ioPointList, | |
dvector & | features | |||
) | const |
Considers io Points for feature computation.
The boundaryDefinition set in the parameters is currently not considered; an approximation is returned instead.
You can access a feature by its enum-name (e.g. features[eFeatures::areasize]). Please refer to Class Documentation for enum-names.
bool lti::geometricFeatures::apply | ( | const lti::borderPoints & | borderPointList, | |
dvector & | features | |||
) | const |
Compute features for the object described by the given borderPoints.
This methos always uses the boundaryDefinition "CentralBoundary" for reasons of computational efficiency.
You can access a feature by its enum-name (e.g. features[eFeatures::areasize]). Please refer to Class Documentation for enum-names.
borderPointList | list of borderPoints | |
features | the Features as vector of doubles |
bool lti::geometricFeatures::apply | ( | const lti::areaPoints & | ap, | |
dvector & | features | |||
) | const |
Compute features for the object described by the given areaPoints.
The boundaryDefinition set in the parameters will be considered.
You can access a feature by its enum-name (e.g. features[eFeatures::areasize]). Please refer to Class Documentation for enum-names.
ap | list of areaPoints | |
features | the Features as vector of doubles |
virtual functor* lti::geometricFeatures::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::globalFeatureExtractor.
geometricFeatures& lti::geometricFeatures::copy | ( | const geometricFeatures & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::globalFeatureExtractor.
float lti::geometricFeatures::getLength | ( | const borderPoints & | bp, | |
const parameters::eBoundaryDefinition & | boundaryDefinition | |||
) | const |
Compute the length of the given border according to the given boundary definition.
const parameters& lti::geometricFeatures::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::globalFeatureExtractor.
virtual const char* lti::geometricFeatures::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("geometricFeatures")
Reimplemented from lti::globalFeatureExtractor.
geometricFeatures& lti::geometricFeatures::operator= | ( | const geometricFeatures & | other | ) |
Alias for copy operator.
other | the functor to be copied |
Reimplemented from lti::functor.
const double lti::geometricFeatures::centralBoundaryLength[3][3] [static] |
Helper array to compute the length of the central boundary.
When iterating through the borderPoints, a step can be defined as the difference from the current point to the last point. Decomposing this step into x and y step and incrementing each by 1, we have a tuple (0-2,0-2) with (1,1) meaning no step (which is invalid). Using these steps as indices to this array, the step's contribution to the central boundary length is returned.
For a definition of the central boundary, see eBoundaryDefinition.
const int lti::geometricFeatures::direction[3][3] [static] |
helper array for chain codes, stores direction (e.g.
North) depending on x/y step. x/y step may be -1/0/1. Add 1 -> 0/1/2. Use as index, e.g. direction[xStep+1][yStep+1] to obtain direction. direction[1][1] means neither x nor y step -> Invalid.
const int lti::geometricFeatures::outerBoundaryLength[8][8] [static] |
Helper array that stores the length of the outer boundary contributed by two steps in the directions that serve as index.
E.g. one step N, then one step NW -> outerBoundaryLength[NW][N]. Invalid step sequences are marked with a value of -1.
For a definition of the outer boundary, see eBoundaryDefinition.