The FeatureVector class. More...
#include <SIFT/FeatureVector.H>
Public Member Functions | |
FeatureVector (int xSize=4, int ySize=4, int zSize=8, bool wrapZ=true) | |
Constructor, xSize,ySize,zSize the size of bins, wrap zBin ? | |
~FeatureVector () | |
Destructor. | |
float | getValue (const uint index) const |
get a value from the feature vector | |
void | addValue (const float x, const float y, const float orientation, const float value) |
add value | |
void | normalize () |
normalize Vector | |
void | threshold (const float limit) |
threshold Vector and renormalize | |
void | toByteKey (std::vector< byte > &dest, float thresh=0.2, bool norm=true) |
Convert to byte, to get ready for injection into a Keypoint. | |
int | size () |
int | getXSize () |
Return the x Bin Size. | |
int | getYSize () |
Return the y Bin Size. | |
int | getZSize () |
Return the z Bin Size. | |
Image< PixRGB< byte > > | getFeatureVectorImage (std::vector< byte > &fv) |
Get the feature vector image. | |
double | getMag () |
Get the magnitude of the feature vector. | |
std::vector< float > | getFeatureVector () const |
Get the raw feature vector. |
The FeatureVector class.
Stores temporary SIFT Keypoint features. The final feature vector in a SIFT Keypoint object is composed of bytes while here we use floats and are an intermediary onto which we can do normalizations and such before injecting into a Keypoint. A FeatureVector has 128 bins, corresponding to 4 bins for x * 4 bins for y * 4 bins for orientation.
Definition at line 56 of file FeatureVector.H.
FeatureVector::FeatureVector | ( | int | xSize = 4 , |
|
int | ySize = 4 , |
|||
int | zSize = 8 , |
|||
bool | wrapZ = true | |||
) |
Constructor, xSize,ySize,zSize the size of bins, wrap zBin ?
Definition at line 45 of file FeatureVector.C.
FeatureVector::~FeatureVector | ( | ) |
Destructor.
Definition at line 51 of file FeatureVector.C.
void FeatureVector::addValue | ( | const float | x, | |
const float | y, | |||
const float | orientation, | |||
const float | value | |||
) |
add value
Linearly add a value. Indices are as follows: 0.0 <= x <= 4.0 : [0 .. 3] x=2.0 falls equally between bins 1 and 2; 0.0 <= y <= 4.0 : [0 .. 3] y=2.0 falls equally between bins 1 and 2; 0.0 <= o <= 8.0 : [0 .. 7] o=4.0 falls equally between bins 3 and 4
Definition at line 55 of file FeatureVector.C.
Referenced by HistogramOfGradients::addToBin(), and ColorHist::createFeatureVector().
std::vector<float> FeatureVector::getFeatureVector | ( | ) | const [inline] |
Get the raw feature vector.
Definition at line 108 of file FeatureVector.H.
Referenced by JunctionHOG::calculateJunctionHistogram(), ColorHist::createFeatureVector(), and HistogramOfGradients::normalizeFeatureVector().
Image< PixRGB< byte > > FeatureVector::getFeatureVectorImage | ( | std::vector< byte > & | fv | ) |
Get the feature vector image.
Definition at line 214 of file FeatureVector.C.
References Image< T >::clear(), drawDisk(), Point2D< T >::i, and NO_INIT.
double FeatureVector::getMag | ( | ) |
Get the magnitude of the feature vector.
Definition at line 251 of file FeatureVector.C.
References sqrt().
float FeatureVector::getValue | ( | const uint | index | ) | const |
get a value from the feature vector
Definition at line 190 of file FeatureVector.C.
References ASSERT.
int FeatureVector::getXSize | ( | ) | [inline] |
Return the x Bin Size.
Definition at line 93 of file FeatureVector.H.
Referenced by HistogramOfGradients::normalizeFeatureVector().
int FeatureVector::getYSize | ( | ) | [inline] |
Return the y Bin Size.
Definition at line 96 of file FeatureVector.H.
Referenced by HistogramOfGradients::normalizeFeatureVector().
int FeatureVector::getZSize | ( | ) | [inline] |
Return the z Bin Size.
Definition at line 99 of file FeatureVector.H.
Referenced by HistogramOfGradients::addToBin(), and HistogramOfGradients::normalizeFeatureVector().
void FeatureVector::normalize | ( | ) |
normalize Vector
Definition at line 154 of file FeatureVector.C.
Referenced by threshold(), and toByteKey().
void FeatureVector::threshold | ( | const float | limit | ) |
threshold Vector and renormalize
Definition at line 174 of file FeatureVector.C.
References normalize().
Referenced by toByteKey().
void FeatureVector::toByteKey | ( | std::vector< byte > & | dest, | |
float | thresh = 0.2 , |
|||
bool | norm = true | |||
) |
Convert to byte, to get ready for injection into a Keypoint.
CAUTION: this calls normalize(), then threshold(0.2f), then normalize() again (all of which modify the FeatureVector), then converts all values multiplied by 512 to byte with clamping. Call this only when you are ready to discard the FeatureVector and only keep the final SIFT Keypoint byte data.
Definition at line 197 of file FeatureVector.C.
References normalize(), and threshold().