KeyPointDetector.h
Go to the documentation of this file.
00001 /*
00002 * This file is part of Parallel SURF, which implements the SURF algorithm
00003 * using multi-threading.
00004 *
00005 * Copyright (C) 2010 David Gossow
00006 *
00007 * It is based on the SURF implementation included in Pan-o-matic 0.9.4,
00008 * written by Anael Orlinski.
00009 *
00010 * Parallel SURF is free software; you can redistribute it and/or modify
00011 * it under the terms of the GNU General Public License as published by
00012 * the Free Software Foundation; either version 3 of the License, or
00013 * (at your option) any later version.
00014 *
00015 * Parallel SURF is distributed in the hope that it will be useful,
00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 * GNU General Public License for more details.
00019 *
00020 * You should have received a copy of the GNU General Public License
00021 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00022 */
00023 
00024 #ifndef __parallelsurf_keypointdetector_h
00025 #define __parallelsurf_keypointdetector_h
00026 
00027 #include "Image.h"
00028 #include "KeyPoint.h"
00029 
00030 #include <boost/thread.hpp>
00031 #include "../ThreadPool/threadpool.hpp"
00032 
00033 namespace parallelsurf
00034 {
00035 
00037 class KeyPointInsertor
00038 {
00039   public:
00040     virtual void operator() ( const KeyPoint &k ) = 0;
00041 };
00042 
00043 class KeyPointDetector
00044 {
00045   public:
00051     KeyPointDetector ( Image& iImage, boost::threadpool::pool &iThreadPool );
00052 
00054     inline void setMaxScales ( int iMaxScales ) { _maxScales = iMaxScales; }
00055 
00057     inline void setMaxOctaves ( int iMaxOctaves ) { _maxOctaves = iMaxOctaves; }
00058 
00060     inline void setScoreThreshold ( double iThreshold ) { _scoreThreshold = iThreshold; }
00061 
00067     void detectKeyPoints ( KeyPointInsertor& iInsertor );
00068 
00069   private:
00070 
00071     int getFilterSize ( int iOctave, int iScale );
00072     int getBorderSize ( int iOctave, int iScale );
00073 
00074     // internal values of the keypoint detector
00075 
00076     // number of scales
00077     int _maxScales;
00078 
00079     // number of octaves
00080     int _maxOctaves;
00081 
00082     // detection score threshold
00083     double _scoreThreshold;
00084 
00085     // initial box filter size
00086     int _initialBoxFilterSize;
00087 
00088     // scale overlapping : how many filter sizes to overlap
00089     // with default value 3 : [3,5,7,9,11][7,11,15,19,23][...
00090     int _scaleOverlap;
00091 
00092     // some default values.
00093     const static double kBaseSigma;
00094     
00095     Image &_image;
00096 
00097     boost::threadpool::pool &_threadPool;
00098 
00102     struct ComputeHelper
00103     {
00104       Image& _image;
00105       double ***_scaleHessian;
00106       const int _octave;
00107       const int _octaveWidth;
00108       const int _octaveHeight;
00109       const int _pixelStep;
00110       const int * _borderSize;
00111       const double _scoreThreshold;
00112       const int _initialBoxFilterSize;
00113       const int _maxScales;
00114 
00115       boost::mutex &_insertorMutex;
00116 
00118       void calcDet ( int s, int filterSize );
00119       
00121       void detect ( int s, KeyPointInsertor& iInsertor );
00122 
00124       bool fineTuneExtrema ( double *** iSH, int iX, int iY, int iS,
00125                              double& oX, double& oY, double& oS, double& oScore,
00126                              int iOctaveWidth, int iOctaveHeight, int iBorder );
00127 
00129       bool calcTrace ( Image& iImage, double iX, double iY, double iScale, int& oTrace );
00130     };
00131 
00132 };
00133 
00134 }
00135 
00136 #endif //__parallelsurf_keypointdetector_h


or_libs
Author(s): Viktor Seib
autogenerated on Tue Jan 7 2014 11:24:03