latest version v1.9 - last update 10 Apr 2010 |
Local feature based on the gradient distribution at the level of the location. More...
#include <ltiLoweGradientFeature.h>
Classes | |
class | parameters |
The parameters for the class loweGradientFeature. More... | |
Public Member Functions | |
loweGradientFeature () | |
loweGradientFeature (const parameters &par) | |
loweGradientFeature (const loweGradientFeature &other) | |
virtual | ~loweGradientFeature () |
virtual const char * | getTypeName () const |
loweGradientFeature & | copy (const loweGradientFeature &other) |
loweGradientFeature & | operator= (const loweGradientFeature &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
virtual bool | updateParameters () |
bool | apply (const channel &src, const std::list< location > &locs, std::list< dvector > &vcts) |
bool | apply (const image &src, const std::list< location > &locs, std::list< dvector > &vcts) |
bool | apply (const std::list< location > &locs, std::list< dvector > &vcts) |
bool | apply (const location &locs, dvector &dest) |
bool | generate (const image &src) |
bool | generate (const channel &src) |
Debug methods. | |
const imatrix & | getHistogramMask () const |
const matrix< float > & | getWeightMask () const |
const scaleSpacePyramid < channel > & | getMagnitudePyramid () const |
const scaleSpacePyramid < channel > & | getAnglePyramid () const |
Protected Member Functions | |
bool | computeHistograms (const int level, const tpoint< float > &pos, const float angle, matrix< double > &hists) const |
Protected Attributes | |
scaleSpacePyramid< channel > | pyrMag |
LUT and Masks | |
| |
matrix< int > | hmask |
matrix< float > | weight |
tpoint< float > | maskCenter |
int | numHistograms |
matrix< int > | ioPts |
bool | initMasks () |
Local feature based on the gradient distribution at the level of the location.
This local descriptor based was developed by David Lowe (see his paper "Distinctive Image Features from Scale-Invariant Keypoints", 2003).
Lowe proposed also proposed 1999 a similar local descriptor called "SIFT", but he changed it in his later work to used the information of one resolution only.
It computes histograms of the gradient orientation for several parts of the region delimited by a location, where the weights of each sample are determined by the magnitude of the gradient and the distance to the center of the location.
The location is divided in each axis by a given integer number h (parameters::numHistograms). This results in a total of h x h histograms and each one of them will have n x n samples, where n represents parameters::sampleRegionSize.
It can compute features for monochrome images and for color images, where the color feature is just the concatenation of the three monochromatic RGB ones.
lti::loweGradientFeature::loweGradientFeature | ( | ) |
Default constructor.
lti::loweGradientFeature::loweGradientFeature | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
lti::loweGradientFeature::loweGradientFeature | ( | const loweGradientFeature & | other | ) |
Copy constructor.
other | the object to be copied |
virtual lti::loweGradientFeature::~loweGradientFeature | ( | ) | [virtual] |
Destructor.
Compute the gradient feature for the given location.
You must call first the method generate() to indicate which image needs to be analyzed. (Otherwise it would take too much time if you need to extract several features from the same image, and the pyramid would have to be generated each time!)
bool lti::loweGradientFeature::apply | ( | const std::list< location > & | locs, | |
std::list< dvector > & | vcts | |||
) |
Extract features based on a previously generated pyramid set.
The decision if you want color or gray features is taken at the time of the pyramid generation.
bool lti::loweGradientFeature::apply | ( | const image & | src, | |
const std::list< location > & | locs, | |||
std::list< dvector > & | vcts | |||
) |
Extracts the color features at the loctions.
bool lti::loweGradientFeature::apply | ( | const channel & | src, | |
const std::list< location > & | locs, | |||
std::list< dvector > & | vcts | |||
) |
Extracts gradient features at the locations for a gray-valued input channel.
virtual functor* lti::loweGradientFeature::clone | ( | ) | const [virtual] |
Returns a pointer to a clone of this functor.
Reimplemented from lti::featureExtractor.
bool lti::loweGradientFeature::computeHistograms | ( | const int | level, | |
const tpoint< float > & | pos, | |||
const float | angle, | |||
matrix< double > & | hists | |||
) | const [protected] |
Compute the histogram for a given location.
loweGradientFeature& lti::loweGradientFeature::copy | ( | const loweGradientFeature & | other | ) |
Copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::featureExtractor.
bool lti::loweGradientFeature::generate | ( | const channel & | src | ) |
Generate and internal pyramidal representation for the given gray valued channel, which can be later analyzed with the respective apply method.
bool lti::loweGradientFeature::generate | ( | const image & | src | ) |
Generate and internal pyramidal representation for the given color image, which can be later analyzed with the respective apply method.
const scaleSpacePyramid<channel>& lti::loweGradientFeature::getAnglePyramid | ( | ) | const |
Return the gradient orientation pyramid.
const imatrix& lti::loweGradientFeature::getHistogramMask | ( | ) | const |
Return read-only reference to the histogram mask.
const scaleSpacePyramid<channel>& lti::loweGradientFeature::getMagnitudePyramid | ( | ) | const |
Return the gradient magnitude pyramid.
const parameters& lti::loweGradientFeature::getParameters | ( | ) | const |
Returns used parameters.
Reimplemented from lti::featureExtractor.
virtual const char* lti::loweGradientFeature::getTypeName | ( | ) | const [virtual] |
Returns the name of this type ("loweGradientFeature").
Reimplemented from lti::featureExtractor.
const matrix<float>& lti::loweGradientFeature::getWeightMask | ( | ) | const |
Return the weight mask.
bool lti::loweGradientFeature::initMasks | ( | ) | [protected] |
Initialize LUT and masks used to accelerate feature computation.
loweGradientFeature& lti::loweGradientFeature::operator= | ( | const loweGradientFeature & | other | ) |
virtual bool lti::loweGradientFeature::updateParameters | ( | ) | [virtual] |
Update parameters.
Reimplemented from lti::functor.
matrix<int> lti::loweGradientFeature::hmask [protected] |
Mask contains the index of the corresponding histogram for each entry.
matrix<int> lti::loweGradientFeature::ioPts [protected] |
Input/output points.
The size of this "matrix" will always be the 2 x number of rows of the mask, but indexed also with negative values.
The row 0 contains the in points and the row 1 the out points.
tpoint<float> lti::loweGradientFeature::maskCenter [protected] |
Position of the location center in the mask.
int lti::loweGradientFeature::numHistograms [protected] |
Total number of histograms computer per location.
scaleSpacePyramid<channel> lti::loweGradientFeature::pyrMag [protected] |
the pyramids
matrix<float> lti::loweGradientFeature::weight [protected] |
Mask contains the weight for each entry in the histogram.