-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFeatureComputer.hpp
142 lines (96 loc) · 2.82 KB
/
FeatureComputer.hpp
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#ifndef Define_LcFeatureComputer
#define Define_LcFeatureComputer
#include <cstring>
#include <opencv2/opencv.hpp>
#include <opencv2/flann/config.h>
#include <opencv2/legacy/legacy.hpp> // EM
#include <opencv2/contrib/contrib.hpp> // colormap
#include <opencv2/nonfree/nonfree.hpp> // SIFT
#include "LcBasic.h"
using namespace std;
using namespace cv;
//a father class
class LcFeatureComputer
{
public:
int dim;
int bound;
int veb;
bool use_motion;
virtual void compute( Mat & img, vector<KeyPoint> & keypts, Mat & desc){;}
};
class LcFeatureExtractor
{
public:
LcFeatureExtractor();
int veb;
int bound_setting;
void img2keypts( Mat & img, vector<KeyPoint> & keypts,Mat & img_ext, vector<KeyPoint> & keypts_ext, int step_size);
void work(Mat & img , Mat & desc, int step_size, vector<KeyPoint> * p_keypoint = NULL);
void work(Mat & img , Mat & desc, vector<KeyPoint> * p_keypoint = NULL);
// That's the main interface member which return a descriptor matrix
// with an image input
void work(Mat & img, Mat & desc, Mat & img_gt, Mat & lab, vector<KeyPoint> * p_keypoint = NULL);
//with ground truth image output at same time
void work(Mat & img, Mat & desc, Mat & img_gt, Mat & lab, int step_size, vector<KeyPoint> * p_keypoint = NULL);
void set_extractor( string setting_string );
private:
vector < LcFeatureComputer * > computers;
int get_dim();
int get_maximal_bound();
void allocate_memory(Mat & desc,int dims,int data_n);
void extract_feature( Mat & img,vector<KeyPoint> & keypts,
Mat & img_ext, vector<KeyPoint> & keypts_ext,
Mat & desc);
void Groundtruth2Label( Mat & img_gt, cv::Size _size , vector< KeyPoint> , Mat & lab);
};
//================
#ifndef Define_LcColorSpaceType
#define Define_LcColorSpaceType
enum ColorSpaceType{
LC_RGB,LC_LAB,LC_HSV
};
#endif
template< ColorSpaceType color_type, int win_size>
class LcColorComputer: public LcFeatureComputer
{
public:
LcColorComputer();
void compute( Mat & img, vector<KeyPoint> & keypts, Mat & desc);
};
//================
class LcHoGComputer: public LcFeatureComputer
{
public:
LcHoGComputer();
void compute( Mat & img, vector<KeyPoint> & keypts, Mat & desc);
};
//================
class LcBRIEFComputer: public LcFeatureComputer
{
public:
LcBRIEFComputer();
void compute( Mat & img, vector<KeyPoint> & keypts, Mat & desc);
};
//===================
class LcSIFTComputer: public LcFeatureComputer
{
public:
LcSIFTComputer();
void compute( Mat & img, vector<KeyPoint> & keypts, Mat & desc);
};
//===================
class LcSURFComputer: public LcFeatureComputer
{
public:
LcSURFComputer();
void compute( Mat & img, vector<KeyPoint> & keypts, Mat & desc);
};
//====================
class LcOrbComputer: public LcFeatureComputer
{
public:
LcOrbComputer();
void compute( Mat & img, vector<KeyPoint> & keypts, Mat & desc);
};
#endif