mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
upgraded to FLANN 1.6. Added miniflann interface, which is now used in the rest of OpenCV. Added Python bindings for FLANN.
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
#define __OPENCV_FEATURES_2D_HPP__
|
||||
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/flann/flann.hpp"
|
||||
#include "opencv2/flann/miniflann.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <limits>
|
||||
|
||||
@@ -603,7 +603,7 @@ void FlannBasedMatcher::radiusMatchImpl( const Mat& queryDescriptors, vector<vec
|
||||
Mat queryDescriptorsRow = queryDescriptors.row(qIdx);
|
||||
Mat indicesRow = indices.row(qIdx);
|
||||
Mat distsRow = dists.row(qIdx);
|
||||
flannIndex->radiusSearch( queryDescriptorsRow, indicesRow, distsRow, maxDistance*maxDistance, *searchParams );
|
||||
flannIndex->radiusSearch( queryDescriptorsRow, indicesRow, distsRow, maxDistance*maxDistance, count, *searchParams );
|
||||
}
|
||||
|
||||
convertToDMatches( mergedDescriptors, indices, dists, matches );
|
||||
|
||||
@@ -405,14 +405,14 @@ int CV_FlannTest::radiusSearch( Mat& points, Mat& neighbors )
|
||||
// 1st way
|
||||
Mat p( 1, points.cols, CV_32FC1, points.ptr<float>(i) ),
|
||||
n( 1, neighbors.cols, CV_32SC1, neighbors.ptr<int>(i) );
|
||||
index->radiusSearch( p, n, dist, radius, SearchParams() );
|
||||
index->radiusSearch( p, n, dist, radius, neighbors.cols, SearchParams() );
|
||||
|
||||
// 2nd way
|
||||
float* fltPtr = points.ptr<float>(i);
|
||||
vector<float> query( fltPtr, fltPtr + points.cols );
|
||||
vector<int> indices( neighbors1.cols, 0 );
|
||||
vector<float> dists( dist.cols, 0 );
|
||||
index->radiusSearch( query, indices, dists, radius, SearchParams() );
|
||||
index->radiusSearch( query, indices, dists, radius, neighbors.cols, SearchParams() );
|
||||
vector<int>::const_iterator it = indices.begin();
|
||||
for( j = 0; it != indices.end(); ++it, j++ )
|
||||
neighbors1.at<int>(i,j) = *it;
|
||||
|
||||
Reference in New Issue
Block a user