24 #include <fvutils/statistical/histogram_block.h>
25 #include <core/exceptions/software.h>
28 using namespace fawkes;
30 namespace firevision {
49 HistogramBlock::HistogramBlock(histogram_block_type_t type, hint_t object_type,
50 uint16_t width, uint16_t height, uint16_t depth)
60 _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"); }
144 if (x >= _block_header->
width)
147 float(x), 0.0f,
float(_block_header->
width));
150 if (y >= _block_header->
height)
153 float(y), 0.0f,
float(_block_header->
height));
156 _histogram_data[y * _block_header->
width + x] = val;
168 if ( x >= _block_header->
width)
171 float(x), 0.0f,
float(_block_header->
width));
174 if ( y >= _block_header->
height)
177 float(y), 0.0f,
float(_block_header->
height));
180 if ( z >= _block_header->
depth)
183 float(z), 0.0f,
float(_block_header->
depth));
186 _histogram_data[z * _block_header->
width * _block_header->
height + y * _block_header->
width + x] = val;
197 if (_block_header->
depth != 0)
198 {
throw Exception(
"Trying to acces a 3-dim histogram with a 2-dim access method"); }
200 if ( x >= _block_header->
width)
203 float(x), 0.0f,
float(_block_header->
width));
206 if ( y >= _block_header->
height)
209 float(y), 0.0f,
float(_block_header->
height));
212 return _histogram_data[y * _block_header->
width + x];
224 if ( x >= _block_header->
width)
227 float(x), 0.0f, _block_header->
width - 1);
230 if ( y >= _block_header->
height)
233 float(y), 0.0f, _block_header->
height - 1);
236 if ( z >= _block_header->
depth)
239 float(z), 0.0f, _block_header->
depth - 1);
242 return _histogram_data[z * _block_header->
width * _block_header->
height + y * _block_header->
width + x];