-
Notifications
You must be signed in to change notification settings - Fork 0
/
RobustFeatureMatcher.h
77 lines (61 loc) · 2.9 KB
/
RobustFeatureMatcher.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
/*------------------------------------------------------------------------------------------*\
This file contains material supporting chapter 9 of the cookbook:
Computer Vision Programming using the OpenCV Library.
by Robert Laganiere, Packt Publishing, 2011.
This program is free software; permission is hereby granted to use, copy, modify,
and distribute this source code, or portions thereof, for any purpose, without fee,
subject to the restriction that the copyright notice may not be removed
or altered from any source or altered source distribution.
The software is released on an as-is basis and without any warranties of any kind.
In particular, the software is not guaranteed to be fault-tolerant or free from failure.
The author disclaims all warranties with regard to this software, any use,
and any consequent failure, is purely the responsibility of the user.
Copyright (C) 2010-2011 Robert Laganiere, www.laganiere.name
\*------------------------------------------------------------------------------------------*/
/*
* RobustFeatureMatcher.h
*
* Created on: 01.02.2013
* Author: tmd
*/
#ifndef ROBUSTFEATUREMATCHER_H_
#define ROBUSTFEATUREMATCHER_H_
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/calib3d/calib3d.hpp>
using namespace cv;
class RobustFeatureMatcher {
public:
RobustFeatureMatcher(); // Konstruktor (mit Defaultwerten)
~RobustFeatureMatcher(); // Destruktor
void setFeatureDetector(cv::Ptr<cv::FeatureDetector>& detect);
void setDescriptorExtractor(cv::Ptr<cv::DescriptorExtractor>& desc);
void setConfidenceLevel(double confidence);
void setMinDistanceToEpipolar(double mindist);
void setRatio(float ratio);
void setRefineF(bool refineF);
float getRatio();
double getMinDistanceToEpipolar();
double getConfidenceLevel();
bool getRefineF();
vector<DMatch> match(vector<KeyPoint> keypoints1, vector<KeyPoint> keypoints2, Mat descriptors0, Mat descriptors1);
vector<DMatch> symmetryTest(const vector<vector<DMatch> >& matches1,const vector<vector<DMatch> >& matches2);
Mat ransacTest(const vector<DMatch>& matches, const vector<KeyPoint>& keypoints1, const vector<KeyPoint>& keypoints2, std::vector<cv::DMatch>& outMatches);
private:
Ptr<FeatureDetector> detector;
Ptr<DescriptorExtractor> extractor;
float ratio; // maximale ratio zwischen dem ersten und zweiten NN
bool refineF; // 'true' verfeinert die Fundamental-Matrix
double distance; // kleinste Distanz zum Epipolar
double confidence; // Wahrscheinlichtkeit / Konfidenzlevel
};
#endif /* ROBUSTFEATUREMATCHER_H_ */