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
40c05d84
Commit
40c05d84
authored
Nov 01, 2010
by
Ethan Rublee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Brute force implementation had issues with the type of distances it was storing.
Rectified this, hopefully.
parent
cac2e9bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
features2d.hpp
modules/features2d/include/opencv2/features2d/features2d.hpp
+5
-3
No files found.
modules/features2d/include/opencv2/features2d/features2d.hpp
View file @
40c05d84
...
...
@@ -1808,7 +1808,7 @@ inline void bfKnnMatchImpl( BruteForceMatcher<Distance>& matcher,
size_t
imgCount
=
matcher
.
trainDescCollection
.
size
();
vector
<
Mat
>
allDists
(
imgCount
);
// distances between one query descriptor and all train descriptors
for
(
size_t
i
=
0
;
i
<
imgCount
;
i
++
)
allDists
[
i
]
=
Mat
(
1
,
matcher
.
trainDescCollection
[
i
].
rows
,
queryDescs
.
type
()
);
allDists
[
i
]
=
Mat
(
1
,
matcher
.
trainDescCollection
[
i
].
rows
,
DataType
<
DistanceType
>::
type
);
for
(
int
qIdx
=
0
;
qIdx
<
queryDescs
.
rows
;
qIdx
++
)
{
...
...
@@ -1836,7 +1836,7 @@ inline void bfKnnMatchImpl( BruteForceMatcher<Distance>& matcher,
{
const
ValueType
*
d2
=
(
const
ValueType
*
)(
matcher
.
trainDescCollection
[
iIdx
].
data
+
matcher
.
trainDescCollection
[
iIdx
].
step
*
tIdx
);
allDists
[
iIdx
].
at
<
Valu
eType
>
(
0
,
tIdx
)
=
matcher
.
distance
(
d1
,
d2
,
dimension
);
allDists
[
iIdx
].
at
<
Distanc
eType
>
(
0
,
tIdx
)
=
matcher
.
distance
(
d1
,
d2
,
dimension
);
}
}
}
...
...
@@ -1847,6 +1847,7 @@ inline void bfKnnMatchImpl( BruteForceMatcher<Distance>& matcher,
for
(
int
k
=
0
;
k
<
knn
;
k
++
)
{
DMatch
bestMatch
;
bestMatch
.
distance
=
std
::
numeric_limits
<
DistanceType
>::
max
();
for
(
size_t
iIdx
=
0
;
iIdx
<
imgCount
;
iIdx
++
)
{
double
minVal
;
...
...
@@ -1858,9 +1859,10 @@ inline void bfKnnMatchImpl( BruteForceMatcher<Distance>& matcher,
if
(
bestMatch
.
trainIdx
==
-
1
)
break
;
allDists
[
bestMatch
.
imgIdx
].
at
<
Valu
eType
>
(
0
,
bestMatch
.
trainIdx
)
=
std
::
numeric_limits
<
DistanceType
>::
max
();
allDists
[
bestMatch
.
imgIdx
].
at
<
Distanc
eType
>
(
0
,
bestMatch
.
trainIdx
)
=
std
::
numeric_limits
<
DistanceType
>::
max
();
curMatches
->
push_back
(
bestMatch
);
}
//TODO should already be sorted at this point?
std
::
sort
(
curMatches
->
begin
(),
curMatches
->
end
()
);
}
}
...
...
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