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
96d88f06
Commit
96d88f06
authored
Jan 12, 2011
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed FernDescriptorMatcher (#765)
parent
4dfbf99d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
features2d.hpp
modules/features2d/include/opencv2/features2d/features2d.hpp
+8
-8
matchers.cpp
modules/features2d/src/matchers.cpp
+7
-6
No files found.
modules/features2d/include/opencv2/features2d/features2d.hpp
View file @
96d88f06
...
...
@@ -2151,14 +2151,14 @@ inline void BruteForceMatcher<Distance>::commonKnnMatchImpl( BruteForceMatcher<D
bestMatch
.
distance
=
std
::
numeric_limits
<
float
>::
max
();
for
(
size_t
iIdx
=
0
;
iIdx
<
imgCount
;
iIdx
++
)
{
if
(
!
allDists
[
iIdx
].
empty
()
)
{
double
minVal
;
Point
minLoc
;
minMaxLoc
(
allDists
[
iIdx
],
&
minVal
,
0
,
&
minLoc
,
0
);
if
(
minVal
<
bestMatch
.
distance
)
bestMatch
=
DMatch
(
qIdx
,
minLoc
.
x
,
(
int
)
iIdx
,
(
float
)
minVal
);
}
if
(
!
allDists
[
iIdx
].
empty
()
)
{
double
minVal
;
Point
minLoc
;
minMaxLoc
(
allDists
[
iIdx
],
&
minVal
,
0
,
&
minLoc
,
0
);
if
(
minVal
<
bestMatch
.
distance
)
bestMatch
=
DMatch
(
qIdx
,
minLoc
.
x
,
(
int
)
iIdx
,
(
float
)
minVal
);
}
}
if
(
bestMatch
.
trainIdx
==
-
1
)
break
;
...
...
modules/features2d/src/matchers.cpp
View file @
96d88f06
...
...
@@ -407,7 +407,7 @@ void BruteForceMatcher<L2<float> >::knnMatchImpl( const Mat& queryDescriptors, v
for
(
int
c
=
0
;
c
<
masks
[
iIdx
].
cols
;
c
++
)
{
if
(
maskPtr
[
c
]
==
0
)
e_allDists
[
iIdx
](
c
)
=
std
::
numeric_limits
<
float
>::
min
();
e_allDists
[
iIdx
](
c
)
=
-
std
::
numeric_limits
<
float
>::
max
();
}
}
}
...
...
@@ -417,7 +417,7 @@ void BruteForceMatcher<L2<float> >::knnMatchImpl( const Mat& queryDescriptors, v
vector
<
vector
<
DMatch
>
>::
reverse_iterator
curMatches
=
matches
.
rbegin
();
for
(
int
k
=
0
;
k
<
knn
;
k
++
)
{
float
totalMaxCoeff
=
std
::
numeric_limits
<
float
>::
min
();
float
totalMaxCoeff
=
-
std
::
numeric_limits
<
float
>::
max
();
int
bestTrainIdx
=
-
1
,
bestImgIdx
=
-
1
;
for
(
size_t
iIdx
=
0
;
iIdx
<
imgCount
;
iIdx
++
)
{
...
...
@@ -433,7 +433,7 @@ void BruteForceMatcher<L2<float> >::knnMatchImpl( const Mat& queryDescriptors, v
if
(
bestTrainIdx
==
-
1
)
break
;
e_allDists
[
bestImgIdx
](
bestTrainIdx
)
=
std
::
numeric_limits
<
float
>::
min
();
e_allDists
[
bestImgIdx
](
bestTrainIdx
)
=
-
std
::
numeric_limits
<
float
>::
max
();
curMatches
->
push_back
(
DMatch
(
qIdx
,
bestTrainIdx
,
bestImgIdx
,
sqrt
((
-
2
)
*
totalMaxCoeff
+
queryNorm2
))
);
}
std
::
sort
(
curMatches
->
begin
(),
curMatches
->
end
()
);
...
...
@@ -1105,20 +1105,21 @@ void FernDescriptorMatcher::knnMatchImpl( const Mat& queryImage, vector<KeyPoint
for
(
int
k
=
0
;
k
<
knn
;
k
++
)
{
DMatch
bestMatch
;
size_t
ci
=
0
;
for
(
;
ci
<
signature
.
size
();
ci
++
)
size_t
best_ci
=
-
1
;
for
(
size_t
ci
=
0
;
ci
<
signature
.
size
();
ci
++
)
{
if
(
-
signature
[
ci
]
<
bestMatch
.
distance
)
{
int
imgIdx
=
-
1
,
trainIdx
=
-
1
;
trainPointCollection
.
getLocalIdx
(
(
int
)
ci
,
imgIdx
,
trainIdx
);
bestMatch
=
DMatch
(
(
int
)
queryIdx
,
trainIdx
,
imgIdx
,
-
signature
[
ci
]
);
best_ci
=
ci
;
}
}
if
(
bestMatch
.
trainIdx
==
-
1
)
break
;
signature
[
ci
]
=
std
::
numeric_limits
<
float
>::
min
();
signature
[
best_ci
]
=
-
std
:
numeric_limits
<
float
>::
max
();
matches
[
queryIdx
].
push_back
(
bestMatch
);
}
}
...
...
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