Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: RZ_A2M_Mbed_samples
GenericIndex< Distance > Class Template Reference
[Clustering and Search in Multi-Dimensional Spaces]
The FLANN nearest neighbor index class. More...
#include <flann.hpp>
Public Member Functions | |
GenericIndex (const Mat &features, const ::cvflann::IndexParams ¶ms, Distance distance=Distance()) | |
Constructs a nearest neighbor search index for a given dataset. | |
void | knnSearch (const std::vector< ElementType > &query, std::vector< int > &indices, std::vector< DistanceType > &dists, int knn, const ::cvflann::SearchParams ¶ms) |
Performs a K-nearest neighbor search for a given query point using the index. |
Detailed Description
template<typename Distance>
class cv::flann::GenericIndex< Distance >
The FLANN nearest neighbor index class.
This class is templated with the type of elements for which the index is built.
Definition at line 108 of file flann.hpp.
Constructor & Destructor Documentation
GenericIndex | ( | const Mat & | features, |
const ::cvflann::IndexParams & | params, | ||
Distance | distance = Distance() |
||
) |
Constructs a nearest neighbor search index for a given dataset.
- Parameters:
-
features Matrix of containing the features(points) to index. The size of the matrix is num_features x feature_dimensionality and the data type of the elements in the matrix must coincide with the type of the index. params Structure containing the index parameters. The type of index that will be constructed depends on the type of this parameter. See the description. distance The method constructs a fast search structure from a set of features using the specified algorithm with specified parameters, as defined by params. params is a reference to one of the following class IndexParams descendants:
- **LinearIndexParams** When passing an object of this type, the index will perform a linear, brute-force search. :
struct LinearIndexParams : public IndexParams { };
- **KDTreeIndexParams** When passing an object of this type the index constructed will consist of a set of randomized kd-trees which will be searched in parallel. :
struct KDTreeIndexParams : public IndexParams { KDTreeIndexParams( int trees = 4 ); };
- **KMeansIndexParams** When passing an object of this type the index constructed will be a hierarchical k-means tree. :
struct KMeansIndexParams : public IndexParams { KMeansIndexParams( int branching = 32, int iterations = 11, flann_centers_init_t centers_init = CENTERS_RANDOM, float cb_index = 0.2 ); };
- **CompositeIndexParams** When using a parameters object of this type the index created combines the randomized kd-trees and the hierarchical k-means tree. :
struct CompositeIndexParams : public IndexParams { CompositeIndexParams( int trees = 4, int branching = 32, int iterations = 11, flann_centers_init_t centers_init = CENTERS_RANDOM, float cb_index = 0.2 ); };
- **LshIndexParams** When using a parameters object of this type the index created uses multi-probe LSH (by Multi-Probe LSH: Efficient Indexing for High-Dimensional Similarity Search by Qin Lv, William Josephson, Zhe Wang, Moses Charikar, Kai Li., Proceedings of the 33rd International Conference on Very Large Data Bases (VLDB). Vienna, Austria. September 2007) :
struct LshIndexParams : public IndexParams { LshIndexParams( unsigned int table_number, unsigned int key_size, unsigned int multi_probe_level ); };
- **AutotunedIndexParams** When passing an object of this type the index created is automatically tuned to offer the best performance, by choosing the optimal index type (randomized kd-trees, hierarchical kmeans, linear) and parameters for the dataset provided. :
struct AutotunedIndexParams : public IndexParams { AutotunedIndexParams( float target_precision = 0.9, float build_weight = 0.01, float memory_weight = 0, float sample_fraction = 0.1 ); };
- **SavedIndexParams** This object type is used for loading a previously saved index from the disk. :
struct SavedIndexParams : public IndexParams { SavedIndexParams( String filename ); };
Member Function Documentation
void knnSearch | ( | const std::vector< ElementType > & | query, |
std::vector< int > & | indices, | ||
std::vector< DistanceType > & | dists, | ||
int | knn, | ||
const ::cvflann::SearchParams & | params | ||
) |
Performs a K-nearest neighbor search for a given query point using the index.
- Parameters:
-
query The query point indices Vector that will contain the indices of the K-nearest neighbors found. It must have at least knn size. dists Vector that will contain the distances to the K-nearest neighbors found. It must have at least knn size. knn Number of nearest neighbors to search for. params SearchParams
Generated on Tue Jul 12 2022 18:20:24 by
