Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PointMatch.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007-2008 Anael Orlinski
3 *
4 * This file is part of Panomatic.
5 *
6 * Panomatic is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * Panomatic is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Panomatic; if not, write to the Free Software
18 * <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef __lfeatPointMatch_h
22 #define __lfeatPointMatch_h
23 
24 #include <memory>
25 #include <vector>
26 
27 #include "KeyPoint.h"
28 
29 namespace lfeat
30 {
31 
32 struct PointMatch
33 {
34 
36  _img1_x(aPM1->_x), _img1_y(aPM1->_y), _img2_x(aPM2->_x), _img2_y(aPM2->_y),
37  _img1_kp(aPM1), _img2_kp(aPM2) {};
38 
39  double _img1_x, _img1_y, _img2_x, _img2_y;
40 
41  // hold a reference to original keypoint
44 
45  //void print()
46  //{
47  // std::cout << _img1_x << " " << _img2_x << " " << _img1_y << " " << _img2_y << std::endl;
48  //}
49 
50 };
51 
52 typedef std::shared_ptr<PointMatch> PointMatchPtr;
53 typedef std::vector<PointMatchPtr> PointMatchVector_t;
54 
56 {
57 public:
58  inline bool operator() (const PointMatchPtr& a, const PointMatchPtr& b) const
59  {
60  if (a->_img1_kp->_score < b->_img1_kp->_score)
61  {
62  return true;
63  }
64  else if (a->_img1_kp->_score > b->_img1_kp->_score)
65  {
66  return false;
67  }
68  else
69  {
70  // same score, order by _x coordinate (this also removes duplicate matches)
71  return (a->_img1_kp->_y < b->_img1_kp->_y);
72  }
73  }
74 };
75 
76 }
77 
78 #endif // __lfeatPointMatch_h
std::vector< PointMatchPtr > PointMatchVector_t
Definition: PointMatch.h:53
PointMatch(KeyPointPtr &aPM1, KeyPointPtr &aPM2)
Definition: PointMatch.h:35
KeyPointPtr _img1_kp
Definition: PointMatch.h:42
KeyPointPtr _img2_kp
Definition: PointMatch.h:43
bool operator()(const PointMatchPtr &a, const PointMatchPtr &b) const
Definition: PointMatch.h:58
std::shared_ptr< KeyPoint > KeyPointPtr
Definition: KeyPoint.h:110
std::shared_ptr< PointMatch > PointMatchPtr
Definition: PointMatch.h:52