-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfasthessian.h
executable file
·108 lines (77 loc) · 3.32 KB
/
fasthessian.h
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/***********************************************************
* --- OpenSURF --- *
* This library is distributed under the GNU GPL. Please *
* contact chris.evans@irisys.co.uk for more information. *
* *
* C. Evans, Research Into Robust Visual Features, *
* MSc University of Bristol, 2008. *
* *
************************************************************/
#ifndef FASTHESSIAN_H
#define FASTHESSIAN_H
#include "cv.h"
#include "ipoint.h"
#include <vector>
static const int OCTAVES = 4;
static const int INTERVALS = 4;
static const float THRES = 0.0004f;
static const int INIT_SAMPLE = 2;
class FastHessian {
public:
//! Destructor
~FastHessian();
//! Constructor without image
FastHessian(std::vector<Ipoint> &ipts,
const int octaves = OCTAVES,
const int intervals = INTERVALS,
const int init_sample = INIT_SAMPLE,
const float thres = THRES);
//! Constructor with image
FastHessian(IplImage *img,
std::vector<Ipoint> &ipts,
const int octaves = OCTAVES,
const int intervals = INTERVALS,
const int init_sample = INIT_SAMPLE,
const float thres = THRES);
//! Save the parameters
void saveParameters(const int octaves,
const int intervals,
const int init_sample,
const float thres);
//! Set or re-set the integral image source
void setIntImage(IplImage *img);
//! Find the image features and write into vector of features
void getIpoints();
private:
//---------------- Private Functions -----------------//
//! Calculate determinant of hessian responses
void buildDet();
//! Non Maximal Suppression function
int isExtremum(int octave, int interval, int column, int row);
//! Return the value of the approximated determinant of hessian
inline float getVal(int octave, int interval, int column, int row);
//! Return the sign of the laplacian (trace of the hessian)
inline int getLaplacian(int o, int i, int c, int r);
//! Interpolation functions - adapted from Lowe's SIFT implementation
void interpolateExtremum(int octv, int intvl, int r, int c);
void interpolateStep( int octv, int intvl, int r, int c, double* xi, double* xr, double* xc );
CvMat* deriv3D( int octv, int intvl, int r, int c );
CvMat* hessian3D(int octv, int intvl, int r, int c );
//---------------- Private Variables -----------------//
//! Pointer to the integral Image, and its attributes
IplImage *img;
int i_width, i_height;
//! Reference to vector of features passed from outside
std::vector<Ipoint> &ipts;
//! Number of Octaves
int octaves;
//! Number of Intervals per octave
int intervals;
//! Initial sampling step for Ipoint detection
int init_sample;
//! Threshold value for blob resonses
float thres;
//! Array stack of determinant of hessian values
float *m_det;
};
#endif