-
Notifications
You must be signed in to change notification settings - Fork 5
/
Features.h
65 lines (52 loc) · 1.37 KB
/
Features.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
#pragma once
#include <opencv2/opencv.hpp>
#include <opencv2/highgui.hpp>
#include <vector>
#include <utility>
// Parameters to tune
#define FAST_THRESHOLD 30
#define ST_THRESH 30000.f
#define NMS_WINDOW 2
#define MAX_NUM_FEATURES 100
#define MATCH_THRESHOLD 0.1f
// Other parameters
#define ST_WINDOW 3
#define FAST_SPACING 3
#define ANGLE_WINDOW 9
#define ORIENTATION_HIST_BINS 36
#define DESC_BINS 8
#define DESC_BIN_SIZE 45
#define DESC_WINDOW 16
#define DESC_SUB_WINDOW 4
#define ILLUMINANCE_BOUND 0.2f
#define NN_RATIO 0.8
#define PI 3.14159f
#define RAD2DEG(A) (A*180.f/PI)
#define DEG2RAD(A) (A*PI/180.f)
#define DESC_LENGTH 128
struct FeatureDescriptor
{
float vec[DESC_LENGTH];
};
struct Feature
{
int scale;
cv::Point2f p;
float score;
float angle;
FeatureDescriptor desc;
float distFromBestMatch;
};
// Feature comparator
bool FeatureCompare(Feature a, Feature b);
/*
Feature Detection functions
*/
bool FindFASTFeatures(cv::Mat img, std::vector<Feature>& features);
std::vector<Feature> ScoreAndClusterFeatures(cv::Mat img, std::vector<Feature>& features);
bool CreateSIFTDescriptors(cv::Mat img, std::vector<Feature>& features, std::vector<FeatureDescriptor>& descriptors);
std::vector<std::pair<Feature, Feature> > MatchDescriptors(std::vector<Feature> list1, std::vector<Feature> list2);
/*
Feature Detection Unit Test functions
*/
void TestSequential12(void);