Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
00001 //-*-c++-*- 00002 #ifndef INCLUDED_RawCameraGenerator_h_ 00003 #define INCLUDED_RawCameraGenerator_h_ 00004 00005 #include "Vision/FilterBankGenerator.h" 00006 00007 class OFbkImageVectorData; 00008 class OFbkImageInfo; 00009 00010 //! Generates FilterBankEvents containing raw camera images directly from the system (doesn't make a copy) 00011 class RawCameraGenerator : public FilterBankGenerator { 00012 public: 00013 //!constructor, numRawLayers is the number of real layers passed from the system, numCalcLayers is the total number of layers to make available 00014 /*! The extra calculated layers are simply created by giving larger 00015 * increments, they reference the same data (no computational cost, 00016 * marginal memory costs... it's just nice to have more layers in 00017 * the image pyramid. 00018 * 00019 * However you'll have to write your code to use the getIncrement() 00020 * value properly if you want it to work. Otherwise, you could 00021 * write a de-interlace generator which will do the resampling. 00022 * 00023 * The top most layer (largest index) is a double-scale image. For 00024 * the Y-channel, it is reconstructed from the 4 Y channels. For 00025 * the other channels, it just does a fast scaling (but these 00026 * operations do cost, so use the top layer conservatively. */ 00027 RawCameraGenerator(unsigned int numRawLayers, unsigned int numCalcLayers, EventBase::EventGeneratorID_t gid, unsigned int sid, unsigned int mysid); 00028 00029 //! destructor 00030 virtual ~RawCameraGenerator(); 00031 00032 static std::string getClassDescription() { return "Translates OFbkImageVectorData objects from the system into a slightly more accessible FilterBankEvent for further processing"; } 00033 00034 //! holds id values for specifying image channel/bands 00035 enum channel_id_t { 00036 CHAN_Y, //!< Y (intensity) channel 00037 CHAN_U, //!< Cr (approx. pink,red,yellow) channel 00038 CHAN_V, //!< Cb (approx. blue,green,yellow) channel 00039 CHAN_Y_DY, //!< vertical derivative of Y channel (aka LH) 00040 CHAN_Y_DX, //!< horizontal derivative of Y channel (aka HL) 00041 CHAN_Y_DXDY, //!< vert. & horiz. derivatives of Y channel (aka HH) 00042 NUM_CHANNELS //!< number of channels per resolution layer 00043 }; 00044 00045 //! called with system's image info 00046 virtual void processEvent(const EventBase& event); 00047 00048 //! the memory for all layers except the double layer was allocated by system, so we just set them to NULL before calling FilterBankGenerator::freeCaches() so it won't try to delete them 00049 virtual void freeCaches(); 00050 00051 virtual unsigned int getBinSize() const; 00052 00053 virtual unsigned int LoadBuffer(const char buf[], unsigned int len); 00054 00055 virtual unsigned int SaveBuffer(char buf[], unsigned int len) const; 00056 00057 protected: 00058 virtual void setNumImages(unsigned int nLayers, unsigned int nChannels); 00059 00060 virtual void setDimensions(); //!< resets the width, height, skip and stride values 00061 virtual unsigned char * createImageCache(unsigned int layer, unsigned int chan) const; 00062 virtual void calcImage(unsigned int layer, unsigned int chan) const; 00063 virtual void destruct(); 00064 00065 //! returns the value to pass to OPENR functions corresponding to the desired channel_id_t. 00066 inline static unsigned int mapChannelID(channel_id_t chan); 00067 00068 //! Creates a double resolution version of a channel, doesn't do any smoothing 00069 void upsampleImage(channel_id_t chan) const; 00070 00071 //! Creates a double resolution Y-channel from the Y and Y gradient channels 00072 void reconstructImage() const; 00073 00074 //! helper functions for reconstructImage() - see documentation for that function 00075 static inline unsigned char clipRange(int val) { 00076 if (val < 0) { return 0; } 00077 else if (val > 255) { return 255; } 00078 else { return (unsigned char)val; } 00079 } 00080 00081 unsigned int numRealLayers; //!< the number of "real" layers being sent from the system 00082 00083 unsigned char ** layers; //!< points to the image data supplied by the system, one per layer (all channels are interleaved by row) 00084 const OFbkImageInfo ** imageInfos; //!< image info provided by the system 00085 00086 private: 00087 RawCameraGenerator(const RawCameraGenerator& fbk); //!< don't call 00088 const RawCameraGenerator& operator=(const RawCameraGenerator& fbk); //!< don't call 00089 }; 00090 00091 /*! @file 00092 * @brief Describes RawCameraGenerator, which generates FilterBankEvents containing raw camera images 00093 * @author ejt (Creator) 00094 * 00095 * $Author: ejt $ 00096 * $Name: tekkotsu-2_0 $ 00097 * $Revision: 1.10 $ 00098 * $State: Exp $ 00099 * $Date: 2004/01/18 10:16:59 $ 00100 */ 00101 00102 #endif
Tekkotsu v2.0 |
Generated Wed Jan 21 03:20:29 2004 by Doxygen 1.3.4 |