00001
00002
00003 #ifndef _GFM_SIMPLEMATCH2_HPP_
00004 #define _GFM_SIMPLEMATCH2_HPP_
00005
00006 #include <boost/serialization/nvp.hpp>
00007 #include <boost/serialization/utility.hpp>
00008 #include <boost/serialization/version.hpp>
00009
00010 #include "gfm/Matcher.hpp"
00011
00012 namespace jafar {
00013 namespace gfm {
00019 class SimpleMatcher2 : public Matcher {
00020 public:
00027 SimpleMatcher2(double weakCompThres, double strongCompThres, bool matchNoId = true);
00028 public:
00029 virtual jafar::gfm::MatchingResult computeMatch( MatchSourceInfo* refsourceinfo, MatchSourceInfo* matchsourceinfo);
00030 private:
00031 double dichotomy(double min_angle, double max_angle, double precision_angle,
00032 fdetect::InterestFeature *pt1, fdetect::InterestFeature *pt2);
00033 fdetect::InterestFeature* testFor(fdetect::InterestFeature const* ip,
00034 jafar::fdetect::DetectionResult const& points);
00035 void getCandidates(fdetect::InterestFeature const* ip,
00036 jafar::fdetect::DetectionResult const& points,
00037 std::vector<fdetect::InterestFeature*>& candidates);
00038 private:
00039 double weakCompThres;
00040 double strongCompThres;
00041 bool matchNoId;
00042
00044 friend class boost::serialization::access;
00045 template<class Archive>
00046 void serialize(Archive &ar, const unsigned int version)
00047 {
00048 ar & BOOST_SERIALIZATION_NVP(weakCompThres);
00049 ar & BOOST_SERIALIZATION_NVP(strongCompThres);
00050 ar & BOOST_SERIALIZATION_NVP(matchNoId);
00051 }
00052 };
00053 }
00054
00055 namespace gfm_v2 {
00061 template<typename DESCRIPTOR>
00062 class SimpleMatcher2 : public Matcher<DESCRIPTOR> {
00063 public:
00070 SimpleMatcher2(double weakCompThres,
00071 double strongCompThres,
00072 bool matchNoId = true);
00073 public:
00074 virtual MatchingResult<DESCRIPTOR> computeMatch( MatchSourceInfo<DESCRIPTOR>* refsourceinfo,
00075 MatchSourceInfo<DESCRIPTOR>* matchsourceinfo);
00076 private:
00077 double dichotomy(double min_angle, double max_angle, double precision_angle,
00078 fdetect_v2::InterestFeature<DESCRIPTOR> *pt1,
00079 fdetect_v2::InterestFeature<DESCRIPTOR> *pt2);
00080 fdetect_v2::InterestFeature<DESCRIPTOR>* testFor(const fdetect_v2::InterestFeature<DESCRIPTOR> *ip,
00081 const fdetect_v2::DetectionResult<DESCRIPTOR> &points);
00082 void getCandidates(const fdetect_v2::InterestFeature<DESCRIPTOR> *ip,
00083 const fdetect_v2::DetectionResult<DESCRIPTOR> &points,
00084 std::vector<fdetect_v2::InterestFeature<DESCRIPTOR>* > &candidates);
00085 private:
00086 double weakCompThres;
00087 double strongCompThres;
00088 bool matchNoId;
00089
00091 friend class boost::serialization::access;
00092 template<class Archive>
00093 void serialize(Archive &ar, const unsigned int version)
00094 {
00095 ar & BOOST_SERIALIZATION_NVP(weakCompThres);
00096 ar & BOOST_SERIALIZATION_NVP(strongCompThres);
00097 ar & BOOST_SERIALIZATION_NVP(matchNoId);
00098 }
00099 };
00100 }
00101 }
00102
00103 #include "gfm/SimpleMatcher2.hxx"
00104 #endif