Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
RegionGenerator.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_RegionGenerator_h_ 00003 #define INCLUDED_RegionGenerator_h_ 00004 00005 #include "Vision/FilterBankGenerator.h" 00006 #include "Events/SegmentedColorFilterBankEvent.h" 00007 #include "Vision/cmvision.h" 00008 00009 class RLEGenerator; 00010 00011 //! Connects regions of CMVision format runs in RLEGenerator 00012 /*! Uses the CMVision library for main processing. 00013 * 00014 * getImage() will return an array of RegionGenerator::region_stats - 00015 * one entry per color. This will give you some statistics on colors 00016 * present, as well as the head of a linked list through regions of 00017 * each color in the image. 00018 * 00019 * Uses fields in the RLEGenerator's runs to store region 00020 * information. This means we don't have to make an extra copy of 00021 * the data, but unfortunately also means these two stages are 00022 * tightly coupled... 00023 * 00024 * Similarly, this also accesses the color information of the runs, 00025 * so the events received must be a SegmentedColorFilterBankEvents so 00026 * that it can interpret the color information. Some statistical 00027 * information will then be stored in the color struct to report the 00028 * min region area, max region area, and number of regions. 00029 */ 00030 class RegionGenerator : public FilterBankGenerator { 00031 public: 00032 typedef CMVision::region region; //!< using the CMVision library's region information 00033 typedef CMVision::color_class_state region_stats; //!< using the CMVision library's color struct to store the region info 00034 00035 //! constructor 00036 RegionGenerator(unsigned int mysid, RLEGenerator* rleg, EventBase::EventTypeID_t tid); 00037 00038 //! destructor 00039 virtual ~RegionGenerator() { 00040 freeCaches(); 00041 destruct(); 00042 } 00043 00044 static std::string getClassDescription() { return "Connects runs in an RLE compressed image into regions"; } 00045 00046 virtual void freeCaches(); 00047 00048 //! see class notes above for what data this can handle 00049 virtual void processEvent(const EventBase& event); 00050 00051 virtual unsigned int getBinSize() const; 00052 virtual unsigned int loadBuffer(const char buf[], unsigned int len); 00053 virtual unsigned int saveBuffer(char buf[], unsigned int len) const; 00054 00055 protected: 00056 typedef SegmentedColorFilterBankEvent::color_class_state color_class_state; //!< use the same color info as SegmentedColorFilterBankEvent (since that's what's supplying the color info) 00057 static const unsigned int MAX_REGIONS=176*144/16; //!< maximum number of regions, value is from historical Vision sources 00058 00059 virtual void setNumImages(unsigned int nLayers, unsigned int nChannels); 00060 virtual unsigned char * createImageCache(unsigned int layer, unsigned int chan) const; 00061 virtual void calcImage(unsigned int layer, unsigned int chan); 00062 virtual void destruct(); 00063 00064 unsigned int srcNumColors; //!< number of colors available (from src->src, which should be SegmentedColorGenerator...) 00065 const color_class_state * srcColors; //!< colors information (from src->src, which should be SegmentedColorGenerator...) 00066 region *** regions; //!< data storage for region information 00067 00068 private: 00069 RegionGenerator(const RegionGenerator& fbk); //!< don't call 00070 const RegionGenerator& operator=(const RegionGenerator& fbk); //!< don't call 00071 }; 00072 00073 /*! @file 00074 * @brief Describes RegionGenerator, which connects regions of CMVision format runs in RLEGenerator 00075 * @author alokl (Creator) 00076 * @author ejt (reorganized) 00077 * 00078 * $Author: ejt $ 00079 * $Name: tekkotsu-4_0 $ 00080 * $Revision: 1.8 $ 00081 * $State: Exp $ 00082 * $Date: 2006/09/09 04:33:04 $ 00083 */ 00084 00085 #endif |
Tekkotsu v4.0 |
Generated Thu Nov 22 00:54:55 2007 by Doxygen 1.5.4 |