TuttleOFX  1
ConvolutionPlugin.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_CONVOLUTION_PLUGIN_HPP_
00002 #define _TUTTLE_PLUGIN_CONVOLUTION_PLUGIN_HPP_
00003 
00004 #include "ConvolutionDefinitions.hpp"
00005 
00006 #include <tuttle/plugin/ImageEffectGilPlugin.hpp>
00007 
00008 #include <terry/filter/convolve.hpp>
00009 
00010 //#include <boost/numeric/ublas/matrix.hpp>
00011 
00012 #include <vector>
00013 
00014 namespace tuttle {
00015 namespace plugin {
00016 namespace convolution {
00017 
00018 struct ConvolutionProcessParams
00019 {
00020 //      boost::numeric::ublas::matrix<double> _convMatrix;
00021         typedef float Scalar;
00022         typedef terry::filter::kernel_1d<Scalar> Kernel;
00023         
00024         boost::gil::point2<unsigned int> _size;
00025         
00026         EParamBorder _border;
00027         terry::filter::convolve_boundary_option _boundary_option;
00028         
00029         Kernel _convX;
00030         Kernel _convY;
00031 };
00032 
00033 /**
00034  * @brief Convolution plugin
00035  */
00036 class ConvolutionPlugin : public ImageEffectGilPlugin
00037 {
00038 public:
00039         ConvolutionPlugin( OfxImageEffectHandle handle );
00040 
00041 public:
00042         void render( const OFX::RenderArguments& args );
00043         
00044         bool isIdentity( const OFX::RenderArguments& args, OFX::Clip*& identityClip, double& identityTime );
00045         void getRegionsOfInterest( const OFX::RegionsOfInterestArguments& args, OFX::RegionOfInterestSetter& rois );
00046         bool getRegionOfDefinition( const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod );
00047 
00048         void changedParam( const OFX::InstanceChangedArgs& args, const std::string& paramName );
00049 
00050         ConvolutionProcessParams getProcessParams() const;
00051 
00052 public:
00053         OFX::Int2DParam* _paramSize;
00054         OFX::ChoiceParam* _paramBorder;
00055         std::vector<std::vector<OFX::DoubleParam*> > _paramCoef;
00056 };
00057 
00058 }
00059 }
00060 }
00061 
00062 #endif