Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
CDTGenerator.hGo to the documentation of this file.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 freeCaches(); 00052 destruct(); 00053 } 00054 00055 static std::string getClassDescription() { return "Extracts the segmented image channel (CDT) from the system's OFbkImageVectorData"; } 00056 00057 //! holds id values for specifying image channel/bands 00058 enum channel_id_t { 00059 CHAN_CDT, //!< Color Detection Table, segmented image 00060 NUM_CHANNELS //!< number of channels per resolution layer 00061 }; 00062 00063 //! called with system's image info 00064 virtual void processEvent(const EventBase& event); 00065 00066 //! 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 00067 virtual void freeCaches(); 00068 00069 virtual unsigned int getBinSize() const; 00070 00071 virtual unsigned int LoadBuffer(const char buf[], unsigned int len); 00072 00073 virtual unsigned int SaveBuffer(char buf[], unsigned int len) const; 00074 00075 protected: 00076 virtual void setNumImages(unsigned int nLayers, unsigned int nChannels); 00077 00078 //! resets the current width, height, stride, and skip for all of the layers 00079 virtual void setDimensions(); 00080 00081 virtual unsigned char * createImageCache(unsigned int layer, unsigned int chan) const; 00082 virtual void calcImage(unsigned int layer, unsigned int chan) const; 00083 virtual void destruct(); 00084 00085 unsigned int numRealLayers; //!< the number of actual layers to expect from the system 00086 00087 unsigned char ** layers; //!< an array of pointers to actual system memory for each layer 00088 const OFbkImageInfo ** imageInfos; //!< information about image properties 00089 00090 private: 00091 CDTGenerator(const CDTGenerator& fbk); //!< don't call 00092 const CDTGenerator& operator=(const CDTGenerator& fbk); //!< don't call 00093 }; 00094 00095 /*! @file 00096 * @brief Describes CDTGenerator, which generates SegmentedColorFilterBankEvents with images provided from the system 00097 * @author ejt (Creator) 00098 * 00099 * $Author: ejt $ 00100 * $Name: tekkotsu-2_2_2 $ 00101 * $Revision: 1.3 $ 00102 * $State: Exp $ 00103 * $Date: 2004/02/18 21:13:32 $ 00104 */ 00105 00106 #endif |
Tekkotsu v2.2.2 |
Generated Tue Jan 4 15:43:13 2005 by Doxygen 1.4.0 |