PointMatch.h

Go to the documentation of this file.
00001 /*
00002 * Copyright (C) 2007-2008 Anael Orlinski
00003 *
00004 * This file is part of Panomatic.
00005 *
00006 * Panomatic is free software; you can redistribute it and/or modify
00007 * it under the terms of the GNU General Public License as published by
00008 * the Free Software Foundation; either version 2 of the License, or
00009 * (at your option) any later version.
00010 *
00011 * Panomatic is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 * GNU General Public License for more details.
00015 *
00016 * You should have received a copy of the GNU General Public License
00017 * along with Panomatic; if not, write to the Free Software
00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 */
00020 
00021 #ifndef __lfeatPointMatch_h
00022 #define __lfeatPointMatch_h
00023 
00024 #include <boost/shared_ptr.hpp>
00025 #include <vector>
00026 
00027 #include "KeyPoint.h"
00028 
00029 namespace lfeat
00030 {
00031 
00032 struct PointMatch
00033 {
00034 
00035     PointMatch(KeyPointPtr& aPM1, KeyPointPtr& aPM2) :
00036         _img1_x(aPM1->_x), _img1_y(aPM1->_y), _img2_x(aPM2->_x),  _img2_y(aPM2->_y),
00037         _img1_kp(aPM1), _img2_kp(aPM2) {};
00038 
00039     double _img1_x, _img1_y, _img2_x, _img2_y;
00040 
00041     // hold a reference to original keypoint
00042     KeyPointPtr         _img1_kp;
00043     KeyPointPtr         _img2_kp;
00044 
00045     //void print()
00046     //{
00047     //  std::cout << _img1_x << " " << _img2_x << " " << _img1_y << " " << _img2_y << std::endl;
00048     //}
00049 
00050 };
00051 
00052 typedef boost::shared_ptr<PointMatch> PointMatchPtr;
00053 typedef std::vector<PointMatchPtr> PointMatchVector_t;
00054 
00055 class PointMatchPtrSort
00056 {
00057 public:
00058     inline bool operator() (const PointMatchPtr& a, const PointMatchPtr& b) const
00059     {
00060         if (a->_img1_kp->_score < b->_img1_kp->_score)
00061         {
00062             return true;
00063         }
00064         else if (a->_img1_kp->_score > b->_img1_kp->_score)
00065         {
00066             return false;
00067         }
00068         else
00069         {
00070             // same score, order by _x coordinate (this also removes duplicate matches)
00071             return (a->_img1_kp->_y < b->_img1_kp->_y);
00072         }
00073     }
00074 };
00075 
00076 }
00077 
00078 #endif // __lfeatPointMatch_h

Generated on Mon Sep 1 01:25:41 2014 for Hugintrunk by  doxygen 1.3.9.1