-
Notifications
You must be signed in to change notification settings - Fork 3
/
harlap.h
104 lines (84 loc) · 3.58 KB
/
harlap.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
/**
*@author Wanlei Zhao
*@version 1.0
*All rights reserved by Wanlei Zhao
*
*Anyone receive this code should not redistribute it to other people
*without permission of the author
*
*This code should only be used for non-commercial purpose
**/
#ifndef HARLAP_H
#define HARLAP_H
#include "abstractdetector.h"
#include "scriptparser.h"
#include "imagesymmmat.h"
#include "keypoint.h"
#include "image.h"
#include <vector>
#include <cmath>
using namespace std;
/**
*@author Wanlei Zhao
*@version 1.0
*All rights reserved by Wanlei Zhao
*
*Anyone receive this code should not redistribute it to other people
*without permission of the author
*
*This code should only be used for non-commercial purpose
Speed-up version: Harlap+nrrSIFT VLAD* mAP=72.9
**/
class HarLap:public AbstractDetector{
private:
int numb;
float thresh;
float sigma;
/**
*factor for differetial scale comparing with integration scale,fixed to 0.7
*according to M.K.'s paper
***/
static const float dfactor;
static const int MaxOctaves;
static const int SCALES;
static const float _SIGMA;
static const bool INTERP_KEYS;
static const float INITSIGMA;
static const int maxIter;
static const int W0;
static const float err_c ;
static const float cvtRatio;
/** check Mickolajczyk Krystian's IJCV'04 paper "Scale & Affine Invariant Interest Point Detectors" **/
/**for ellipse adaption***/
private:
static const float sigma0;
static const float k0;
static const int BORDER;
static const int THRESH;
static const float mag;
static const int DEGREE;
static const int NumOrient;
static const int DEGPERBIN;
static const float NwKpThresh;
vector<Image*> BuildLoGScales(vector<Image *> & gxxScales,vector<Image *> &gyyScales);
vector<Image* > BuildHarrisScales(vector<Image *> &gxScales,vector<Image *> &gyScales);
vector<Image* > BuildHarrisScales(vector<Image *> &gxScales, vector<ImageSymmMat*> ¶Mats, vector<Image *> &gyScales);
vector<KeyPoint *> FindPeaksScales(const int octave, vector<Image*> HessImages, vector<Image *> & LoGImages);
vector<KeyPoint *> FindPeaksScales(const int octave, vector<Image*> HarImages, vector<ImageSymmMat*> ¶Mats, vector<Image *> & LoGImages);
vector<KeyPoint *> FindOrientByGrad(vector<KeyPoint *> & kps, vector<vector<Image *> > & GOctaves);
public:
bool adaptAffine(vector<vector<Image *> > &HarrisOctaves, vector<vector<ImageSymmMat *> > & pmatOctaves);
vector<vector<Image *> > BuildHarrisOctaves(vector<vector<Image *> > & GxOctaves,vector<vector<Image *> > & GyOctaves);
vector<vector<Image *> > BuildHarrisOctaves(vector<vector<Image *> > & GxOctaves, vector<vector<ImageSymmMat *> > & pmatOctaves, vector<vector<Image *> > & GyOctaves);
vector<vector<Image *> > BuildLOGOctaves(vector<vector<Image *> > & GxOctaves,vector<vector<Image *> > & GyOctaves);
bool isSpatialPeak(Image *image,const int x,const int y);
bool isScalePeak(Image * aimage, Image * bimage,Image * cimage, float &logVal,const int x, const int y);
HarLap();
int keypDetect(const float sigma,const int level,const int scale);
public:
bool paramsCheck();
bool KeypointBuild(const char *fn, const char *dstfn, const char *descfn, const char* dvfn);
void writeKeypoint(const char *fn);
static void test();
};
#endif