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 * <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #ifndef __lfeat_keypoint_h
00022 #define __lfeat_keypoint_h
00023 
00024 #include <hugin_shared.h>
00025 #include "hugin_utils/shared_ptr.h"
00026 #include <vector>
00027 
00028 namespace lfeat
00029 {
00030 
00031 
00032 class KeyPoint
00033 {
00034 public:
00035     KeyPoint();
00036     KeyPoint(const KeyPoint& k);
00037     KeyPoint(double x, double y, double s, double score, int trace);
00038     KeyPoint& operator=(const KeyPoint& k) throw();
00039 
00040     ~KeyPoint();
00041 
00042     void allocVector(int iSize);
00043 
00044     double              _x, _y;
00045     double              _scale;
00046     double              _score;
00047     int                 _trace;
00048     double              _ori;
00049 
00050     double*             _vec;
00051 
00052 };
00053 
00054 inline KeyPoint::KeyPoint() : _vec(0), _x(0), _y(0), _scale(1), _score(0), _trace(0), _ori(0)
00055 {
00056 
00057 }
00058 
00059 inline KeyPoint::KeyPoint(double x, double y, double s, double score, int trace) :
00060     _x(x), _y(y), _scale(s), _score(score), _trace(trace), _vec(0), _ori(0)
00061 {
00062 
00063 }
00064 
00065 inline KeyPoint::KeyPoint(const KeyPoint& k) :
00066     _x(k._x), _y(k._y), _scale(k._scale), _score(k._score), _trace(k._trace), _vec(0), _ori(0)
00067 {
00068 
00069 }
00070 
00071 
00072 inline KeyPoint& KeyPoint::operator=(const KeyPoint& k) throw()
00073 {
00074     if (this == &k)
00075     {
00076         return *this;
00077     }
00078     _x = k._x;
00079     _y = k._y;
00080     _scale = k._scale;
00081     _score = k._score;
00082     _trace = k._trace;
00083     _vec = 0;
00084     _ori = k._ori;
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 sharedPtrNamespace::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 28 Jul 2015 for Hugintrunk by  doxygen 1.4.7