TuttleOFX  1
ColorTransferProcess.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_COLORTRANSFER_PROCESS_HPP_
00002 #define _TUTTLE_PLUGIN_COLORTRANSFER_PROCESS_HPP_
00003 
00004 #include <tuttle/plugin/ImageGilFilterProcessor.hpp>
00005 
00006 #include <terry/globals.hpp>
00007 #include <tuttle/plugin/ImageGilFilterProcessor.hpp>
00008 #include <tuttle/plugin/exceptions.hpp>
00009 #include <boost/numeric/ublas/vector.hpp>
00010 
00011 #include <ofxsImageEffect.h>
00012 #include <ofxsMultiThread.h>
00013 
00014 #include <boost/scoped_ptr.hpp>
00015 
00016 #include <cstdlib>
00017 #include <cassert>
00018 #include <cmath>
00019 #include <vector>
00020 #include <iostream>
00021 
00022 namespace tuttle {
00023 namespace plugin {
00024 namespace colorTransfer {
00025 
00026 /**
00027  * @brief ColorTransfer process
00028  *
00029  */
00030 using namespace boost::numeric::ublas;
00031 
00032 template<class View>
00033 class ColorTransferProcess : public ImageGilFilterProcessor<View>
00034 {
00035 public:
00036         typedef typename View::value_type Pixel;
00037         typedef typename boost::gil::channel_type<View>::type Channel;
00038         typedef ColorTransferPlugin::Scalar Scalar;
00039 
00040         // Source ref image clip
00041         boost::scoped_ptr<OFX::Image> _srcRef;
00042         OfxRectI _srcRefPixelRod;
00043         View _srcRefView;
00044 
00045         // Dst ref image clip
00046         boost::scoped_ptr<OFX::Image> _dstRef;
00047         OfxRectI _dstRefPixelRod;
00048         View _dstRefView;
00049 
00050 protected:
00051         ColorTransferPlugin& _plugin; ///< Rendering plugin
00052         ColorTransferProcessParams<Scalar> _params; ///< parameters
00053 
00054         Pixel _srcRefAverage, _dstRefAverage, _deviationRatio;
00055 
00056 
00057 public:
00058         ColorTransferProcess( ColorTransferPlugin& effect );
00059 
00060         void setup( const OFX::RenderArguments& args );
00061 
00062         void multiThreadProcessImages( const OfxRectI& procWindowRoW );
00063 
00064 private:
00065         void computeAverage( const View& image, Pixel& average, Pixel& deviation, const EColorspace& eColorspace );
00066 
00067 };
00068 
00069 }
00070 }
00071 }
00072 
00073 #include "ColorTransferProcess.tcc"
00074 
00075 #endif