TuttleOFX
1
|
00001 #ifndef _TUTTLE_PLUGIN_SOBEL_PROCESS_HPP_ 00002 #define _TUTTLE_PLUGIN_SOBEL_PROCESS_HPP_ 00003 00004 #include <tuttle/plugin/ImageGilFilterProcessor.hpp> 00005 #include <boost/mpl/bool.hpp> 00006 00007 namespace tuttle { 00008 namespace plugin { 00009 namespace sobel { 00010 00011 /** 00012 * @brief Sobel process 00013 * 00014 */ 00015 template<class SView, class DView> 00016 class SobelProcess : public ImageGilFilterProcessor<SView, DView> 00017 { 00018 public: 00019 typedef float Scalar; 00020 typedef typename SView::point_t Point; 00021 typedef typename DView::value_type DPixel; 00022 00023 protected : 00024 SobelPlugin& _plugin; ///< Rendering plugin 00025 SobelProcessParams<Scalar> _params; ///< user parameters 00026 00027 DPixel _pixelZero; 00028 00029 public: 00030 SobelProcess( SobelPlugin& effect ); 00031 00032 void setup( const OFX::RenderArguments& args ); 00033 void preProcess(); 00034 void multiThreadProcessImages( const OfxRectI& procWindowRoW ); 00035 00036 // template<class ProcPixelGray> 00037 // void computeXPass2( DView& dst, const Point& proc_tl, boost::mpl::true_ ); 00038 // template<class ProcPixelGray> 00039 // void computeXPass2( DView& dst, const Point& proc_tl, boost::mpl::false_ ) 00040 // { 00041 // BOOST_THROW_EXCEPTION( exception::Bug() ); 00042 // } 00043 00044 template<class ProcPixelGray> 00045 void computeYPass2( DView& dst, const Point& proc_tl, boost::mpl::true_ ) 00046 { 00047 using namespace terry; 00048 using namespace terry::filter; 00049 correlate_cols_auto<ProcPixelGray>( 00050 kth_channel_view<1>( this->_srcView ), 00051 _params._yKernelGaussianDerivative, 00052 kth_channel_view<1>(dst), 00053 proc_tl, 00054 _params._boundary_option ); 00055 } 00056 template<class ProcPixelGray> 00057 void computeYPass2( DView& dst, const Point& proc_tl, boost::mpl::false_ ) 00058 { 00059 BOOST_THROW_EXCEPTION( exception::Bug() ); 00060 } 00061 00062 void computeGradientDirection( DView& dst, boost::mpl::true_ ); 00063 void computeGradientDirection( DView& dst, boost::mpl::false_ ){} 00064 }; 00065 00066 } 00067 } 00068 } 00069 00070 #include "SobelProcess.tcc" 00071 00072 #endif