Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
planLocalizer.hpp
00001 /* $Id: localizer.hpp 3961 2009-08-03 12:30:00Z nksallem $ */
00002 
00003 #ifndef LOCALIZER_PLAN_LOCALIZER_HPP
00004 #define LOCALIZER_PLAN_LOCALIZER_HPP
00005 
00006 #include "kernel/jafarException.hpp"
00007 #include "jmath/jblas.hpp"
00008 #include "localizer/point2d3d.hpp"
00009 #include <opencv/cxcore.h>
00010 #if CV_MAJOR_VERSION*10 + CV_MINOR_VERSION > 21
00011 #include <opencv2/imgproc/imgproc.hpp>
00012 #include <opencv2/calib3d/calib3d.hpp>
00013 #else
00014 #include <cv.h>
00015 #include <cv.hpp>
00016 #include <cxtypes.h>
00017 #include <cxcore.h>
00018 #endif
00019 
00020 namespace jafar {
00021 
00022   namespace localizer {
00023     
00024     
00031     class PlanLocalizer {
00033       std::vector<cv::Point2f> sources;
00035       std::vector<cv::Point2f> matches;
00037       std::vector<uchar> status;
00039       jblas::mat33 m_homography;
00040       //validity threshold for homography
00041       double validityThreshold;
00042 
00046       bool isValidHomography(const cv::Mat& homography, 
00047            const double& thresholdForDeterminant);
00048     public:
00049       PlanLocalizer();
00050       PlanLocalizer(const std::vector<cv::Point2f>& _sources, 
00051                     const std::vector<cv::Point2f>& _matches);
00052       PlanLocalizer(const std::vector<jblas::vec2>& _sources, 
00053                     const std::vector<jblas::vec2>& _matches);
00054       //      PlanLocalizer(const image::Image& object, const image::Image& model);
00055       void addPair(const cv::Point2f& _src, const cv::Point2f& _ref);
00056       void addPair(const jblas::vec2& _src, const jblas::vec2& _ref);
00057       void addPair(const float& u_src, const float& v_src, 
00058                    const float& u_ref, const float& v_ref);
00060       cv::Mat getHomographyMatrix(int method = CV_RANSAC, 
00061           size_t requiredMatch=8,
00062           int ransacReprojThreshold=3,
00063           double validityThreshold = 0.);
00064       jblas::mat33 homography() const { return m_homography; }
00065     };
00066   }//namespace localizer
00067   
00068 }//namespace jafar
00069 
00070 #endif //LOCALIZER_PLAN_LOCALIZER_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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