Fawkes API Fawkes Development Version
histogram_block.h
1
2/***************************************************************************
3 * histogram_block.h - Histogram block
4 *
5 * Created: Sat Mar 29 21:01:49 2008
6 * Copyright 2008 Daniel Beck
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22 */
23
24#ifndef _FIREVISIONE_FVUTILS_STATISTICAL_HISTOGRAM_BLOCK_H_
25#define _FIREVISIONE_FVUTILS_STATISTICAL_HISTOGRAM_BLOCK_H_
26
27#include <fvutils/base/roi.h>
28#include <fvutils/fileformat/fvfile_block.h>
29
30#include <stdint.h>
31
32namespace firevision {
33
34/** Header for a histogram block. */
36{
37 uint16_t width; /**< the width of the histogram */
38 uint16_t height; /**< the height of the histogram */
39 uint16_t depth; /**< the depth of the histogram */
40 uint8_t object_type; /**< the type of object the histogram is associated with */
42
43/** The blocktype of a histogram block. */
44typedef enum _histogram_block_type_t {
45 FIREVISION_HISTOGRAM_TYPE_16 = 0, /**< histogram uses 16 bits per cell */
46 FIREVISION_HISTOGRAM_TYPE_32 = 1 /**< histogram uses 32 bits per cell */
47} histogram_block_type_t;
48
50{
51public:
52 HistogramBlock(histogram_block_type_t type,
53 hint_t object_type,
54 uint16_t width,
55 uint16_t height,
56 uint16_t depth = 0);
58
59 virtual ~HistogramBlock();
60
61 uint16_t width() const;
62 uint16_t height() const;
63 uint16_t depth() const;
64
65 hint_t object_type() const;
66 void set_object_type(hint_t object_type);
67
68 void set_data(uint32_t *data);
69
70 void set_value(uint16_t x, uint16_t y, uint32_t val);
71 void set_value(uint16_t x, uint16_t y, uint16_t z, uint32_t val);
72
73 uint32_t get_value(uint16_t x, uint16_t y);
74 uint32_t get_value(uint16_t x, uint16_t y, uint16_t z);
75
76 void reset();
77
78private:
79 histogram_block_header_t *_block_header;
80 uint32_t * _histogram_data;
81};
82
83} // end namespace firevision
84
85#endif /* FIREVISIONE_FVUTILS_STATISTICAL_HISTOGRAM_BLOCK_H__ */
FireVision File Format data block.
Definition: fvfile_block.h:34
unsigned int type() const
Get block type.
This class defines a file block for histograms.
uint16_t height() const
Returns the the height of the histogram.
hint_t object_type() const
Returns the type of the object the histogram is associated with.
void set_data(uint32_t *data)
Directly set the histogram data.
uint32_t get_value(uint16_t x, uint16_t y)
Obtain a certain value from a 2-dimensional histogram.
uint16_t depth() const
Returns the the depth of the histogram.
HistogramBlock(histogram_block_type_t type, hint_t object_type, uint16_t width, uint16_t height, uint16_t depth=0)
Constructor.
uint16_t width() const
Returns the the width of the histogram.
void set_value(uint16_t x, uint16_t y, uint32_t val)
Store a value in a certain cell of a 2-dimensional histogram.
void reset()
Reset the histogram.
virtual ~HistogramBlock()
Destructor.
void set_object_type(hint_t object_type)
Set the type of the object the histogram is associated with.
Header for a histogram block.
uint16_t height
the height of the histogram
uint16_t depth
the depth of the histogram
uint8_t object_type
the type of object the histogram is associated with
uint16_t width
the width of the histogram