41 useDistanceL1_(
false),
42 rebalancingFactor_(2.0
f)
137 const cv::Mat & features,
139 float rebalancingFactor)
143 UASSERT(features.type() == CV_32FC1 || features.type() == CV_8UC1);
151 if(featuresType_ == CV_8UC1)
184 const cv::Mat & features,
187 float rebalancingFactor)
191 UASSERT(features.type() == CV_32FC1 || features.type() == CV_8UC1);
199 if(featuresType_ == CV_8UC1)
232 const cv::Mat & features,
236 float rebalancingFactor)
240 UASSERT(features.type() == CV_32FC1 || features.type() == CV_8UC1);
248 if(featuresType_ == CV_8UC1)
281 const cv::Mat & features,
282 unsigned int table_number,
283 unsigned int key_size,
284 unsigned int multi_probe_level,
285 float rebalancingFactor)
289 UASSERT(features.type() == CV_8UC1);
314 UERROR(
"Flann index not yet created!");
319 bool indexRebuilt =
false;
320 size_t removedPts = 0;
334 indexRebuilt = index->
removedCount() == 0 && removedPts>0;
351 indexRebuilt = index->
removedCount() == 0 && removedPts>0;
365 indexRebuilt = index->
removedCount() == 0 && removedPts>0;
379 indexRebuilt = index->
removedCount() == 0 && removedPts>0;
405 UERROR(
"Flann index not yet created!");
435 const cv::Mat & query,
445 UERROR(
"Flann index not yet created!");
448 indices.create(query.rows, knn,
sizeof(
size_t)==8?CV_64F:CV_32S);
449 dists.create(query.rows, knn,
featuresType_ == CV_8UC1?CV_32S:CV_32F);
481 const cv::Mat & query,
482 std::vector<std::vector<size_t> > & indices,
483 std::vector<std::vector<float> > & dists,
492 UERROR(
"Flann index not yet created!");
501 std::vector<std::vector<unsigned int> > distsF;
504 dists.resize(distsF.size());
505 for(
unsigned int i=0; i<dists.size(); ++i)
507 dists[i].resize(distsF[i].size());
508 for(
unsigned int j=0; j<distsF[i].size(); ++j)
510 dists[i][j] = (float)distsF[i][j];
void removePoint(unsigned int index)
void buildLSHIndex(const cv::Mat &features, unsigned int table_number=12, unsigned int key_size=20, unsigned int multi_probe_level=2, float rebalancingFactor=2.0f)
std::map< int, cv::Mat > addedDescriptors_
void knnSearch(const cv::Mat &query, cv::Mat &indices, cv::Mat &dists, int knn, int checks=32, float eps=0.0, bool sorted=true) const
void radiusSearch(const cv::Mat &query, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< float > > &dists, float radius, int maxNeighbors=0, int checks=32, float eps=0.0, bool sorted=true) const
unsigned int addPoints(const cv::Mat &features)
size_t sizeAtBuild() const
#define UASSERT(condition)
void buildLinearIndex(const cv::Mat &features, bool useDistanceL1=false, float rebalancingFactor=2.0f)
unsigned int indexedFeatures() const
void addPoints(const Matrix< ElementType > &points, float rebuild_threshold=2)
void buildKDTreeSingleIndex(const cv::Mat &features, int leafMaxSize=10, bool reorder=true, bool useDistanceL1=false, float rebalancingFactor=2.0f)
unsigned int memoryUsed() const
ULogger class and convenient macros.
size_t removedCount() const
void buildKDTreeIndex(const cv::Mat &features, int trees=4, bool useDistanceL1=false, float rebalancingFactor=2.0f)
std::list< int > removedIndexes_