Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages
matchpoint/HessianDetector.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Zoran Mesec * 00003 * zoran.mesec@gmail.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef HESSIANDETECTOR_H_ 00022 #define HESSIANDETECTOR_H_ 00023 #include "APImage.h" 00024 00025 using namespace std; 00026 00027 #define CONVOLUTION_TYPE int 00028 #define HD_SLIDING_WINDOW 2 00029 #define HD_BOX_FILTERS 1 00030 #define HD_MAX_OCTAVES 3 00031 #define HD_INITIAL_SCALE 1.2 00032 00033 //initial kernel size, representing scale 1.2 00034 #define HD_INIT_KERNEL_SIZE 9 00035 00036 #define PI 3.14159265 00037 00038 class HessianDetector 00039 { 00040 public: 00041 HessianDetector(APImage* i, int nrPoints=1000, CONVOLUTION_TYPE type=HD_BOX_FILTERS, int nrOctaves=1); 00042 00043 bool detect(); 00044 void printPoints(); 00045 void printPoints(std::ostream & o); 00046 00047 //clears memory of data structures that are not required anymore(before the description process) 00048 void dump(); 00049 vector<vector<int> >* getPoints(); 00050 double getMaxima(int x, int y); 00051 int getNrPoints(); 00052 00053 /* private slots: 00054 */ 00055 00056 private: 00057 APImage* image; 00058 int nrPoints; 00059 int nrOctaves; 00060 CONVOLUTION_TYPE convolutionType; 00061 00068 //Point is represented as T(x,y) 00069 //determinants[x][y] stands for determinant of point T(x,y) 00070 std::vector<vector<int> > determinants; //holds the values of the hessian determinant for each pixel 00071 std::vector<vector<int> > orderedList; //first n pixels with the largest determinant values 00072 //determinants[x][y] 00073 std::vector<vector<double> > maximas; //holds the scales where scale-space representation for each pixel attends maximum 00074 00075 int _getHessianDeterminant(int* pixelSumXX, int* pixelSumXY, int *pixelSumYY); 00076 void _calculateMaxDet(int i, int j); //calculates scale-space maxima for pixel at coord i,j 00077 void _cutPointList(double average, int nrPoints); 00078 double _getScale(int kernelSize); 00079 int _convolutePixel(int* coordX, int* coordY, int* kernelSize); 00080 00081 bool _boxFilterDetect(); 00082 bool _slidingWDetect(); 00083 void _insertToList(int* x, int* y); 00084 }; 00085 00086 #endif /*HESSIANDETECTOR_H_*/
1.3.9.1