mirror of
https://github.com/opencv/opencv.git
synced 2025-07-26 07:07:37 +08:00
Merge pull request #10549 from Sahloul:bug_fix/FLANN
This commit is contained in:
commit
b6075e11b8
@ -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,
|
|||||||
::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>
|
||||||
|
Loading…
Reference in New Issue
Block a user