KeyPoint.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 __lfeat_keypoint_h
00022 #define __lfeat_keypoint_h
00023 
00024 #include <hugin_shared.h>
00025 
00026 #include <boost/shared_ptr.hpp>
00027 #include <vector>
00028 
00029 namespace lfeat
00030 {
00031 
00032 
00033 class KeyPoint
00034 {
00035 public:
00036     KeyPoint();
00037     KeyPoint(const KeyPoint& k);
00038     KeyPoint(double x, double y, double s, double score, int trace);
00039     KeyPoint& operator=(const KeyPoint& k) throw();
00040 
00041     ~KeyPoint();
00042 
00043     void allocVector(int iSize);
00044 
00045     double              _x, _y;
00046     double              _scale;
00047     double              _score;
00048     int                 _trace;
00049     double              _ori;
00050 
00051     double*             _vec;
00052 
00053 };
00054 
00055 inline KeyPoint::KeyPoint() : _vec(0)
00056 {
00057 
00058 }
00059 
00060 inline KeyPoint::KeyPoint(double x, double y, double s, double score, int trace) :
00061     _x(x), _y(y), _scale(s), _score(score), _trace(trace), _vec(0)
00062 {
00063 
00064 }
00065 
00066 inline KeyPoint::KeyPoint(const KeyPoint& k) :
00067     _x(k._x), _y(k._y), _scale(k._scale), _score(k._score), _trace(k._trace), _vec(0)
00068 {
00069 
00070 }
00071 
00072 
00073 inline KeyPoint& KeyPoint::operator=(const KeyPoint& k) throw()
00074 {
00075     if (this == &k)
00076     {
00077         return *this;
00078     }
00079     _x = k._x;
00080     _y = k._y;
00081     _scale = k._scale;
00082     _score = k._score;
00083     _trace = k._trace;
00084     _vec = 0;
00085     return *this;
00086 }
00087 
00088 inline KeyPoint::~KeyPoint()
00089 {
00090     if (_vec)
00091     {
00092         delete[] _vec;
00093     }
00094 }
00095 
00096 inline void KeyPoint::allocVector(int iSize)
00097 {
00098     _vec = new double[iSize];
00099 }
00100 
00101 
00102 inline bool operator < (const KeyPoint& iA, const KeyPoint& iB)
00103 {
00104     return (iA._score < iB._score);
00105 }
00106 
00107 
00108 
00109 
00110 typedef boost::shared_ptr<KeyPoint>             KeyPointPtr;
00111 typedef std::vector<KeyPointPtr>                        KeyPointVect_t;
00112 typedef std::vector<KeyPointPtr>::iterator      KeyPointVectIt_t;
00113 
00114 class KeyPointPtrSort
00115 {
00116 public:
00117     inline bool operator() (const KeyPointPtr& a, const KeyPointPtr& b) const
00118     {
00119         if (a->_score < b->_score)
00120         {
00121             return true;
00122         }
00123         else if (a->_score > b->_score)
00124         {
00125             return false;
00126         }
00127         else
00128         {
00129             // same score, order by scale
00130             return (a->_scale < b->_scale);
00131         }
00132     }
00133 };
00134 
00135 }
00136 
00137 #endif //__lfeat_keypoint_h
00138 

Generated on Thu Apr 17 01:25:42 2014 for Hugintrunk by  doxygen 1.3.9.1