-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipoint.h
More file actions
78 lines (55 loc) · 2.41 KB
/
ipoint.h
File metadata and controls
78 lines (55 loc) · 2.41 KB
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
/***********************************************************
* --- OpenSURF --- *
* This library is distributed under the GNU GPL. Please *
* contact chris.evans@irisys.co.uk for more information. *
* *
* C. Evans, Research Into Robust Visual Features, *
* MSc University of Bristol, 2008. *
* *
************************************************************/
#ifndef _OPENSURF_IPOINTH
#define _OPENSURF_IPOINTH
#include "opencv/cv.h"
#include <vector>
using namespace std;
#define OPENSURF_FEATURECOUNT 64
//-------------------------------------------------------
class OpenSurfInterestPoint; // Pre-declaration
typedef std::vector<OpenSurfInterestPoint> IpVec;
typedef std::vector<std::pair<OpenSurfInterestPoint, OpenSurfInterestPoint> > IpPairVec;
typedef std::vector<std::pair<const OpenSurfInterestPoint *, const OpenSurfInterestPoint *> > IpPairVecConst;
//-------------------------------------------------------
//! OpenSurfInterestPoint operations
void getMatches(IpVec &ipts1, IpVec &ipts2, IpPairVec &matches);
void getMatches(IpVec &ipts1, IpVec &ipts2, IpPairVecConst &matches);
int translateCorners(IpPairVec &matches, const CvPoint src_corners[4], CvPoint dst_corners[4]);
//-------------------------------------------------------
class OpenSurfInterestPoint {
public:
//! Destructor
~OpenSurfInterestPoint() {};
//! Constructor
OpenSurfInterestPoint() : orientation(0) {};
//! Gets the distance in descriptor space between Ipoints
float operator-(const OpenSurfInterestPoint &rhs)
{
float sum=0.f;
for(int i=0; i < OPENSURF_FEATURECOUNT; ++i)
sum += (this->descriptor[i] - rhs.descriptor[i])*(this->descriptor[i] - rhs.descriptor[i]);
return sqrt(sum);
};
//! Coordinates of the detected interest point
float x, y;
//! Detected scale
float scale;
//! Orientation measured anti-clockwise from +ve x-axis
float orientation;
//! Sign of laplacian for fast matching purposes
int laplacian;
//! Vector of descriptor components
float descriptor[OPENSURF_FEATURECOUNT];
//! Placeholds for point motion (can be used for frame to frame motion analysis)
float dx, dy;
};
//-------------------------------------------------------
#endif