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
89434411
Commit
89434411
authored
Jan 08, 2018
by
Hamdi Sahloul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolves #10548 - `FLANN::knnSearch` garbage bug (when kNN is larger than the dataset size)
parent
004a1cd6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
miniflann.cpp
modules/flann/src/miniflann.cpp
+5
-2
No files found.
modules/flann/src/miniflann.cpp
View file @
89434411
...
@@ -482,6 +482,9 @@ void runKnnSearch_(void* index, const Mat& query, Mat& indices, Mat& dists,
...
@@ -482,6 +482,9 @@ void runKnnSearch_(void* index, const Mat& query, Mat& indices, Mat& dists,
typedef
typename
Distance
::
ResultType
DistanceType
;
typedef
typename
Distance
::
ResultType
DistanceType
;
int
type
=
DataType
<
ElementType
>::
type
;
int
type
=
DataType
<
ElementType
>::
type
;
int
dtype
=
DataType
<
DistanceType
>::
type
;
int
dtype
=
DataType
<
DistanceType
>::
type
;
IndexType
*
index_
=
(
IndexType
*
)
index
;
CV_Assert
((
size_t
)
knn
<=
index_
->
size
());
CV_Assert
(
query
.
type
()
==
type
&&
indices
.
type
()
==
CV_32S
&&
dists
.
type
()
==
dtype
);
CV_Assert
(
query
.
type
()
==
type
&&
indices
.
type
()
==
CV_32S
&&
dists
.
type
()
==
dtype
);
CV_Assert
(
query
.
isContinuous
()
&&
indices
.
isContinuous
()
&&
dists
.
isContinuous
());
CV_Assert
(
query
.
isContinuous
()
&&
indices
.
isContinuous
()
&&
dists
.
isContinuous
());
...
@@ -489,8 +492,8 @@ void runKnnSearch_(void* index, const Mat& query, Mat& indices, Mat& dists,
...
@@ -489,8 +492,8 @@ void runKnnSearch_(void* index, const Mat& query, Mat& indices, Mat& dists,
::
cvflann
::
Matrix
<
int
>
_indices
(
indices
.
ptr
<
int
>
(),
indices
.
rows
,
indices
.
cols
);
::
cvflann
::
Matrix
<
int
>
_indices
(
indices
.
ptr
<
int
>
(),
indices
.
rows
,
indices
.
cols
);
::
cvflann
::
Matrix
<
DistanceType
>
_dists
(
dists
.
ptr
<
DistanceType
>
(),
dists
.
rows
,
dists
.
cols
);
::
cvflann
::
Matrix
<
DistanceType
>
_dists
(
dists
.
ptr
<
DistanceType
>
(),
dists
.
rows
,
dists
.
cols
);
((
IndexType
*
)
index
)
->
knnSearch
(
_query
,
_indices
,
_dists
,
knn
,
index_
->
knnSearch
(
_query
,
_indices
,
_dists
,
knn
,
(
const
::
cvflann
::
SearchParams
&
)
get_params
(
params
));
(
const
::
cvflann
::
SearchParams
&
)
get_params
(
params
));
}
}
template
<
typename
Distance
>
template
<
typename
Distance
>
...
...
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