Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
924e0624
Commit
924e0624
authored
Jul 30, 2014
by
edgarriba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code tutorial
parent
3b24aa24
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
0 deletions
+83
-0
RobustMatcher.h
...calib3d/real_time_pose_estimation/include/RobustMatcher.h
+83
-0
No files found.
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/include/RobustMatcher.h
0 → 100644
View file @
924e0624
/*
* RobustMatcher.h
*
* Created on: Jun 4, 2014
* Author: eriba
*/
#ifndef ROBUSTMATCHER_H_
#define ROBUSTMATCHER_H_
#include <iostream>
#include <boost/shared_ptr.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/nonfree/nonfree.hpp>
class
RobustMatcher
{
public
:
RobustMatcher
()
:
ratio_
(
0
.
8
f
)
{
// ORB is the default feature
detector_
=
new
cv
::
OrbFeatureDetector
();
extractor_
=
new
cv
::
OrbDescriptorExtractor
();
// BruteFroce matcher with Norm Hamming is the default matcher
matcher_
=
new
cv
::
BFMatcher
(
cv
::
NORM_HAMMING
,
false
);
}
virtual
~
RobustMatcher
();
// Set the feature detector
void
setFeatureDetector
(
cv
::
FeatureDetector
*
detect
)
{
detector_
=
detect
;
}
// Set the descriptor extractor
void
setDescriptorExtractor
(
cv
::
DescriptorExtractor
*
desc
)
{
extractor_
=
desc
;
}
// Set the matcher
void
setDescriptorMatcher
(
cv
::
DescriptorMatcher
*
match
)
{
matcher_
=
match
;
}
// Compute the keypoints of an image
void
computeKeyPoints
(
const
cv
::
Mat
&
image
,
std
::
vector
<
cv
::
KeyPoint
>&
keypoints
);
// Compute the descriptors of an image given its keypoints
void
computeDescriptors
(
const
cv
::
Mat
&
image
,
std
::
vector
<
cv
::
KeyPoint
>&
keypoints
,
cv
::
Mat
&
descriptors
);
// Set ratio parameter for the ratio test
void
setRatio
(
float
rat
)
{
ratio_
=
rat
;
}
// Clear matches for which NN ratio is > than threshold
// return the number of removed points
// (corresponding entries being cleared,
// i.e. size will be 0)
int
ratioTest
(
std
::
vector
<
std
::
vector
<
cv
::
DMatch
>
>
&
matches
);
// Insert symmetrical matches in symMatches vector
void
symmetryTest
(
const
std
::
vector
<
std
::
vector
<
cv
::
DMatch
>
>&
matches1
,
const
std
::
vector
<
std
::
vector
<
cv
::
DMatch
>
>&
matches2
,
std
::
vector
<
cv
::
DMatch
>&
symMatches
);
// Match feature points using ratio and symmetry test
void
robustMatch
(
const
cv
::
Mat
&
frame
,
std
::
vector
<
cv
::
DMatch
>&
good_matches
,
std
::
vector
<
cv
::
KeyPoint
>&
keypoints_frame
,
const
cv
::
Mat
&
descriptors_model
);
// Match feature points using ratio test
void
fastRobustMatch
(
const
cv
::
Mat
&
frame
,
std
::
vector
<
cv
::
DMatch
>&
good_matches
,
std
::
vector
<
cv
::
KeyPoint
>&
keypoints_frame
,
const
cv
::
Mat
&
descriptors_model
);
private
:
// pointer to the feature point detector object
cv
::
FeatureDetector
*
detector_
;
// pointer to the feature descriptor extractor object
cv
::
DescriptorExtractor
*
extractor_
;
// pointer to the matcher object
cv
::
DescriptorMatcher
*
matcher_
;
// max ratio between 1st and 2nd NN
float
ratio_
;
};
#endif
/* ROBUSTMATCHER_H_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment