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
f2626514
Commit
f2626514
authored
Mar 27, 2012
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test case of matching the same descriptors
parent
168d1936
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
6 deletions
+33
-6
test_features2d.cpp
modules/features2d/test/test_features2d.cpp
+33
-6
No files found.
modules/features2d/test/test_features2d.cpp
View file @
f2626514
...
@@ -669,7 +669,7 @@ void CV_DescriptorMatcherTest::matchTest( const Mat& query, const Mat& train )
...
@@ -669,7 +669,7 @@ void CV_DescriptorMatcherTest::matchTest( const Mat& query, const Mat& train )
int
badCount
=
0
;
int
badCount
=
0
;
for
(
size_t
i
=
0
;
i
<
matches
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
matches
.
size
();
i
++
)
{
{
DMatch
match
=
matches
[
i
];
DMatch
&
match
=
matches
[
i
];
if
(
(
match
.
queryIdx
!=
(
int
)
i
)
||
(
match
.
trainIdx
!=
(
int
)
i
*
countFactor
)
||
(
match
.
imgIdx
!=
0
)
)
if
(
(
match
.
queryIdx
!=
(
int
)
i
)
||
(
match
.
trainIdx
!=
(
int
)
i
*
countFactor
)
||
(
match
.
imgIdx
!=
0
)
)
badCount
++
;
badCount
++
;
}
}
...
@@ -682,6 +682,33 @@ void CV_DescriptorMatcherTest::matchTest( const Mat& query, const Mat& train )
...
@@ -682,6 +682,33 @@ void CV_DescriptorMatcherTest::matchTest( const Mat& query, const Mat& train )
}
}
}
}
// test const version of match() for the same query and test descriptors
{
vector
<
DMatch
>
matches
;
dmatcher
->
match
(
query
,
query
,
matches
);
if
(
(
int
)
matches
.
size
()
!=
query
.
rows
)
{
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Incorrect matches count while test match() function for the same query and test descriptors (1).
\n
"
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
}
else
{
for
(
size_t
i
=
0
;
i
<
matches
.
size
();
i
++
)
{
DMatch
&
match
=
matches
[
i
];
std
::
cout
<<
match
.
distance
<<
std
::
endl
;
if
(
match
.
queryIdx
!=
(
int
)
i
||
match
.
trainIdx
!=
(
int
)
i
||
std
::
abs
(
match
.
distance
)
>
FLT_EPSILON
)
{
ts
->
printf
(
cvtest
::
TS
::
LOG
,
"Bad match (i=%d, queryIdx=%d, trainIdx=%d, distance=%f) while test match() function for the same query and test descriptors (1).
\n
"
,
i
,
match
.
queryIdx
,
match
.
trainIdx
,
match
.
distance
);
ts
->
set_failed_test_info
(
cvtest
::
TS
::
FAIL_INVALID_OUTPUT
);
}
}
}
}
// test version of match() with add()
// test version of match() with add()
{
{
vector
<
DMatch
>
matches
;
vector
<
DMatch
>
matches
;
...
@@ -709,7 +736,7 @@ void CV_DescriptorMatcherTest::matchTest( const Mat& query, const Mat& train )
...
@@ -709,7 +736,7 @@ void CV_DescriptorMatcherTest::matchTest( const Mat& query, const Mat& train )
int
badCount
=
0
;
int
badCount
=
0
;
for
(
size_t
i
=
0
;
i
<
matches
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
matches
.
size
();
i
++
)
{
{
DMatch
match
=
matches
[
i
];
DMatch
&
match
=
matches
[
i
];
int
shift
=
dmatcher
->
isMaskSupported
()
?
1
:
0
;
int
shift
=
dmatcher
->
isMaskSupported
()
?
1
:
0
;
{
{
if
(
i
<
queryDescCount
/
2
)
if
(
i
<
queryDescCount
/
2
)
...
@@ -762,7 +789,7 @@ void CV_DescriptorMatcherTest::knnMatchTest( const Mat& query, const Mat& train
...
@@ -762,7 +789,7 @@ void CV_DescriptorMatcherTest::knnMatchTest( const Mat& query, const Mat& train
int
localBadCount
=
0
;
int
localBadCount
=
0
;
for
(
int
k
=
0
;
k
<
knn
;
k
++
)
for
(
int
k
=
0
;
k
<
knn
;
k
++
)
{
{
DMatch
match
=
matches
[
i
][
k
];
DMatch
&
match
=
matches
[
i
][
k
];
if
(
(
match
.
queryIdx
!=
(
int
)
i
)
||
(
match
.
trainIdx
!=
(
int
)
i
*
countFactor
+
k
)
||
(
match
.
imgIdx
!=
0
)
)
if
(
(
match
.
queryIdx
!=
(
int
)
i
)
||
(
match
.
trainIdx
!=
(
int
)
i
*
countFactor
+
k
)
||
(
match
.
imgIdx
!=
0
)
)
localBadCount
++
;
localBadCount
++
;
}
}
...
@@ -814,7 +841,7 @@ void CV_DescriptorMatcherTest::knnMatchTest( const Mat& query, const Mat& train
...
@@ -814,7 +841,7 @@ void CV_DescriptorMatcherTest::knnMatchTest( const Mat& query, const Mat& train
int
localBadCount
=
0
;
int
localBadCount
=
0
;
for
(
int
k
=
0
;
k
<
knn
;
k
++
)
for
(
int
k
=
0
;
k
<
knn
;
k
++
)
{
{
DMatch
match
=
matches
[
i
][
k
];
DMatch
&
match
=
matches
[
i
][
k
];
{
{
if
(
i
<
queryDescCount
/
2
)
if
(
i
<
queryDescCount
/
2
)
{
{
...
@@ -866,7 +893,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
...
@@ -866,7 +893,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
badCount
++
;
badCount
++
;
else
else
{
{
DMatch
match
=
matches
[
i
][
0
];
DMatch
&
match
=
matches
[
i
][
0
];
if
(
(
match
.
queryIdx
!=
(
int
)
i
)
||
(
match
.
trainIdx
!=
(
int
)
i
*
countFactor
)
||
(
match
.
imgIdx
!=
0
)
)
if
(
(
match
.
queryIdx
!=
(
int
)
i
)
||
(
match
.
trainIdx
!=
(
int
)
i
*
countFactor
)
||
(
match
.
imgIdx
!=
0
)
)
badCount
++
;
badCount
++
;
}
}
...
@@ -918,7 +945,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
...
@@ -918,7 +945,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
int
localBadCount
=
0
;
int
localBadCount
=
0
;
for
(
int
k
=
0
;
k
<
needMatchCount
;
k
++
)
for
(
int
k
=
0
;
k
<
needMatchCount
;
k
++
)
{
{
DMatch
match
=
matches
[
i
][
k
];
DMatch
&
match
=
matches
[
i
][
k
];
{
{
if
(
i
<
queryDescCount
/
2
)
if
(
i
<
queryDescCount
/
2
)
{
{
...
...
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