#include <histogram.h>
Public Member Functions | |
void | Add (ScalarType v) |
Minimum value. | |
ScalarType | Avg () |
Returns the average of the data. | |
int | BinCount (ScalarType v, ScalarType width) |
int | BinCount (ScalarType v) |
int | BinCountInd (int index) |
ScalarType | BinLowerBound (int index) |
ScalarType | BinUpperBound (int index) |
ScalarType | BinWidth (ScalarType v) |
void | Clear () |
Reset histogram data. | |
void | FileWrite (const std::string &filename) |
Dump the histogram to a file. | |
int | MaxCount () const |
ScalarType | MaxV () |
Minimum value. | |
ScalarType | MinV () |
ScalarType | Percentile (ScalarType frac) const |
int | RangeCount (ScalarType rangeMin, ScalarType rangeMax) |
ScalarType | RMS () |
Returns the Root Mean Square of the data. | |
void | SetRange (ScalarType _minv, ScalarType _maxv, int _n, ScalarType gamma=1.0) |
ScalarType | StandardDeviation () |
Returns the standard deviation of the data. | |
ScalarType | Variance () |
Returns the variance of the data. | |
Private Member Functions | |
int | BinIndex (ScalarType val) |
Root mean square. | |
Private Attributes | |
ScalarType | avg |
Number of accumulated samples. | |
int | cnt |
Number of vaild intervals stored between minv and maxv. | |
std::vector< int > | H |
ScalarType | maxv |
Minimum value. | |
ScalarType | minv |
Range for bins. | |
int | n |
Maximum value. | |
std::vector< ScalarType > | R |
Counters for bins. | |
ScalarType | rms |
Average. |
This class implements a single-value histogram.
Definition at line 186 of file histogram.h.
void vcg::Histogram< ScalarType >::Add | ( | ScalarType | v | ) | [inline] |
Minimum value.
Add a new value to the histogram.
The statistics related to the histogram data (average, RMS, etc.) are also updated.
Definition at line 360 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::Avg | ( | ) | [inline] |
Returns the average of the data.
Definition at line 254 of file histogram.h.
int vcg::Histogram< ScalarType >::BinCount | ( | ScalarType | v, | |
ScalarType | width | |||
) | [inline] |
Definition at line 379 of file histogram.h.
int vcg::Histogram< ScalarType >::BinCount | ( | ScalarType | v | ) | [inline] |
Definition at line 373 of file histogram.h.
int vcg::Histogram< ScalarType >::BinCountInd | ( | int | index | ) | [inline] |
Definition at line 239 of file histogram.h.
int vcg::Histogram< ScalarType >::BinIndex | ( | ScalarType | val | ) | [inline, private] |
Root mean square.
Returns the index of the bin which contains a given value.
Definition at line 332 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::BinLowerBound | ( | int | index | ) | [inline] |
Definition at line 241 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::BinUpperBound | ( | int | index | ) | [inline] |
Definition at line 242 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::BinWidth | ( | ScalarType | v | ) | [inline] |
Definition at line 396 of file histogram.h.
void vcg::Histogram< ScalarType >::Clear | ( | ) | [inline] |
Reset histogram data.
Definition at line 273 of file histogram.h.
void vcg::Histogram< ScalarType >::FileWrite | ( | const std::string & | filename | ) | [inline] |
Dump the histogram to a file.
Definition at line 403 of file histogram.h.
int vcg::Histogram< ScalarType >::MaxCount | ( | ) | const [inline] |
Definition at line 416 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::MaxV | ( | ) | [inline] |
Minimum value.
Definition at line 225 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::MinV | ( | ) | [inline] |
Definition at line 224 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::Percentile | ( | ScalarType | frac | ) | const [inline] |
Returns the value corresponding to a given percentile of the data.
The percentile range between 0 and 1.
Definition at line 426 of file histogram.h.
int vcg::Histogram< ScalarType >::RangeCount | ( | ScalarType | rangeMin, | |
ScalarType | rangeMax | |||
) | [inline] |
Definition at line 385 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::RMS | ( | ) | [inline] |
Returns the Root Mean Square of the data.
Definition at line 257 of file histogram.h.
void vcg::Histogram< ScalarType >::SetRange | ( | ScalarType | _minv, | |
ScalarType | _maxv, | |||
int | _n, | |||
ScalarType | gamma = 1.0 | |||
) | [inline] |
Set the histogram values.
This method is used to correctly initialize the bins of the histogram. n is the number of valid intervals between minv and maxv. for a more robust working, the Histogram class stores also the two out of range intervals (-inf, minv] and [maxv, +inf) Each bin is left closed (eg it contains the value The gamma parameter is applied to modify the distribution of the ranges of the bins. Default uniform distibution.
Definition at line 303 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::StandardDeviation | ( | ) | [inline] |
Returns the standard deviation of the data.
Definition at line 263 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::Variance | ( | ) | [inline] |
Returns the variance of the data.
Definition at line 260 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::avg [private] |
Number of accumulated samples.
Definition at line 201 of file histogram.h.
int vcg::Histogram< ScalarType >::cnt [private] |
Number of vaild intervals stored between minv and maxv.
incrementally updated values
Definition at line 200 of file histogram.h.
std::vector<int> vcg::Histogram< ScalarType >::H [private] |
Definition at line 192 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::maxv [private] |
Minimum value.
Definition at line 195 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::minv [private] |
Range for bins.
Definition at line 194 of file histogram.h.
int vcg::Histogram< ScalarType >::n [private] |
Maximum value.
Definition at line 196 of file histogram.h.
std::vector<ScalarType> vcg::Histogram< ScalarType >::R [private] |
Counters for bins.
Definition at line 193 of file histogram.h.
ScalarType vcg::Histogram< ScalarType >::rms [private] |
Average.
Definition at line 202 of file histogram.h.