Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Histogram Class Reference

A class allowing N-D histograms to be represented, calculated and compared. More...

#include <Histogram.h>

List of all members.

Public Methods

 Histogram (float minimum_data_value, float maximum_data_value, unsigned int bands_per_dimension, unsigned int dimensionality)
 Allocate memory for and initialise histogram. More...

 Histogram (char const *hstFile)
 Constructor to load an existing histogram from a file and allocate appropriate memory.

unsigned int numBands (void)
void add_new_data_item (int *data)
 Adds new data to histogram calculation. More...

void add_new_data_item (float *data)
 Adds new data to histogram calculation. More...

void reset_histogram ()
 Resets histogram by setting all frequencys to 0 and no_data_items to zero. More...

void calculate_probabilities ()
 Calculate histogram probabilities (probs) from frequencies (frequency_data).

void calculate_histogram ()
 Calculate normalised histogram probabilities (probs) from frequencies (frequency_data). More...

float get_histogram_value (unsigned int *bin)
 Returns bin probability value (from probs). More...

float get_mapped_value (unsigned int *bin)
 Returns probability associated with bin containing the data 'data'.

float calculate_difference (Histogram *hist)
 Returns mean absolute difference between histograms. More...

float get_maximum_prob (void)
 Returns maximum probability over all bins.

void get_best_bin (unsigned int *bin)
 Returns best bin.

float calculate_proportion_threshold (float proportion)
 Calculate the probability threshold above which no more than 'proportion' of the training data lie. More...

void save_histogram (char const *)
 Saves histogram data to an (XML format) file.

void load_histogram (char const *)
 Loads histogram from a (XML format) file.


Protected Attributes

float* probs
 Bin relative probabilities.


Detailed Description

A class allowing N-D histograms to be represented, calculated and compared.

Definition at line 25 of file Histogram.h.


Constructor & Destructor Documentation

Histogram::Histogram ( float minimum_data_value,
float maximum_data_value,
unsigned int bands_per_dimension,
unsigned int dimensionality )
 

Allocate memory for and initialise histogram.

Parameters:
minimum_data_value   Minimum data value (e.g. 0 for standard RGB data)
maximum_data_value   Maximum data value (e.g. 255 for standard RGB data)
bands_per_dimension   No. of bands to divide each dimension into
dimensionality   Dimensionality of Histogram/data (e.g. 3 for RGB data)

Definition at line 31 of file Histogram.cpp.


Member Function Documentation

void Histogram::add_new_data_item ( float * data )
 

Adds new data to histogram calculation.

Dimensionality must match dim.

Parameters:
data   The data to add (pointer to array of size dim)

Definition at line 137 of file Histogram.cpp.

void Histogram::add_new_data_item ( int * data )
 

Adds new data to histogram calculation.

Dimensionality must match dim.

Parameters:
data   The data to add (pointer to array of size dim)

Definition at line 90 of file Histogram.cpp.

float Histogram::calculate_difference ( Histogram * hist )
 

Returns mean absolute difference between histograms.

Histograms must have same dimensionality and bands_per_dim.

Parameters:
hist   Pointer to Histogram to compare with this object

Definition at line 339 of file Histogram.cpp.

void Histogram::calculate_histogram ( )
 

Calculate normalised histogram probabilities (probs) from frequencies (frequency_data).

I.e. max probability set to 1. To calculate true probabilities use calculate_probabilities().

Definition at line 249 of file Histogram.cpp.

float Histogram::calculate_proportion_threshold ( float proportion )
 

Calculate the probability threshold above which no more than 'proportion' of the training data lie.

I.E. if proportion = 1 => threshold = 0 OR if proportion = 0.99999... => threshold = lowest non zero bin prob NOTE: calculate_probabilities() should be called prior to this method.

Definition at line 205 of file Histogram.cpp.

float Histogram::get_histogram_value ( unsigned int * bin )
 

Returns bin probability value (from probs).

Parameters:
bin   The bin to return. An array of u-ints, one for each dimension.

N.B. Numbers are from 0->(bands_per_dim-1)

Definition at line 268 of file Histogram.cpp.

void Histogram::reset_histogram ( )
 

Resets histogram by setting all frequencys to 0 and no_data_items to zero.

N.B. This has no effect on probs - calculate_histogram() should ALWAYS be called befor using the probabilities.

Definition at line 72 of file Histogram.cpp.


The documentation for this class was generated from the following files:
Generated at Fri Aug 13 17:29:21 2004 for libRTImage by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001