forked from delmottea/libCMT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMT.h
78 lines (58 loc) · 2.2 KB
/
CMT.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
#ifndef CMT_H
#define CMT_H
#include <opencv2/opencv.hpp>
#include <opencv2/features2d/features2d.hpp>
class CMT
{
public:
std::string detectorType;
std::string descriptorType;
std::string matcherType;
int descriptorLength;
int thrOutlier;
float thrConf;
float thrRatio;
bool estimateScale;
bool estimateRotation;
cv::Ptr<cv::FeatureDetector> detector;
cv::Ptr<cv::DescriptorExtractor> descriptorExtractor;
cv::Ptr<cv::DescriptorMatcher> descriptorMatcher;
cv::Mat selectedFeatures;
std::vector<int> selectedClasses;
cv::Mat featuresDatabase;
std::vector<int> classesDatabase;
std::vector<std::vector<float> > squareForm;
std::vector<std::vector<float> > angles;
cv::Point2f topLeft;
cv::Point2f topRight;
cv::Point2f bottomRight;
cv::Point2f bottomLeft;
cv::Rect_<float> boundingbox;
bool hasResult;
cv::Point2f centerToTopLeft;
cv::Point2f centerToTopRight;
cv::Point2f centerToBottomRight;
cv::Point2f centerToBottomLeft;
std::vector<cv::Point2f> springs;
cv::Mat im_prev;
std::vector<std::pair<cv::KeyPoint,int> > activeKeypoints;
std::vector<std::pair<cv::KeyPoint,int> > trackedKeypoints;
unsigned int nbInitialKeypoints;
std::vector<cv::Point2f> votes;
std::vector<std::pair<cv::KeyPoint, int> > outliers;
CMT();
void initialise(cv::Mat im_gray0, cv::Point2f topleft, cv::Point2f bottomright);
void estimate(const std::vector<std::pair<cv::KeyPoint, int> >& keypointsIN, cv::Point2f& center, float& scaleEstimate, float& medRot, std::vector<std::pair<cv::KeyPoint, int> >& keypoints);
void processFrame(cv::Mat im_gray);
};
class Cluster
{
public:
int first, second;//cluster id
float dist;
int num;
};
void inout_rect(const std::vector<cv::KeyPoint>& keypoints, cv::Point2f topleft, cv::Point2f bottomright, std::vector<cv::KeyPoint>& in, std::vector<cv::KeyPoint>& out);
void track(cv::Mat im_prev, cv::Mat im_gray, const std::vector<std::pair<cv::KeyPoint, int> >& keypointsIN, std::vector<std::pair<cv::KeyPoint, int> >& keypointsTracked, std::vector<unsigned char>& status, int THR_FB = 20);
cv::Point2f rotate(cv::Point2f p, float rad);
#endif // CMT_H