TuttleOFX  1
tps.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_TPS_HPP_
00002 #define _TUTTLE_PLUGIN_TPS_HPP_
00003 
00004 #include "../WarpDefinitions.hpp"
00005 
00006 #include <tuttle/plugin/global.hpp>
00007 
00008 #include <ofxsImageEffect.h>
00009 
00010 #include <boost/numeric/ublas/matrix.hpp>
00011 #include <boost/gil/gil_all.hpp>
00012 
00013 
00014 namespace tuttle {
00015 namespace plugin {
00016 namespace warp {
00017 
00018 using namespace boost::gil;
00019 using namespace boost::numeric::ublas;
00020 
00021 template<typename SCALAR>
00022 class TPS_Morpher
00023 {
00024 public:
00025         typedef SCALAR Scalar;
00026         typedef point2<Scalar> Point2;
00027 
00028         typedef matrix<Scalar> Matrix;
00029         typedef matrix_row<const Matrix> Const_Matrix_Row;
00030         typedef matrix_column<const Matrix> Const_Matrix_Col;
00031 
00032         bool _activateWarp;
00033         std::size_t _nbPoints;
00034         double _width;
00035         double _height;
00036         double _transition;
00037 
00038 public:
00039         TPS_Morpher();
00040 
00041         void setup( const std::vector< Point2 > pIn, const std::vector< Point2 > pOut, const double regularization, const bool applyWarp, const std::size_t width, const std::size_t height , const double transition);
00042 
00043         template<typename S2>
00044         Point2 operator()( const point2<S2>& pt ) const;
00045 
00046 private:
00047         std::vector<Point2> _pIn;
00048         std::vector<Point2> _pOut;
00049 
00050         Matrix _mat_L;
00051         Matrix _mat_V;
00052         Matrix _mat_K;
00053 };
00054 
00055 }
00056 }
00057 }
00058 
00059 #include "tps.tcc"
00060 
00061 #endif