#include <SIFT/Histogram.H>
Public Member Functions | |
Histogram (const int size=0) | |
Constructor. | |
Histogram (const Image< byte > &img) | |
Constructor. | |
Histogram (const float *input, const int size) | |
Constructor. | |
Histogram (std::vector< Histogram > histograms) | |
Constructor. | |
~Histogram () | |
Destructor. | |
float | getValue (const uint index) const |
get a value from the histogram | |
float | operator[] (const uint index) const |
Access histogram through C array index interface. | |
void | addValue (const uint index, const float value) |
add a value to the histogram | |
void | addValueInterp (const float index, const float value) |
add a value to the histogram, with linear interpolation | |
void | fill (const Image< byte > &img) |
Compute a histogram of the pixel values in an image. | |
Image< byte > | getHistogramImage (const int w, const int h, const float mini=-1, const float maxi=-1) |
get an image representation of the histogram | |
void | smooth () |
smooth the histogram | |
void | smooth (Image< double > kernel) |
float | findMax () const |
Retrieve the peak of the histogram. | |
void | findMax (int &max_loc, float &max_val) |
Retrive the peak position and value. | |
float | findMin () const |
Retrieve the valley of the histogram. | |
void | findMinMax (double &min, double &max) |
Retrieve the min and max. | |
double | getDistance (const Histogram &hist) |
Get distance between histograms. | |
void | normalize (double sum=-1) |
void | clear () |
Clear the histogram. | |
void | resize (uint size) |
resize the histogram | |
int | getSize () |
get the number of buckets in the histogram | |
uint | size () const |
get the number of buckets in the histogram | |
float | getChiSqDiff (Histogram hist2) |
get the Chi Square difference of the two histograms | |
void | divide (float div) |
Definition at line 45 of file Histogram.H.
Histogram::Histogram | ( | const int | size = 0 |
) |
Constructor.
Build a histogram with 256 bins from the pixel values in the image.
Definition at line 64 of file Histogram.C.
References Image< T >::getHeight(), Image< T >::getVal(), Image< T >::getWidth(), Image< T >::setVal(), and ZEROS.
Histogram::Histogram | ( | const float * | input, | |
const int | size | |||
) |
Constructor.
Copy the histogram from the raw input (CAUTION: we do not compute a histogram of the input values; we just copy the input histogram into our internal representation).
Definition at line 47 of file Histogram.C.
Histogram::Histogram | ( | std::vector< Histogram > | histograms | ) |
Constructor.
Definition at line 54 of file Histogram.C.
Histogram::~Histogram | ( | ) |
Destructor.
Definition at line 83 of file Histogram.C.
void Histogram::addValue | ( | const uint | index, | |
const float | value | |||
) |
add a value to the histogram
Definition at line 87 of file Histogram.C.
void Histogram::addValueInterp | ( | const float | index, | |
const float | value | |||
) |
add a value to the histogram, with linear interpolation
Definition at line 97 of file Histogram.C.
References ASSERT.
void Histogram::clear | ( | void | ) |
Clear the histogram.
Definition at line 289 of file Histogram.C.
References size().
Referenced by Histogram().
Compute a histogram of the pixel values in an image.
Definition at line 109 of file Histogram.C.
References Image< T >::getHeight(), Image< T >::getVal(), and Image< T >::getWidth().
void Histogram::findMax | ( | int & | max_loc, | |
float & | max_val | |||
) |
Retrive the peak position and value.
Definition at line 254 of file Histogram.C.
float Histogram::findMax | ( | ) | const |
Retrieve the peak of the histogram.
Definition at line 245 of file Histogram.C.
Referenced by getHistogramImage().
float Histogram::findMin | ( | ) | const |
Retrieve the valley of the histogram.
Definition at line 267 of file Histogram.C.
Referenced by getHistogramImage().
void Histogram::findMinMax | ( | double & | min, | |
double & | max | |||
) |
Retrieve the min and max.
Definition at line 276 of file Histogram.C.
float Histogram::getChiSqDiff | ( | Histogram | hist2 | ) |
get the Chi Square difference of the two histograms
Definition at line 349 of file Histogram.C.
double Histogram::getDistance | ( | const Histogram & | hist | ) |
Get distance between histograms.
Definition at line 329 of file Histogram.C.
int Histogram::getSize | ( | ) |
get the number of buckets in the histogram
Definition at line 304 of file Histogram.C.
float Histogram::getValue | ( | const uint | index | ) | const |
get a value from the histogram
Definition at line 167 of file Histogram.C.
void Histogram::normalize | ( | double | sum = -1 |
) |
normalize the hist by a value if sum is -1 then use the sum of all values in the histogram
Definition at line 315 of file Histogram.C.
float Histogram::operator[] | ( | const uint | index | ) | const |
Access histogram through C array index interface.
Definition at line 176 of file Histogram.C.
References ASSERT.
void Histogram::resize | ( | uint | size | ) |
resize the histogram
Definition at line 297 of file Histogram.C.
uint Histogram::size | ( | ) | const |
get the number of buckets in the histogram
Definition at line 309 of file Histogram.C.
Referenced by clear(), getChiSqDiff(), getDistance(), and smooth().
void Histogram::smooth | ( | Image< double > | kernel | ) |
smooth the histogram using the inputted kernel
tweight;
Definition at line 201 of file Histogram.C.
References ASSERT, Image< T >::getHeight(), Image< T >::getSize(), Image< T >::getVal(), Image< T >::getWidth(), and size().
void Histogram::smooth | ( | ) |
smooth the histogram
Definition at line 183 of file Histogram.C.