Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
InterleavedYUVGenerator.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_InterleavedYUVGenerator_h_ 00003 #define INCLUDED_InterleavedYUVGenerator_h_ 00004 00005 #include "Vision/FilterBankGenerator.h" 00006 00007 //! Generates FilterBankEvents containing raw camera images with interleaved pixels (YVUYVUYVU... instead of YYY...UUU...VVV...) 00008 /*! @note That's not a typo - the byte ordering is YVU, @e not YUV 00009 * 00010 * Sorry about the misleading name... This @a takes filter banks 00011 * containing YUV information, however, the main reason for this 00012 * class is to interleave the image in order to pass it to the jpeg 00013 * compression routines. JPEG expect YCbCr, which corresponds to YVU 00014 * order. 00015 * 00016 * Also, I should point out that mathematically, V!=Cb, and U!=Cr, 00017 * but they do carry the same information. It's just a matter of 00018 * scaling and offset. These comments use the "Y", "U", and "V" 00019 * labels loosely. 00020 * 00021 * There's only one channel, which holds the interleaved data. The 00022 * increment is set to 3, but if you want to access each component in 00023 * order, just use 1 instead (as you would expect hopefully, since 00024 * that's the whole point of this class) 00025 * 00026 * The generated events use 0 for their event source IDs. The row 00027 * skip is always 0, and the row stride is always width*3. But it 00028 * would be better to use the proper accessor functions to be more 00029 * general. 00030 * 00031 * should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator) 00032 * 00033 * @see FilterBankGenerator for information on serialization format 00034 */ 00035 class InterleavedYUVGenerator : public FilterBankGenerator { 00036 public: 00037 //! constructor 00038 InterleavedYUVGenerator(EventBase::EventGeneratorID_t gid, unsigned int sid, unsigned int mysid); 00039 //! constructor, you can pass which channels to interleave 00040 InterleavedYUVGenerator(EventBase::EventGeneratorID_t gid, unsigned int sid, unsigned int mysid, unsigned int syc, unsigned int suc, unsigned int svc); 00041 00042 //! destructor 00043 virtual ~InterleavedYUVGenerator() { 00044 freeCaches(); 00045 destruct(); 00046 } 00047 00048 static const unsigned int CHAN_YUV=0; //!< so you can refer to the YUV channel symbolically. 00049 00050 static std::string getClassDescription() { return "Converts a FilterBankGenerator's data into interleaved format"; } 00051 00052 //! should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator) 00053 virtual void processEvent(const EventBase& event); 00054 00055 virtual unsigned int getBinSize() const; 00056 00057 virtual unsigned int LoadBuffer(const char buf[], unsigned int len); 00058 00059 virtual unsigned int SaveBuffer(char buf[], unsigned int len) const; 00060 00061 protected: 00062 virtual void setNumImages(unsigned int nLayers, unsigned int nChannels); 00063 virtual void setDimensions(); //!< resets stride parameter (to correspond to width*3 from FilterBankGenerator::setDimensions()) 00064 virtual unsigned char * createImageCache(unsigned int layer, unsigned int chan) const; 00065 virtual void calcImage(unsigned int layer, unsigned int chan) const; 00066 00067 unsigned int srcYChan; //!< the channel of the source's Y channel 00068 unsigned int srcUChan; //!< the channel of the source's U channel 00069 unsigned int srcVChan; //!< the channel of the source's V channel 00070 00071 private: 00072 InterleavedYUVGenerator(const InterleavedYUVGenerator& fbk); //!< don't call 00073 const InterleavedYUVGenerator& operator=(const InterleavedYUVGenerator& fbk); //!< don't call 00074 }; 00075 00076 /*! @file 00077 * @brief Describes InterleavedYUVGenerator, which generates FilterBankEvents containing raw camera images with interleaved pixels (YUVYUVYUV... instead of YYY...UUU...VVV...) 00078 * @author ejt (Creator) 00079 * 00080 * $Author: ejt $ 00081 * $Name: tekkotsu-2_1 $ 00082 * $Revision: 1.11 $ 00083 * $State: Exp $ 00084 * $Date: 2004/02/18 21:13:32 $ 00085 */ 00086 00087 #endif |
Tekkotsu v2.1 |
Generated Tue Mar 16 23:19:13 2004 by Doxygen 1.3.5 |