[e976b6]: src / hugin_base / algorithms / control_points / HessianDetector.h Maximize Restore History

Download this file

HessianDetector.h    87 lines (72 with data), 3.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/***************************************************************************
* Copyright (C) 2007 by Zoran Mesec *
* zoran.mesec@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef HESSIANDETECTOR_H_
#define HESSIANDETECTOR_H_
#include "APImage.h"
using namespace std;
#define CONVOLUTION_TYPE int
#define HD_SLIDING_WINDOW 2
#define HD_BOX_FILTERS 1
#define HD_MAX_OCTAVES 3
#define HD_INITIAL_SCALE 1.2
//initial kernel size, representing scale 1.2
#define HD_INIT_KERNEL_SIZE 9
#define PI 3.14159265
class HessianDetector
{
public:
HessianDetector(APImage* i, int nrPoints=1000, CONVOLUTION_TYPE type=HD_BOX_FILTERS, int nrOctaves=1);
bool detect();
void printPoints();
void printPoints(std::ostream & o);
//clears memory of data structures that are not required anymore(before the description process)
void dump();
vector<vector<int> >* getPoints();
double getMaxima(int x, int y);
int getNrPoints();
/* private slots:
*/
private:
APImage* image;
int nrPoints;
int nrOctaves;
CONVOLUTION_TYPE convolutionType;
/**
* 0---> x
* |
* |
* v y
*/
//Point is represented as T(x,y)
//determinants[x][y] stands for determinant of point T(x,y)
std::vector<vector<int> > determinants; //holds the values of the hessian determinant for each pixel
std::vector<vector<int> > orderedList; //first n pixels with the largest determinant values
//determinants[x][y]
std::vector<vector<double> > maximas; //holds the scales where scale-space representation for each pixel attends maximum
int _getHessianDeterminant(int* pixelSumXX, int* pixelSumXY, int *pixelSumYY);
void _calculateMaxDet(int i, int j); //calculates scale-space maxima for pixel at coord i,j
void _cutPointList(double average, int nrPoints);
double _getScale(int kernelSize);
int _convolutePixel(int* coordX, int* coordY, int* kernelSize);
bool _boxFilterDetect();
bool _slidingWDetect();
void _insertToList(int* x, int* y);
};
#endif /*HESSIANDETECTOR_H_*/