LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::geometricFeatures Class Reference

Computes features, which describe some geometric properties of a 2D shape. More...

#include <ltiGeometricFeatures.h>

Inheritance diagram for lti::geometricFeatures:
Inheritance graph
[legend]
Collaboration diagram for lti::geometricFeatures:
Collaboration graph
[legend]

List of all members.

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
geometricFeaturescopy (const geometricFeatures &other)
geometricFeaturesoperator= (const geometricFeatures &other)
virtual functorclone () const
const parametersgetParameters () 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]

Detailed Description

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.


Member Enumeration Documentation

anonymous enum

Labels for feature indices.

Enumerator:
areasize 

areasize

bordersize 

bordersize

xcog 

xcog

ycog 

ycog

xmin 

xmin

xmax 

xmax

ymin 

ymin

ymax 

ymax

m02 

m02

m03 

m03

m11 

m11

m12 

m12

m20 

m20

m21 

m21

m30 

m30

hu1 

hu1

hu2 

hu2

hu3 

hu3

hu4 

hu4

hu5 

hu5

hu6 

hu6

hu7 

hu7

j1 

j1

j2 

j2

orientation 

orientation

eccentricity 

eccentricity

compactness 

compactness

rmin 

rmin

rmax 

rmax

rmean 

rmean

dleft 

dleft

dright 

dright

dfront 

dfront

drear 

drear

numberOfFeatures 

numberOfFeatures


Constructor & Destructor Documentation

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

Parameters:
other the object to be copied
virtual lti::geometricFeatures::~geometricFeatures (  )  [virtual]

destructor


Member Function Documentation

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.

Parameters:
ioPointList list of ioPoints
features a map with the extracted features
Returns:
true if successful, false otherwise.
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.

Parameters:
borderPointList list of borderPoints
features a map with the extracted features
Returns:
true if successful, false otherwise.
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.

Parameters:
ap list of areaPoints
features a map with the extracted features
Returns:
true if successful, false otherwise.
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.

Parameters:
ioPointList list of ioPoints
features the Features as vector of doubles
Returns:
true if successful, false otherwise.
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.

Parameters:
borderPointList list of borderPoints
features the Features as vector of doubles
Returns:
true if successful, false otherwise.
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.

Parameters:
ap list of areaPoints
features the Features as vector of doubles
Returns:
true if successful, false otherwise.
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.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

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.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.


Member Data Documentation

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.

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.


The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:27:21 2010 for LTI-Lib by Doxygen 1.6.1