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
983f4f16
Commit
983f4f16
authored
May 20, 2011
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes of recall-precision output
parent
2de0e1fc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
13 deletions
+27
-13
features2d.hpp
modules/features2d/include/opencv2/features2d/features2d.hpp
+2
-0
evaluation.cpp
modules/features2d/src/evaluation.cpp
+15
-6
descriptor_extractor_matcher.cpp
samples/cpp/descriptor_extractor_matcher.cpp
+10
-7
No files found.
modules/features2d/include/opencv2/features2d/features2d.hpp
View file @
983f4f16
...
...
@@ -2720,7 +2720,9 @@ CV_EXPORTS void evaluateFeatureDetector( const Mat& img1, const Mat& img2, const
CV_EXPORTS
void
computeRecallPrecisionCurve
(
const
vector
<
vector
<
DMatch
>
>&
matches1to2
,
const
vector
<
vector
<
uchar
>
>&
correctMatches1to2Mask
,
vector
<
Point2f
>&
recallPrecisionCurve
);
CV_EXPORTS
float
getRecall
(
const
vector
<
Point2f
>&
recallPrecisionCurve
,
float
l_precision
);
CV_EXPORTS
int
getNearestPoint
(
const
vector
<
Point2f
>&
recallPrecisionCurve
,
float
l_precision
);
CV_EXPORTS
void
evaluateGenericDescriptorMatcher
(
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
H1to2
,
vector
<
KeyPoint
>&
keypoints1
,
vector
<
KeyPoint
>&
keypoints2
,
...
...
modules/features2d/src/evaluation.cpp
View file @
983f4f16
...
...
@@ -491,26 +491,35 @@ void cv::computeRecallPrecisionCurve( const vector<vector<DMatch> >& matches1to2
float
cv
::
getRecall
(
const
vector
<
Point2f
>&
recallPrecisionCurve
,
float
l_precision
)
{
float
recall
=
-
1
;
int
nearestPointIndex
=
getNearestPoint
(
recallPrecisionCurve
,
l_precision
);
float
recall
=
-
1.
f
;
if
(
nearestPointIndex
>=
0
)
recall
=
recallPrecisionCurve
[
nearestPointIndex
].
y
;
return
recall
;
}
int
cv
::
getNearestPoint
(
const
vector
<
Point2f
>&
recallPrecisionCurve
,
float
l_precision
)
{
int
nearestPointIndex
=
-
1
;
if
(
l_precision
>=
0
&&
l_precision
<=
1
)
{
int
bestIdx
=
-
1
;
float
minDiff
=
FLT_MAX
;
for
(
size_t
i
=
0
;
i
<
recallPrecisionCurve
.
size
();
i
++
)
{
float
curDiff
=
std
::
fabs
(
l_precision
-
recallPrecisionCurve
[
i
].
x
);
if
(
curDiff
<=
minDiff
)
{
bestId
x
=
(
int
)
i
;
nearestPointInde
x
=
(
int
)
i
;
minDiff
=
curDiff
;
}
}
recall
=
recallPrecisionCurve
[
bestIdx
].
y
;
}
return
recall
;
return
nearestPointIndex
;
}
void
cv
::
evaluateGenericDescriptorMatcher
(
const
Mat
&
img1
,
const
Mat
&
img2
,
const
Mat
&
H1to2
,
...
...
samples/cpp/descriptor_extractor_matcher.cpp
View file @
983f4f16
...
...
@@ -13,17 +13,16 @@ void help(char** argv)
cout
<<
"
\n
This program demonstrats keypoint finding and matching between 2 images using features2d framework.
\n
"
<<
" In one case, the 2nd image is synthesized by homography from the first, in the second case, there are 2 images
\n
"
<<
"
\n
"
<<
"
c
ase1: second image is obtained from the first (given) image using random generated homography matrix
\n
"
<<
"
C
ase1: second image is obtained from the first (given) image using random generated homography matrix
\n
"
<<
argv
[
0
]
<<
" [detectorType] [descriptorType] [matcherType] [matcherFilterType] [image] [evaluate(0 or 1)]
\n
"
<<
"Example of case1:
\n
"
<<
"./descriptor_extractor_matcher SURF SURF FlannBased NoneFilter cola.jpg 0
\n
"
<<
"
\n
"
<<
"case2: both images are given. If ransacReprojThreshold>=0 then homography matrix are calculated
\n
"
<<
"Example of case2:
\n
"
<<
"Case2: both images are given. If ransacReprojThreshold>=0 then homography matrix are calculated
\n
"
<<
argv
[
0
]
<<
" [detectorType] [descriptorType] [matcherType] [matcherFilterType] [image1] [image2] [ransacReprojThreshold]
\n
"
<<
"
\n
"
<<
"Matches are filtered using homography matrix in case1 and case2 (if ransacReprojThreshold>=0)
\n
"
<<
"Example:
\n
"
<<
"Example
of case2
:
\n
"
<<
"./descriptor_extractor_matcher SURF SURF BruteForce CrossCheckFilter cola1.jpg cola2.jpg 3
\n
"
<<
"
\n
"
<<
"Possible detectorType values: see in documentation on createFeatureDetector().
\n
"
...
...
@@ -151,12 +150,16 @@ void doIteration( const Mat& img1, Mat& img2, bool isWarpPerspective,
if
(
!
H12
.
empty
()
&&
eval
)
{
cout
<<
"< Evaluate descriptor match..."
<<
endl
;
cout
<<
"< Evaluate descriptor match
er
..."
<<
endl
;
vector
<
Point2f
>
curve
;
Ptr
<
GenericDescriptorMatcher
>
gdm
=
new
VectorDescriptorMatcher
(
descriptorExtractor
,
descriptorMatcher
);
evaluateGenericDescriptorMatcher
(
img1
,
img2
,
H12
,
keypoints1
,
keypoints2
,
0
,
0
,
curve
,
gdm
);
for
(
float
l_p
=
0
;
l_p
<
1
-
FLT_EPSILON
;
l_p
+=
0.1
f
)
cout
<<
"1-precision = "
<<
l_p
<<
"; recall = "
<<
getRecall
(
curve
,
l_p
)
<<
endl
;
for
(
float
l_p
=
0
;
l_p
<=
1
;
l_p
+=
0.05
f
)
{
int
nearest
=
getNearestPoint
(
curve
,
l_p
);
cout
<<
"1-precision = "
<<
curve
[
nearest
].
x
<<
"; recall = "
<<
curve
[
nearest
].
y
<<
endl
;
}
cout
<<
">"
<<
endl
;
}
...
...
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