-
Notifications
You must be signed in to change notification settings - Fork 3
/
abstractdescriptor.h
115 lines (90 loc) · 2.99 KB
/
abstractdescriptor.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
109
110
111
112
113
114
115
#ifndef ABSTRACTDESCRIPTOR_H
#define ABSTRACTDESCRIPTOR_H
#include "idetector.h"
#include "keypoint.h"
#include "image.h"
#include "cimage.h"
#include <cassert>
#include <vector>
using namespace std;
/*****************************
Interface to descriptors
@author: Wanlei Zhao
@date: Dec-2011
******************************/
class AbstractDescriptor
{
protected:
float *descWin;
float *featsBin;
float *pcaFeat;
AbstractImage *crntImg;
vector<vector<Image*> > ImageOctaves;
bool properties[IDetector::Numb_PROP];
int KP_PROP_SZ[IDetector::Numb_PROP];
bool AFF_OUT;
DESC_FMT _out_format;
protected:
DESC descoption;
int featLen, gDim;
Detector DETECTOR;
static const float SIGMA;
static const int SCALESPEROCTAVE;
static const float SmthRatio;
public:
AbstractDescriptor()
{
this->descWin = NULL;
this->featsBin = NULL;
this->pcaFeat = NULL;
this->crntImg = NULL;
this->AFF_OUT = false;
this->_out_format = _vireo_fmrt;
this->DETECTOR = corner;
KP_PROP_SZ[0] = 1;
KP_PROP_SZ[1] = 1;
KP_PROP_SZ[2] = 1;
KP_PROP_SZ[3] = 2;
KP_PROP_SZ[4] = 32;
}
public:
bool setupImage(AbstractImage *srcImg);
bool setupImage(CImage *srcImg);
bool setOutFormat(bool kp_properties[], bool aff_out, DESC_FMT _out_fmt)
{
for(int i = 0; i < IDetector::Numb_PROP; i++)
{
properties[i] = kp_properties[i];
}
this->AFF_OUT = aff_out;
this->_out_format = _out_fmt;
return true;
}
bool setupOctaves(vector<vector<Image*> > &GOctaves);
int getDescPatch1(KeyPoint *keyp, float *myWin, const int Size);
int getDescPatch(KeyPoint *keyp, float *myWin, const int Size);
int getDescAffPatch(KeyPoint *keyp, float *myWin, const int Size);
int getDescPatch3C(KeyPoint *keyp, float *myWin, const int Size);
void saveDescVGG(const KeyPoint* crnt_kpt, const float *feature,
const int dim, const float resize, ofstream &outStrm);
void saveDescVireo(const KeyPoint* crnt_kpt, const float *feature, const int dim,
const int idx0, const float resize, ofstream &outStrm);
void saveDescTrain(const KeyPoint* crnt_kpt, const float *feature, const int dim,
const float resize, ofstream &outStrm);
DESC getDescOption()
{
return descoption;
}
virtual int buildDescriptor(const int kpnum, vector<KeyPoint*> &kps, const char *descfn, const float resize_rate) = 0;
virtual int buildPatchView(const int kpnum, vector<KeyPoint*> &kps, const char *descfn, const float resize_rate) = 0;
static int findFlip(const float thetas[], const int dbin, const int nbin, float &ratio);
int getCurl(KeyPoint *keyp,float *myWin,const int Size);
virtual ~AbstractDescriptor()
{
if(descWin != NULL)
{
delete [] descWin;
}
}
};
#endif