Fawkes API
Fawkes Development Version
|
24 #ifndef _FIREVISION_UTILS_HISTOGRAM_H_
25 #define _FIREVISION_UTILS_HISTOGRAM_H_
27 #include <fvutils/base/types.h>
31 namespace firevision {
40 unsigned int depth = 1,
41 unsigned int num_undos = 1);
50 void get_dimensions(
unsigned int &width,
unsigned int &height,
unsigned int &depth);
51 unsigned int get_value(
unsigned int x,
unsigned int y);
52 unsigned int get_value(
unsigned int x,
unsigned int y,
unsigned int z);
53 void set_value(
unsigned int x,
unsigned int y,
unsigned int value);
54 void set_value(
unsigned int x,
unsigned int y,
unsigned int z,
unsigned int value);
55 void inc_value(
unsigned int x,
unsigned int y,
unsigned int z = 0);
56 void add(
unsigned int x,
unsigned int y,
unsigned int z,
unsigned int value);
57 void sub(
unsigned int x,
unsigned int y,
unsigned int z,
unsigned int value);
70 void save(
const char *filename,
bool formatted_output =
false);
71 bool load(
const char *filename);
77 unsigned int dimension;
78 unsigned int histogram_size;
79 unsigned int * histogram;
81 unsigned int number_of_values;
83 unsigned int **undo_overlay;
84 unsigned int * undo_num_vals;
85 unsigned int undo_num;
86 unsigned int undo_current;
Histogram(unsigned int width, unsigned int height, unsigned int depth=1, unsigned int num_undos=1)
Constructor.
void add(unsigned int x, unsigned int y, unsigned int z, unsigned int value)
Add value to value in histogram at given location.
unsigned int get_num_undos()
Get number of undos.
Point with cartesian coordinates as unsigned integers.
unsigned int get_average()
Get average of all values.
void sub(unsigned int x, unsigned int y, unsigned int z, unsigned int value)
Substract value from value in histogram at given location.
This class defines a file block for histograms.
void get_dimensions(unsigned int &width, unsigned int &height, unsigned int &depth)
Obtain dimensions of the histogram.
void set_value(unsigned int x, unsigned int y, unsigned int value)
Set value in histogram.
unsigned int get_median()
Get median of all values.
void save(const char *filename, bool formatted_output=false)
Save to file.
unsigned int get_sum() const
Get sum of all values.
void inc_value(unsigned int x, unsigned int y, unsigned int z=0)
Increase the value of the histogram at given position.
bool load(const char *filename)
Load from file.
unsigned int * get_histogram()
Get histogram data buffer.
unsigned int switch_undo(unsigned int undo_id)
Switch undo to another undo buffer.
HistogramBlock * get_histogram_block()
Obtain the histogram block of this histogram.
void reset_undo()
Reset undo.
unsigned int get_value(unsigned int x, unsigned int y)
Get value from histogram.
void reset()
Reset histogram.
void print_to_stream(std::ostream &s)
Print to stream.
void operator+=(fawkes::upoint_t *p)
Add point.