Public Member Functions

firevision::Histogram Class Reference

Histogram. More...

#include <>>

List of all members.

Public Member Functions

 Histogram (unsigned int width, unsigned int height, unsigned int depth=1, unsigned int num_undos=1)
 Constructor.
 Histogram (HistogramBlock *histogram_block)
 Constructor.
 ~Histogram ()
 Destructor.
void operator+= (fawkes::point_t *p)
 Add point.
void operator+= (fawkes::point_t p)
 Add point.
unsigned int * get_histogram ()
 Get histogram data buffer.
HistogramBlockget_histogram_block ()
 Obtain the histogram block of this histogram.
void get_dimensions (unsigned int &width, unsigned int &height, unsigned int &depth)
 Obtain dimensions of the histogram.
unsigned int get_value (unsigned int x, unsigned int y)
 Get value from histogram.
unsigned int get_value (unsigned int x, unsigned int y, unsigned int z)
 Get value from histogram.
void set_value (unsigned int x, unsigned int y, unsigned int value)
 Set value in histogram.
void set_value (unsigned int x, unsigned int y, unsigned int z, unsigned int value)
 Set value in histogram.
void inc_value (unsigned int x, unsigned int y, unsigned int z=0)
 Increase the value of the histogram at given position.
void add (unsigned int x, unsigned int y, unsigned int z, unsigned int value)
 Add value to value in histogram at given location.
void sub (unsigned int x, unsigned int y, unsigned int z, unsigned int value)
 Substract value from value in histogram at given location.
void reset ()
 Reset histogram.
unsigned int get_median ()
 Get median of all values.
unsigned int get_average ()
 Get average of all values.
unsigned int get_sum () const
 Get sum of all values.
void reset_undo ()
 Reset undo.
void undo ()
 Undo.
unsigned int switch_undo (unsigned int undo_id)
 Switch undo to another undo buffer.
unsigned int get_num_undos ()
 Get number of undos.
void print_to_stream (std::ostream &s)
 Print to stream.
void save (const char *filename, bool formatted_output=false)
 Save to file.
bool load (const char *filename)
 Load from file.

Detailed Description

Histogram.

Histrogram with 2D or 3D coordinates for buckets.

Definition at line 37 of file histogram.h.


Constructor & Destructor Documentation

firevision::Histogram::Histogram ( unsigned int  width,
unsigned int  height,
unsigned int  depth = 1,
unsigned int  num_undos = 1 
)

Constructor.

Parameters:
width width of histogram plane
height height of histogram plane
depth depth of the histogram
num_undos number of possible undos

Definition at line 58 of file histogram.cpp.

References firevision::FireVisionDataFileBlock::data_ptr(), and reset().

firevision::Histogram::Histogram ( HistogramBlock block  ) 

Constructor.

Parameters:
block construct a histogram from the given histogram block

Definition at line 97 of file histogram.cpp.

References firevision::FireVisionDataFileBlock::data_ptr(), firevision::HistogramBlock::depth(), firevision::HistogramBlock::height(), and firevision::HistogramBlock::width().

firevision::Histogram::~Histogram (  ) 

Destructor.

Definition at line 126 of file histogram.cpp.


Member Function Documentation

void firevision::Histogram::add ( unsigned int  x,
unsigned int  y,
unsigned int  z,
unsigned int  value 
)

Add value to value in histogram at given location.

Parameters:
x x coordinate in histogram
y y coordinate in histogram
z z coordinate in histogram
value the value to add

Definition at line 322 of file histogram.cpp.

References firevision::HistogramBlock::get_value(), and firevision::HistogramBlock::set_value().

unsigned int firevision::Histogram::get_average (  ) 

Get average of all values.

Returns:
average

Definition at line 534 of file histogram.cpp.

References firevision::HistogramBlock::get_value().

Referenced by firevision::BayesHistosToLut::calculateLutValues().

void firevision::Histogram::get_dimensions ( unsigned int &  width,
unsigned int &  height,
unsigned int &  depth 
)

Obtain dimensions of the histogram.

Parameters:
width reference to the variable where the width is stored
height reference to the variable where the height is stored
depth reference to the variable where the depth is stored

Definition at line 207 of file histogram.cpp.

unsigned int * firevision::Histogram::get_histogram (  ) 

Get histogram data buffer.

Returns:
histogram

Definition at line 185 of file histogram.cpp.

HistogramBlock * firevision::Histogram::get_histogram_block (  ) 

Obtain the histogram block of this histogram.

Returns:
pointer to the histogram block

Definition at line 195 of file histogram.cpp.

unsigned int firevision::Histogram::get_median (  ) 

Get median of all values.

Returns:
median

Definition at line 507 of file histogram.cpp.

References firevision::HistogramBlock::get_value().

Referenced by firevision::BayesHistosToLut::calculateLutValues().

unsigned int firevision::Histogram::get_num_undos (  ) 

Get number of undos.

Returns:
number of undos

Definition at line 497 of file histogram.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutValues().

unsigned int firevision::Histogram::get_sum (  )  const

Get sum of all values.

Returns:
sum of values

Definition at line 557 of file histogram.cpp.

References firevision::HistogramBlock::get_value().

unsigned int firevision::Histogram::get_value ( unsigned int  x,
unsigned int  y,
unsigned int  z 
)

Get value from histogram.

Parameters:
x x coordinate in histogram plane
y y coordinate in histogram plane
z z coordinate in the histogram
Returns:
value

Definition at line 234 of file histogram.cpp.

References firevision::HistogramBlock::get_value().

unsigned int firevision::Histogram::get_value ( unsigned int  x,
unsigned int  y 
)

Get value from histogram.

Parameters:
x x coordinate in histogram plane
y y coordinate in histogram plane
Returns:
value

Definition at line 221 of file histogram.cpp.

References firevision::HistogramBlock::get_value().

Referenced by firevision::BayesHistosToLut::calculateLutValues().

void firevision::Histogram::inc_value ( unsigned int  x,
unsigned int  y,
unsigned int  z = 0 
)

Increase the value of the histogram at given position.

Parameters:
x x coordinate in the histogram
y y coordinate in the histogram
z z coordinate in the histogram

Definition at line 303 of file histogram.cpp.

References firevision::HistogramBlock::get_value(), and firevision::HistogramBlock::set_value().

bool firevision::Histogram::load ( const char *  filename  ) 

Load from file.

Parameters:
filename file name to read from
Returns:
true on success, false otherwise

Definition at line 419 of file histogram.cpp.

References firevision::FireVisionDataFile::blocks(), firevision::FireVisionDataFileBlock::data_ptr(), firevision::FireVisionDataFile::num_blocks(), and firevision::FireVisionDataFile::read().

void firevision::Histogram::operator+= ( fawkes::point_t  p  ) 

Add point.

Parameters:
p point

Definition at line 163 of file histogram.cpp.

References fawkes::point_t::x, and fawkes::point_t::y.

void firevision::Histogram::operator+= ( fawkes::point_t p  ) 

Add point.

Parameters:
p point

Definition at line 141 of file histogram.cpp.

References fawkes::point_t::x, and fawkes::point_t::y.

void firevision::Histogram::print_to_stream ( std::ostream &  s  ) 

Print to stream.

Parameters:
s stream

Definition at line 383 of file histogram.cpp.

References firevision::HistogramBlock::get_value().

void firevision::Histogram::reset (  ) 

Reset histogram.

Definition at line 366 of file histogram.cpp.

References firevision::HistogramBlock::reset(), reset_undo(), and switch_undo().

Referenced by Histogram().

void firevision::Histogram::reset_undo (  ) 

Reset undo.

Definition at line 450 of file histogram.cpp.

Referenced by reset(), and undo().

void firevision::Histogram::save ( const char *  filename,
bool  formatted_output = false 
)

Save to file.

Parameters:
filename file name to save to
formatted_output one value per line

Definition at line 403 of file histogram.cpp.

References firevision::HistogramFile::add_histogram_block(), firevision::FireVisionDataFile::set_owns_blocks(), and firevision::FireVisionDataFile::write().

void firevision::Histogram::set_value ( unsigned int  x,
unsigned int  y,
unsigned int  z,
unsigned int  value 
)

Set value in histogram.

Parameters:
x x coordinate in histogram plane
y y coordinate in histogram plane
z z coordinate in the histogram
value value

Definition at line 275 of file histogram.cpp.

References firevision::HistogramBlock::get_value(), and firevision::HistogramBlock::set_value().

void firevision::Histogram::set_value ( unsigned int  x,
unsigned int  y,
unsigned int  value 
)

Set value in histogram.

Parameters:
x x coordinate in histogram plane
y y coordinate in histogram plane
value value

Definition at line 246 of file histogram.cpp.

References firevision::HistogramBlock::get_value(), and firevision::HistogramBlock::set_value().

Referenced by firevision::BayesHistosToLut::calculateLutValues(), and sub().

void firevision::Histogram::sub ( unsigned int  x,
unsigned int  y,
unsigned int  z,
unsigned int  value 
)

Substract value from value in histogram at given location.

Parameters:
x x coordinate in histogram
y y coordinate in histogram
z z coordinate in histogram
value the value to substract

Definition at line 341 of file histogram.cpp.

References firevision::HistogramBlock::get_value(), and set_value().

unsigned int firevision::Histogram::switch_undo ( unsigned int  undo_id  ) 

Switch undo to another undo buffer.

Parameters:
undo_id switch to buffer with this ID
Returns:
returns current undo buffer ID

Definition at line 479 of file histogram.cpp.

Referenced by firevision::BayesHistosToLut::calculateLutValues(), and reset().

void firevision::Histogram::undo (  ) 

Undo.

Definition at line 459 of file histogram.cpp.

References reset_undo().

Referenced by firevision::BayesHistosToLut::calculateLutValues().


The documentation for this class was generated from the following files: