-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfasthessian.h
108 lines (79 loc) · 3.22 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 *
* use the contact form at http://www.chrisevansdev.com *
* 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>
class ResponseLayer;
static const int OCTAVES = 5;//组数默认设置为5
static const int INTERVALS = 4;//层数默认设置为4
static const float THRES = 0.0004f;//斑点响应阈值默认设置为0.0004
static const int INIT_SAMPLE = 2;//采样间隔为2
class FastHessian {
public:
//构造函数(不带图像)
FastHessian(std::vector<Ipoint> &ipts,
const int octaves = OCTAVES,
const int intervals = INTERVALS,
const int init_sample = INIT_SAMPLE,
const float thres = THRES);
//构造函数(带图像)
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);
//析构函数
~FastHessian();
//保存参数
void saveParameters(const int octaves,
const int intervals,
const int init_sample,
const float thres);
//设置或重新设定积分图像来源
void setIntImage(IplImage *img);
//获取图像的特性并写入到特征向量中
void getIpoints();
private:
//---------------- 私有函数 -----------------//
//建立DoH响应表
void buildResponseMap();
//计算r层的DoH响应
void buildResponseLayer(ResponseLayer *r);
//在3x3x3空间中寻找极值点
int isExtremum(int r, int c, ResponseLayer *t, ResponseLayer *m, ResponseLayer *b);
//插值函数 - 改编自Lowe的SIFT算法
void interpolateExtremum(int r, int c, ResponseLayer *t, ResponseLayer *m, ResponseLayer *b);
void interpolateStep(int r, int c, ResponseLayer *t, ResponseLayer *m, ResponseLayer *b,
double* xi, double* xr, double* xc );
CvMat* deriv3D(int r, int c, ResponseLayer *t, ResponseLayer *m, ResponseLayer *b);
CvMat* hessian3D(int r, int c, ResponseLayer *t, ResponseLayer *m, ResponseLayer *b);
//---------------- 私有变量 -----------------//
//积分图像指针及其属性
IplImage *img;
int i_width, i_height;
//外部参考向量的特征(Reference to vector of features passed from outside)
std::vector<Ipoint> &ipts;
//hessian行列式的响应值
std::vector<ResponseLayer *> responseMap;
//组数
int octaves;
//每组层数
int intervals;
//! Initial sampling step for Ipoint detection
//初始特征检测的抽样间隔
int init_sample;
//斑点响应阈值
float thresh;
};
#endif