TuttleOFX  1
AnisotropicDiffusionProcess.hpp
Go to the documentation of this file.
00001 #ifndef _PDE_DENOISER_PROCESS_HPP_
00002 #define _PDE_DENOISER_PROCESS_HPP_
00003 
00004 #include "../imageUtils/ImageTensors.hpp"
00005 #include <tuttle/plugin/ImageGilFilterProcessor.hpp>
00006 
00007 #include <tuttle/common/utils/global.hpp>
00008 #include <tuttle/common/math/rectOp.hpp>
00009 #include <terry/globals.hpp>
00010 #include <tuttle/plugin/IProgress.hpp>
00011 #include <tuttle/plugin/exceptions.hpp>
00012 
00013 #include <ofxsImageEffect.h>
00014 #include <ofxsMultiThread.h>
00015 #include <boost/gil/gil_all.hpp>
00016 #include <boost/scoped_ptr.hpp>
00017 
00018 namespace tuttle {
00019 namespace plugin {
00020 namespace anisotropicFilter {
00021 namespace diffusion {
00022 
00023 using namespace imageUtils;
00024 
00025 struct region_t {
00026     unsigned int dox, doy;
00027     unsigned int dw, dh;
00028 };
00029 
00030 /**
00031  * @brief Base class for the denoising processor
00032  *
00033  */
00034 template<class View>
00035 class AnisotropicDiffusionProcess : public ImageGilFilterProcessor<View>
00036 {
00037     typedef typename View::value_type Pixel;
00038 protected :
00039     AnisotropicDiffusionPlugin&  _plugin;        ///< Rendering plugin
00040         boost::scoped_ptr<OFX::Image> _srcTensor;
00041     OFX::BooleanParam*  _fast_approx;   ///< Perform fast approximation
00042     OFX::RGBParam*      _amplitude;   ///< Red amplitude control parameter
00043     View                _srcView;       ///< Source image view
00044     View                _srcTensorView; ///< Source tensors image view
00045     OfxRectI _upScaledSrcBounds, _dBounds;
00046 
00047 public :
00048     AnisotropicDiffusionProcess<View>( AnisotropicDiffusionPlugin& instance );
00049 
00050     void setup( const OFX::RenderArguments& args );
00051 
00052     void multiThreadProcessImages( const OfxRectI& procWindowRoW );
00053 
00054     // Blur anisotopric
00055     void blur_anisotropic( View &dst, View &src, View &G,
00056                            const region_t & dregion, const OfxRGBColourD& amplitude,
00057                            const bool fast_approx=true, const float dl=0.8f,
00058                            const float da=30.0f, const float gauss_prec=2.0f );
00059 };
00060 
00061 }
00062 }
00063 }
00064 }
00065 
00066 #include "AnisotropicDiffusionProcess.tcc"
00067 
00068 #endif