| 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 //! destructor 00036 virtual ~RegionGenerator(); 00037 00038 static std::string getClassDescription() { return "Connects runs in an RLE compressed image into regions"; } 00039 00040 virtual void freeCaches(); 00041 00042 //! see class notes above for what data this can handle 00043 virtual void processEvent(const EventBase& event); 00044 00045 virtual unsigned int getBinSize() const; 00046 virtual unsigned int LoadBuffer(const char buf[], unsigned int len); 00047 virtual unsigned int SaveBuffer(char buf[], unsigned int len) const; 00048 00049 //! returns the FilterBankGenerator this is receiving events from 00050 virtual const FilterBankGenerator * getSourceGenerator() const { return src; } 00051 00052 protected: 00053 typedef SegmentedColorFilterBankEvent::color_class_state color_class_state; //!< use the same color info as SegmentedColorFilterBankEvent (since that's what's supplying the color info) 00054 static const unsigned int MAX_REGIONS=176*144/16; //!< maximum number of regions, value is from historical Vision sources 00055 00056 virtual void setDimensions(); //!< resets the width, height, skip and stride parameters 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 const FilterBankGenerator * src; //!< the generator of the last FilterBankEvent received 00063 00064 unsigned int srcNumColors; //!< number of colors available (from src->src, which should be SegmentedColorGenerator...) 00065 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-2_0_1+Doc $ 00080 * $Revision: 1.4 $ 00081 * $State: Exp $ 00082 * $Date: 2004/02/05 02:46:41 $ 00083 */ 00084 00085 #endif |
|
Tekkotsu v2.0.1+Doc |
Generated Mon Feb 9 22:16:50 2004 by Doxygen 1.3.5 |