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