00001
00002 #ifndef IMDESC_MATCH_HPP
00003 #define IMDESC_MATCH_HPP
00004
00005 #include <vector>
00006 #include "image/JfrImage.hpp"
00007 #include "imdesc/feature.hpp"
00008
00009 namespace jafar {
00010 namespace imdesc {
00011
00013 struct oneMatch {
00014 KBFeature one;
00015 KBFeature two;
00016 double score;
00017
00019 bool operator<(const oneMatch& m_) const {
00020 return (score < m_.score);
00021 }
00022
00024 bool operator>(const oneMatch& m_) const {
00025 return (score > m_.score);
00026 }
00027 };
00028
00033 class Match {
00034 public:
00036 Match(double thd_ = 0.8) : thd(thd_) {};
00037
00039 inline void setThreshold(double thd_) {
00040 thd = thd_;
00041 };
00042
00044 inline int getNbMatches() {
00045 return matches.size();
00046 };
00047
00049 inline oneMatch& get(int i) {
00050 return *(matches.begin()+i);
00051 };
00052
00057 void compute(const std::vector<KBFeature>& f1_,
00058 const jafar::image::JfrImage& src1_,
00059 const std::vector<KBFeature>& f2_,
00060 const jafar::image::JfrImage& src2_);
00061
00067 jafar::image::JfrImage* drawMatches(const jafar::image::JfrImage& src1_,
00068 const jafar::image::JfrImage& src2_);
00069
00070 private:
00072 double thd;
00074 std::vector<oneMatch> matches;
00075 };
00076
00077 }
00078 }
00079
00080 #endif // IMDESC_MATCH_HPP