Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
HomographyEstimator.hpp
00001 #ifndef _JAFAR_HOMOGRAPHY_HOMOGRAPHY_ESTIMATOR_HPP_
00002 #define _JAFAR_HOMOGRAPHY_HOMOGRAPHY_ESTIMATOR_HPP_
00003 
00004 #include "image/Image.hpp"
00005 #include "jmath/jblas.hpp"
00006 
00007 #include "homography/ImageGradients.hpp"
00008 
00009 namespace jafar {
00010   namespace textures {
00011     class Attributes;
00012   }
00013   namespace homography {
00021     class HomographyEstimator {
00022       public:
00023         struct Statistics {
00024           ~Statistics();
00025           double mean, stddev;
00026           std::vector<double> znccs, errors;
00027           std::vector<jblas::mat33 > updates;
00028           std::vector<jblas::mat33 > homographies;
00029           textures::Attributes* attributes;
00030           void print();
00031         };
00032       public:
00037         HomographyEstimator(int hsp) : m_halfSizePatch(hsp), m_sizePatch (2 * hsp + 1) { }
00038         virtual ~HomographyEstimator() { }
00039       public:
00040         inline jblas::mat33 estimate(const jafar::image::Image& imgref, const ImageGradients& imggradref, double uref, double vref, const jafar::image::Image& imgmatch, const ImageGradients& imggradmatch, double umatch, double vmatch, jafar::homography::HomographyEstimator::Statistics& stats)
00041         {
00042           jblas::mat33 result;
00043           estimate(result, imgref, imggradref, uref, vref, imgmatch, imggradmatch, umatch, vmatch, stats);
00044           return result;
00045         }
00046         virtual void estimate(jblas::mat33& homography, const jafar::image::Image& imgref, const ImageGradients& imggradref, double uref, double vref, const jafar::image::Image& imgmatch, const ImageGradients& imggradmatch, double umatch, double vmatch, jafar::homography::HomographyEstimator::Statistics& stats) = 0;
00047       protected:
00048         void wrapImage(const jafar::image::Image& imgsrc,jafar::image::Image& imgdst, const jblas::mat33& homography);
00049         double errorImage( jafar::image::Image& imgerr, const jafar::image::Image& img1, const jafar::image::Image& img2 );
00050       public:
00051         void setHalfSizePatch(int sp) { m_halfSizePatch = sp; m_sizePatch = 2 * sp + 1; }
00052         int halfSizePatch() { return m_halfSizePatch; }
00053         int sizePatch() { return m_sizePatch; }
00054         int iterations() { return 10; }
00055       private:
00056         int m_halfSizePatch, m_sizePatch;
00057     };
00063     class SecondOrderHomographyEstimator : public HomographyEstimator {
00064       public:
00065         SecondOrderHomographyEstimator(int hsp = 4) : HomographyEstimator(hsp)
00066         {
00067         }
00068         virtual ~SecondOrderHomographyEstimator() { }
00069       public:
00070         virtual void estimate(jblas::mat33& homography, const jafar::image::Image& imgref, const ImageGradients& imggradref, double uref, double vref, const jafar::image::Image& imgmatch, const ImageGradients& imggradmatch, double umatch, double vmatch, jafar::homography::HomographyEstimator::Statistics& stats);
00071     };
00077     class InverseCompositionalHomographyEstimator : public HomographyEstimator {
00078       public:
00079         InverseCompositionalHomographyEstimator(int hsp = 4) : HomographyEstimator(hsp)
00080         {
00081         }
00082         virtual ~InverseCompositionalHomographyEstimator() { }
00083       public:
00084         virtual void estimate(jblas::mat33& homography, const jafar::image::Image& imgref, const ImageGradients& imggradref, double uref, double vref, const jafar::image::Image& imgmatch, const ImageGradients& imggradmatch, double umatch, double vmatch, jafar::homography::HomographyEstimator::Statistics& stats);
00085     };
00086   }
00087 }
00088 
00089 #endif
00090 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:20 for Jafar by doxygen 1.7.6.1
LAAS-CNRS