Homepage | Demos | Overview | Downloads | Tutorials | 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 //! Connects regions of CMVision format runs in RLEGenerator 00010 /*! Uses the CMVision library for main processing. 00011 * 00012 * getImage() will return an array of RegionGenerator::region_stats - 00013 * one entry per color. This will give you some statistics on colors 00014 * present, as well as the head of a linked list through regions of 00015 * each color in the image. 00016 * 00017 * Uses fields in the RLEGenerator's runs to store region 00018 * information. This means we don't have to make an extra copy of 00019 * the data, but unfortunately also means these two stages are 00020 * tightly coupled... 00021 * 00022 * Similarly, this also accesses the color information of the runs, 00023 * so the events received must be a SegmentedColorFilterBankEvents so 00024 * that it can interpret the color information. Some statistical 00025 * information will then be stored in the color struct to report the 00026 * min region area, max region area, and number of regions. 00027 */ 00028 class RegionGenerator : public FilterBankGenerator { 00029 public: 00030 typedef CMVision::region region; //!< using the CMVision library's region information 00031 typedef CMVision::color_class_state region_stats; //!< using the CMVision library's color struct to store the region info 00032 00033 //! constructor 00034 RegionGenerator(EventBase::EventGeneratorID_t gid, unsigned int sid, unsigned int mysid); 00035 00036 //! destructor 00037 virtual ~RegionGenerator() { 00038 freeCaches(); 00039 destruct(); 00040 } 00041 00042 static std::string getClassDescription() { return "Connects runs in an RLE compressed image into regions"; } 00043 00044 virtual void freeCaches(); 00045 00046 //! see class notes above for what data this can handle 00047 virtual void processEvent(const EventBase& event); 00048 00049 virtual unsigned int getBinSize() const; 00050 virtual unsigned int LoadBuffer(const char buf[], unsigned int len); 00051 virtual unsigned int SaveBuffer(char buf[], unsigned int len) const; 00052 00053 protected: 00054 typedef SegmentedColorFilterBankEvent::color_class_state color_class_state; //!< use the same color info as SegmentedColorFilterBankEvent (since that's what's supplying the color info) 00055 static const unsigned int MAX_REGIONS=176*144/16; //!< maximum number of regions, value is from historical Vision sources 00056 00057 virtual void setNumImages(unsigned int nLayers, unsigned int nChannels); 00058 virtual unsigned char * createImageCache(unsigned int layer, unsigned int chan) const; 00059 virtual void calcImage(unsigned int layer, unsigned int chan) const; 00060 virtual void destruct(); 00061 00062 unsigned int srcNumColors; //!< number of colors available (from src->src, which should be SegmentedColorGenerator...) 00063 color_class_state * srcColors; //!< colors information (from src->src, which should be SegmentedColorGenerator...) 00064 region *** regions; //!< data storage for region information 00065 00066 private: 00067 RegionGenerator(const RegionGenerator& fbk); //!< don't call 00068 const RegionGenerator& operator=(const RegionGenerator& fbk); //!< don't call 00069 }; 00070 00071 /*! @file 00072 * @brief Describes RegionGenerator, which connects regions of CMVision format runs in RLEGenerator 00073 * @author alokl (Creator) 00074 * @author ejt (reorganized) 00075 * 00076 * $Author: ejt $ 00077 * $Name: tekkotsu-2_2_1 $ 00078 * $Revision: 1.5 $ 00079 * $State: Exp $ 00080 * $Date: 2004/02/18 21:13:32 $ 00081 */ 00082 00083 #endif |
Tekkotsu v2.2.1 |
Generated Tue Nov 23 16:36:39 2004 by Doxygen 1.3.9.1 |