Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
00001 //-*-c++-*- 00002 #ifndef INCLUDED_CDTGenerator_h_ 00003 #define INCLUDED_CDTGenerator_h_ 00004 00005 #include "Vision/FilterBankGenerator.h" 00006 00007 class OFbkImageVectorData; 00008 class OFbkImageInfo; 00009 00010 //! Generates SegmentedColorFilterBankEvents with images provided from the system 00011 /*! The Aibo has hardware-level color segmentation based on 00012 * rectangular regions of UV color space. This less flexible than 00013 * the CMVision segmentation routines, which allow arbitrary shapes 00014 * in color space, but the CDT (Color Detection Table) implementation 00015 * has the major advantage of being done in hardware. 00016 * 00017 * This class doesn't do any processing of its own, it simply 00018 * provides access to the CDT segmented images generated by the 00019 * system. 00020 * 00021 * To use this, you will first have to send the system the color 00022 * regions that define the CDT. You'll need to look in the OPEN-R 00023 * documentation regarding the OCdtVectorData data structure and the 00024 * New/Set/DeleteCdtVectorData() functions. 00025 * 00026 * For now, the color information in the Segmented Color Events will 00027 * be NULL, so you won't be able to connect it to the rest of the 00028 * CMVision stages unless you fill it in. Filling in the color 00029 * information will require modifications of this source - I'm 00030 * consciously cutting some corners to get this out the door sooner. 00031 * Hopefully someone who needs this capability can pick up where I 00032 * left off. It would be nice if someone made a version of 00033 * CMVision's .col file format which also held the CDT information so 00034 * the whole thing could be set up with one file load. 00035 * 00036 * Only the actual layers sent by the system will be referenced - no 00037 * double resolution layer. Much like RawCameraGenerator, the extra 00038 * subsampled images are simply using a larger interleave value. If 00039 * you want the images in continuous memory, you'll need to pass this 00040 * through a de-interleaver stage. 00041 * 00042 * Only one channel is available. 00043 */ 00044 class CDTGenerator : public FilterBankGenerator { 00045 public: 00046 //!constructor 00047 CDTGenerator(unsigned int numRawLayers, unsigned int numCalcLayers, EventBase::EventGeneratorID_t gid, unsigned int sid, unsigned int mysid); 00048 00049 //! destructor 00050 virtual ~CDTGenerator(); 00051 00052 static std::string getClassDescription() { return "Extracts the segmented image channel (CDT) from the system's OFbkImageVectorData"; } 00053 00054 //! holds id values for specifying image channel/bands 00055 enum channel_id_t { 00056 CHAN_CDT, //!< Color Detection Table, segmented image 00057 NUM_CHANNELS //!< number of channels per resolution layer 00058 }; 00059 00060 //! called with system's image info 00061 virtual void processEvent(const EventBase& event); 00062 00063 //! the memory for all layers was allocated by system, so we just set them to NULL before calling FilterBankGenerator::freeCaches() so it won't try to delete them 00064 virtual void freeCaches(); 00065 00066 virtual unsigned int getBinSize() const; 00067 00068 virtual unsigned int LoadBuffer(const char buf[], unsigned int len); 00069 00070 virtual unsigned int SaveBuffer(char buf[], unsigned int len) const; 00071 00072 protected: 00073 virtual void setNumImages(unsigned int nLayers, unsigned int nChannels); 00074 00075 //! resets the current width, height, stride, and skip for all of the layers 00076 virtual void setDimensions(); 00077 00078 virtual unsigned char * createImageCache(unsigned int layer, unsigned int chan) const; 00079 virtual void calcImage(unsigned int layer, unsigned int chan) const; 00080 virtual void destruct(); 00081 00082 unsigned int numRealLayers; //!< the number of actual layers to expect from the system 00083 00084 unsigned char ** layers; //!< an array of pointers to actual system memory for each layer 00085 const OFbkImageInfo ** imageInfos; //!< information about image properties 00086 00087 private: 00088 CDTGenerator(const CDTGenerator& fbk); //!< don't call 00089 const CDTGenerator& operator=(const CDTGenerator& fbk); //!< don't call 00090 }; 00091 00092 /*! @file 00093 * @brief Describes CDTGenerator, which generates SegmentedColorFilterBankEvents with images provided from the system 00094 * @author ejt (Creator) 00095 * 00096 * $Author: ejt $ 00097 * $Name: tekkotsu-2_0 $ 00098 * $Revision: 1.2 $ 00099 * $State: Exp $ 00100 * $Date: 2004/01/18 10:16:59 $ 00101 */ 00102 00103 #endif
Tekkotsu v2.0 |
Generated Wed Jan 21 03:20:27 2004 by Doxygen 1.3.4 |