N-dimensional histogram objects. Most checks in this class are done using assertions; compile with
to remove parameter checking.
|
Public Member Functions |
gml_TError | Init (UInt8 dimensions, UInt32 *resolution) |
| Allocate an histogram of dimension dim. The resolution in dimension k is specified by <resolution[k]>.
|
void | Dispose () |
| Release the ressources allocated by this object.
|
gml_TError | Setup (UInt8 dimension, Float32 start, Float32 stepWidth) |
| Setup the scale of the histogram.
|
UInt8 | Dim () const |
| Return the dimension of the histogram.
|
UInt32 | Resolution (UInt8 dim=0) const |
| Return the resolution for dimension dim.
|
Float32 | Start (UInt8 dim=0) const |
| Return the lower bound for dimension dim.
|
Float32 | Step (UInt8 dim=0) const |
| Return the bucket width for dimension dim.
|
UInt32 | Samples () const |
| Return the current number of samples.
|
UInt32 | Get (UInt32 i) const |
| Return histogram value for the interval number i. Valid only for 1D histograms.
|
UInt32 | Get (UInt32 *i) const |
| Returns histogram value for the interval indexed by i.
|
UInt32 | Get (Float32 sample) const |
| Return histogram value for the interval corresponding to sample sample. Valid only for 1D histograms.
|
UInt32 | Get (Float32 *sample) const |
| Return histogram value for the interval corresponding to sample sample.
|
bool | Next (UInt32 *index, Float32 *sample) |
| Walk to the index following index and update sample accordingly Return true iff overflowing (i.e. walking back to index zero).
|
void | Reset () |
| Reset to a blank histogram.
|
void | Increment (UInt32 samples=1) |
| Increment the number of samples by samples.
|
void | Push (Float32 sample, UInt32 count=1) |
| Increment the frequency for the interval corresponding to sample sample (one dimention). returns the new value of histogram in that interval.
|
void | Push (Float32 *sample, UInt32 count=1) |
| Increment the frequency for the interval corresponding to sample sample. returns the new value of histogram in that interval.
|
void | Push (UInt32 index, UInt32 count=1) |
| Increment the frequency for the interval number i (one dimention). returns the new value of histogram in that interval.
|
void | Push (UInt32 *index, UInt32 count=1) |
| Increment the frequency for the interval number indexed by i. returns the new value of histogram in that interval.
|
Float32 | SampleMin () |
| Return the samples minimum. All the samples used to build this histogram are greater than or equal to the returned value. Return NAN if the histogram is emtpy.
|
Float32 | SampleMax () |
| Return the samples minimum. All the samples used to build this histogram are strictly lower than the returned value. Return NAN if the histogram is emtpy.
|
UInt32 | BucketMin () |
| Return the maximum sample count in a single bucket.
|
UInt32 | BucketMax () |
| Return the minimal sample count in a single bucket.
|
gml_TError | Mean (Float32 *mean, gml_TBoolean robust) |
| Compute the mean histogram value, as statistical average (robust == false) or the median (robust == true). Valid only for 1D histograms.
|
gml_TError | Moments (Float32 *mean, Float32 *deviation, gml_TBoolean robust) |
| Compute the order 1 and 2 moments of histogram, either as the statistical average and standard deviation, either as the median and median absolute deviation. Use Mean () eventually. Currently valid only for 1D histograms.
|
gml_TError | Entropy (Float32 *entropy) |
| Compute the order 1 entropy of the histogram. Currently valid only for 1D histograms.
|
void | Desaturate () |
| Remove the samples in the extremal bucket.
|
gml_TError | Quantiles (gml_TArray< Float32 > &quantiles) |
gml_TError | Scale (UInt8 a, UInt8 b) |
| Scale the histogram sample counts by a factor a/2^b.
|
gml_TError | Shift (UInt8 a) |
| Shift up all values in the histogram by a.
|
Static Public Attributes |
static gml_TError | sErrorValidFor1DOnly = (gml_TError)-1 |
static gml_TError | sErrorWrongDimension = (gml_TError)-1 |
static gml_TError | sErrorWrongResolution = (gml_TError)-1 |
static const UInt32 | sDefaultResolution = 256 |
static const UInt8 | sMomentsGaussian = 0 << 0 |
static const UInt8 | sMomentsRobust = 1 << 0 |
Protected Member Functions |
UInt32 | Index (UInt32 *sample) const |
| Flat index of a sample in fData, given its N-D index.
|
UInt32 | Index (Float32 sample) const |
| Flat index of a sample in fData, given its 1-D floating-point value.
|
UInt32 | Index (Float32 *sample) const |
| Flat index of a sample in fData, given its N-D floating-point value.
|
Static Protected Member Functions |
static void | ClassInit () |
| class setup
|
Protected Attributes |
UInt8 | fDim |
| number of dimensions of histogram array
|
UInt32 * | fData |
| array of histogram values
|
UInt32 | fSize |
| size of fData (product of resolutions)
|
UInt32 | fSamples |
| sum of histogram values
|
UInt32 * | fOffset |
| sub-dimension array sizes
|
UInt32 * | fIndex |
| temporary n-dimensional index storage
|
UInt32 * | fResolution |
| number of intervals
|
Float32 * | fStart |
| lower bound of first interval
|
Float32 * | fStep |
| width of intervals
|
Float32 * | fStepR |
| reciprocates of fStep
|
Static Protected Attributes |
static bool | sModuleInited = false |
| was ClassInit() called ?
|