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/fileformat/fvfile_block.h>
28 #include <fvutils/base/roi.h>
29 #include <stdint.h>
30 
31 
32 namespace firevision {
33 #if 0 /* just to make Emacs auto-indent happy */
34 }
35 #endif
36 
37 /** Header for a histogram block. */
39 {
40  uint16_t width; /**< the width of the histogram */
41  uint16_t height; /**< the height of the histogram */
42  uint16_t depth; /**< the depth of the histogram */
43  uint8_t object_type; /**< the type of object the histogram is associated with */
45 
46 
47 /** The blocktype of a histogram block. */
48 typedef enum _histogram_block_type_t
49 {
50  FIREVISION_HISTOGRAM_TYPE_16 = 0, /**< histogram uses 16 bits per cell */
51  FIREVISION_HISTOGRAM_TYPE_32 = 1 /**< histogram uses 32 bits per cell */
52 } histogram_block_type_t;
53 
54 
56 {
57  public:
58  HistogramBlock(histogram_block_type_t type, hint_t object_type,
59  uint16_t width, uint16_t height, uint16_t depth = 0);
61 
62  virtual ~HistogramBlock();
63 
64  uint16_t width() const;
65  uint16_t height() const;
66  uint16_t depth() const;
67 
68  hint_t object_type() const;
69  void set_object_type(hint_t object_type);
70 
71  void set_data(uint32_t* data);
72 
73  void set_value(uint16_t x, uint16_t y, uint32_t val);
74  void set_value(uint16_t x, uint16_t y, uint16_t z, uint32_t val);
75 
76  uint32_t get_value(uint16_t x, uint16_t y);
77  uint32_t get_value(uint16_t x, uint16_t y, uint16_t z);
78 
79  void reset();
80 
81  private:
82  histogram_block_header_t* _block_header;
83  uint32_t* _histogram_data;
84 };
85 
86 } // end namespace firevision
87 
88 #endif /* __FIREVISIONE_FVUTILS_STATISTICAL_HISTOGRAM_BLOCK_H_ */
uint8_t object_type
the type of object the histogram is associated with
FireVision File Format data block.
Definition: fvfile_block.h:35
uint16_t width
the width of the histogram
Header for a histogram block.
uint16_t depth
the depth of the histogram
This class defines a file block for histograms.
uint16_t height
the height of the histogram