Fawkes API
Fawkes Development Version
|
24 #include <core/exceptions/software.h>
25 #include <fvutils/statistical/histogram_block.h>
31 namespace firevision {
46 HistogramBlock::HistogramBlock(histogram_block_type_t type,
52 (size_t)width * height * depth * sizeof(uint32_t),
61 _histogram_data = (uint32_t *)
_data;
70 _histogram_data = (uint32_t *)
_data;
84 return _block_header->
width;
93 return _block_header->
height;
102 return _block_header->
depth;
141 if (_block_header->
depth != 0) {
142 throw Exception(
"Trying to acces a 3-dim histogram with a 2-dim access method");
145 if (x >= _block_header->
width) {
149 float(_block_header->
width));
152 if (y >= _block_header->
height) {
156 float(_block_header->
height));
159 _histogram_data[y * _block_header->
width + x] = val;
171 if (x >= _block_header->
width) {
175 float(_block_header->
width));
178 if (y >= _block_header->
height) {
182 float(_block_header->
height));
185 if (z >= _block_header->
depth) {
189 float(_block_header->
depth));
192 _histogram_data[z * _block_header->
width * _block_header->
height + y * _block_header->
width + x] =
204 if (_block_header->
depth != 0) {
205 throw Exception(
"Trying to acces a 3-dim histogram with a 2-dim access method");
208 if (x >= _block_header->
width) {
212 float(_block_header->
width));
215 if (y >= _block_header->
height) {
219 float(_block_header->
height));
222 return _histogram_data[y * _block_header->
width + x];
234 if (x >= _block_header->
width) {
238 _block_header->
width - 1);
241 if (y >= _block_header->
height) {
245 _block_header->
height - 1);
248 if (z >= _block_header->
depth) {
252 _block_header->
depth - 1);
255 return _histogram_data[z * _block_header->
width * _block_header->
height + y * _block_header->
width
uint16_t width() const
Returns the the width of the histogram.
void set_object_type(hint_t object_type)
Set the type of the object the histogram is associated with.
void reset()
Reset the histogram.
void * _data
Pointer to the internal data segment.
HistogramBlock(histogram_block_type_t type, hint_t object_type, uint16_t width, uint16_t height, uint16_t depth=0)
Constructor.
void set_value(uint16_t x, uint16_t y, uint32_t val)
Store a value in a certain cell of a 2-dimensional histogram.
hint_t object_type() const
Returns the type of the object the histogram is associated with.
Fawkes library namespace.
void * _spec_header
Pointer to the content specific block header.
virtual ~HistogramBlock()
Destructor.
size_t _data_size
Size of _data in bytes.
uint16_t height() const
Returns the the height of the histogram.
uint32_t get_value(uint16_t x, uint16_t y)
Obtain a certain value from a 2-dimensional histogram.
void set_data(uint32_t *data)
Directly set the histogram data.
FireVision File Format data block.
uint16_t depth() const
Returns the the depth of the histogram.
Base class for exceptions in Fawkes.