Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
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 YUV images, 00011 * however, the main reason for this class is to interleave the image 00012 * in order to pass it to the jpeg compression routines. JPEG expect 00013 * YCrCb, which is apparently YVU order. *shrug* I dunno, there's 00014 * something weird there. 00015 * 00016 * There's only one channel, which holds the interleaved data. The 00017 * increment is set to 3, but if you want to access each component in 00018 * order, just use 1 instead (as you would expect hopefully, since 00019 * that's the whole point of this class) 00020 * 00021 * The generated events use 0 for their event source IDs. The row 00022 * skip is always 0, and the row stride is always width*3. But it 00023 * would be better to use the proper accessor functions to be more 00024 * general. 00025 * 00026 * should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator) 00027 */ 00028 class InterleavedYUVGenerator : public FilterBankGenerator { 00029 public: 00030 //! constructor 00031 InterleavedYUVGenerator(EventBase::EventGeneratorID_t gid, unsigned int sid, unsigned int mysid); 00032 //! constructor, you can pass which channels to interleave 00033 InterleavedYUVGenerator(EventBase::EventGeneratorID_t gid, unsigned int sid, unsigned int mysid, unsigned int syc, unsigned int suc, unsigned int svc); 00034 00035 static const unsigned int CHAN_YUV=0; //!< so you can refer to the YUV channel symbolically. 00036 00037 static std::string getClassDescription() { return "Converts a FilterBankGenerator's data into interleaved format"; } 00038 00039 //! should receive FilterBankEvents from any standard format FilterBankGenerator (like RawCameraGenerator) 00040 virtual void processEvent(const EventBase& event); 00041 00042 virtual unsigned int getBinSize() const; 00043 00044 virtual unsigned int LoadBuffer(const char buf[], unsigned int len); 00045 00046 virtual unsigned int SaveBuffer(char buf[], unsigned int len) const; 00047 00048 protected: 00049 virtual void setNumImages(unsigned int nLayers, unsigned int nChannels); 00050 virtual void setDimensions(); //!< resets width, height, skip and stride parameters 00051 virtual unsigned char * createImageCache(unsigned int layer, unsigned int chan) const; 00052 virtual void calcImage(unsigned int layer, unsigned int chan) const; 00053 00054 const FilterBankGenerator * src; //!< the generator of the last FilterBankEvent received 00055 unsigned int srcYChan; //!< the channel of the source's Y channel 00056 unsigned int srcUChan; //!< the channel of the source's U channel 00057 unsigned int srcVChan; //!< the channel of the source's V channel 00058 00059 private: 00060 InterleavedYUVGenerator(const InterleavedYUVGenerator& fbk); //!< don't call 00061 const InterleavedYUVGenerator& operator=(const InterleavedYUVGenerator& fbk); //!< don't call 00062 }; 00063 00064 /*! @file 00065 * @brief Describes InterleavedYUVGenerator, which generates FilterBankEvents containing raw camera images with interleaved pixels (YUVYUVYUV... instead of YYY...UUU...VVV...) 00066 * @author ejt (Creator) 00067 * 00068 * $Author: ejt $ 00069 * $Name: tekkotsu-2_0 $ 00070 * $Revision: 1.7 $ 00071 * $State: Exp $ 00072 * $Date: 2004/01/18 10:16:59 $ 00073 */ 00074 00075 #endif
Tekkotsu v2.0 |
Generated Wed Jan 21 03:20:28 2004 by Doxygen 1.3.4 |