histogram_block.h

00001 
00002 /***************************************************************************
00003  *  histogram_block.h - Histogram block
00004  *
00005  *  Created: Sat Mar 29 21:01:49 2008
00006  *  Copyright  2008  Daniel Beck
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __FIREVISIONE_FVUTILS_STATISTICAL_HISTOGRAM_BLOCK_H_
00025 #define __FIREVISIONE_FVUTILS_STATISTICAL_HISTOGRAM_BLOCK_H_
00026 
00027 #include <fvutils/fileformat/fvfile_block.h>
00028 #include <fvutils/base/roi.h>
00029 #include <stdint.h>
00030 
00031 
00032 namespace firevision {
00033 #if 0 /* just to make Emacs auto-indent happy */
00034 }
00035 #endif
00036 
00037 /** Header for a histogram block. */
00038 typedef struct _histogram_block_header_t
00039 {
00040   uint16_t width;          /**< the width of the histogram */
00041   uint16_t height;         /**< the height of the histogram */
00042   uint16_t depth;          /**< the depth of the histogram */
00043   uint8_t  object_type;    /**< the type of object the histogram is associated with */
00044 } histogram_block_header_t;
00045 
00046 
00047 /** The blocktype of a histogram block. */
00048 typedef enum _histogram_block_type_t
00049 {
00050   FIREVISION_HISTOGRAM_TYPE_16 = 0,    /**< histogram uses 16 bits per cell */
00051   FIREVISION_HISTOGRAM_TYPE_32 = 1     /**< histogram uses 32 bits per cell */
00052 } histogram_block_type_t;
00053 
00054 
00055 class HistogramBlock : public FireVisionDataFileBlock
00056 {
00057  public:
00058   HistogramBlock(histogram_block_type_t type, hint_t object_type,
00059                  uint16_t width, uint16_t height, uint16_t depth = 0);
00060   HistogramBlock(FireVisionDataFileBlock* block);
00061 
00062   virtual ~HistogramBlock();
00063 
00064   uint16_t width() const;
00065   uint16_t height() const;
00066   uint16_t depth() const;
00067 
00068   hint_t object_type() const;
00069   void set_object_type(hint_t object_type);
00070 
00071   void set_data(uint32_t* data);
00072 
00073   void set_value(uint16_t x, uint16_t y, uint32_t val);
00074   void set_value(uint16_t x, uint16_t y, uint16_t z, uint32_t val);
00075 
00076   uint32_t get_value(uint16_t x, uint16_t y);
00077   uint32_t get_value(uint16_t x, uint16_t y, uint16_t z);
00078 
00079   void reset();
00080 
00081  private:
00082   histogram_block_header_t* _block_header;
00083   uint32_t* _histogram_data;
00084 };
00085 
00086 } // end namespace firevision
00087 
00088 #endif /* __FIREVISIONE_FVUTILS_STATISTICAL_HISTOGRAM_BLOCK_H_ */

Generated on 1 Mar 2011 for Fawkes API by  doxygen 1.6.1