-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfeatures2d.h
64 lines (49 loc) · 1.8 KB
/
features2d.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
/* Copyright 2014 Matthieu Tourne */
#ifndef FEATURES2D_H
#define FEATURES2D_H
#include <memory>
#include <vector>
#include <opencv2/features2d/features2d.hpp>
#include "photogram.h"
typedef std::vector<KeyPoint> Keypoints;
typedef std::vector<DMatch> Matches;
struct ImageFeatures {
Keypoints keypoints;
#ifdef USE_SIFT_GPU
std::vector<float> descriptors;
#else
Mat descriptors;
#endif
// serialization
void write(FileStorage &fs) const;
// deserialization
void read(const FileNode &node);
};
typedef std::shared_ptr<ImageFeatures> ImageFeaturesPtr;
// serialization
inline void write(FileStorage& fs, const std::string&,
const ImageFeatures& x) {
x.write(fs);
}
// deserialization
inline void read(const FileNode& node, ImageFeatures& x,
const ImageFeatures& default_value = ImageFeatures()){
if (node.empty())
x = default_value;
else
x.read(node);
}
int get_features(const Mat img_gray, ImageFeatures& features);
int match_features(ImageFeatures &features1,
ImageFeatures &features2, Matches& match);
void matches2points(const Matches& matches,
ImageFeatures& features1, ImageFeatures& features2,
vector<Point2f>& pts1, vector<Point2f>& pts2);
bool get_putative_matches(const Matches &matches, const vector<char> &keypointsInliers,
Matches &output);
void write_matches_image(const Mat img1, const ImageFeatures &features1,
const Mat img2, const ImageFeatures &features2,
const Matches &matches,
const vector<char> &keypointMask = vector<char>(),
const string output = "matches.jpg");
#endif // !FEATURES2D_H