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
NNIndex< Distance > Class Template Reference
Nearest-neighbour index base class. More...
#include <nn_index.h>
Inherited by AutotunedIndex< Distance >, CompositeIndex< Distance >, HierarchicalClusteringIndex< Distance >, Index< Distance >, KDTreeIndex< Distance >, KDTreeSingleIndex< Distance >, KMeansIndex< Distance >, LinearIndex< Distance >, and LshIndex< Distance >.
Public Member Functions | |
| virtual void | buildIndex ()=0 |
| Builds the index. | |
| virtual void | knnSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, int knn, const SearchParams ¶ms) |
| Perform k-nearest neighbor search. | |
| virtual int | radiusSearch (const Matrix< ElementType > &query, Matrix< int > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams ¶ms) |
| Perform radius search. | |
| virtual void | saveIndex (FILE *stream)=0 |
| Saves the index to a stream. | |
| virtual void | loadIndex (FILE *stream)=0 |
| Loads the index from a stream. | |
| virtual size_t | size () const =0 |
| virtual size_t | veclen () const =0 |
| virtual int | usedMemory () const =0 |
| virtual flann_algorithm_t | getType () const =0 |
| virtual IndexParams | getParameters () const =0 |
| virtual void | findNeighbors (ResultSet< DistanceType > &result, const ElementType *vec, const SearchParams &searchParams)=0 |
| Method that searches for nearest-neighbours. | |
Detailed Description
template<typename Distance>
class cvflann::NNIndex< Distance >
Nearest-neighbour index base class.
Definition at line 46 of file nn_index.h.
Member Function Documentation
| virtual void buildIndex | ( | ) | [pure virtual] |
Builds the index.
Implemented in CompositeIndex< Distance >, HierarchicalClusteringIndex< Distance >, KDTreeIndex< Distance >, KDTreeSingleIndex< Distance >, KMeansIndex< Distance >, and LshIndex< Distance >.
| virtual void findNeighbors | ( | ResultSet< DistanceType > & | result, |
| const ElementType * | vec, | ||
| const SearchParams & | searchParams | ||
| ) | [pure virtual] |
Method that searches for nearest-neighbours.
| virtual IndexParams getParameters | ( | ) | const [pure virtual] |
- Returns:
- The index parameters
Implemented in CompositeIndex< Distance >, HierarchicalClusteringIndex< Distance >, KDTreeIndex< Distance >, KDTreeSingleIndex< Distance >, KMeansIndex< Distance >, and LshIndex< Distance >.
| virtual flann_algorithm_t getType | ( | ) | const [pure virtual] |
- Returns:
- The index type (kdtree, kmeans,...)
Implemented in CompositeIndex< Distance >, HierarchicalClusteringIndex< Distance >, KDTreeIndex< Distance >, KDTreeSingleIndex< Distance >, KMeansIndex< Distance >, and LshIndex< Distance >.
| virtual void knnSearch | ( | const Matrix< ElementType > & | queries, |
| Matrix< int > & | indices, | ||
| Matrix< DistanceType > & | dists, | ||
| int | knn, | ||
| const SearchParams & | params | ||
| ) | [virtual] |
Perform k-nearest neighbor search.
- Parameters:
-
[in] queries The query points for which to find the nearest neighbors [out] indices The indices of the nearest neighbors found [out] dists Distances to the nearest neighbors found [in] knn Number of nearest neighbors to return [in] params Search parameters
Definition at line 68 of file nn_index.h.
| virtual void loadIndex | ( | FILE * | stream ) | [pure virtual] |
Loads the index from a stream.
- Parameters:
-
stream The stream from which the index is loaded
Implemented in CompositeIndex< Distance >, HierarchicalClusteringIndex< Distance >, KDTreeIndex< Distance >, KDTreeSingleIndex< Distance >, KMeansIndex< Distance >, and LshIndex< Distance >.
| virtual int radiusSearch | ( | const Matrix< ElementType > & | query, |
| Matrix< int > & | indices, | ||
| Matrix< DistanceType > & | dists, | ||
| float | radius, | ||
| const SearchParams & | params | ||
| ) | [virtual] |
Perform radius search.
- Parameters:
-
[in] query The query point [out] indices The indinces of the neighbors found within the given radius [out] dists The distances to the nearest neighbors found [in] radius The radius used for search [in] params Search parameters
- Returns:
- Number of neighbors found
Definition at line 102 of file nn_index.h.
| virtual void saveIndex | ( | FILE * | stream ) | [pure virtual] |
Saves the index to a stream.
- Parameters:
-
stream The stream to save the index to
Implemented in CompositeIndex< Distance >, HierarchicalClusteringIndex< Distance >, KDTreeIndex< Distance >, KDTreeSingleIndex< Distance >, KMeansIndex< Distance >, and LshIndex< Distance >.
| virtual size_t size | ( | ) | const [pure virtual] |
- Returns:
- number of features in this index.
Implemented in CompositeIndex< Distance >, HierarchicalClusteringIndex< Distance >, KDTreeIndex< Distance >, KDTreeSingleIndex< Distance >, KMeansIndex< Distance >, and LshIndex< Distance >.
| virtual int usedMemory | ( | ) | const [pure virtual] |
- Returns:
- The amount of memory (in bytes) used by the index.
Implemented in CompositeIndex< Distance >, HierarchicalClusteringIndex< Distance >, KDTreeIndex< Distance >, KDTreeSingleIndex< Distance >, KMeansIndex< Distance >, and LshIndex< Distance >.
| virtual size_t veclen | ( | ) | const [pure virtual] |
- Returns:
- The dimensionality of the features in this index.
Implemented in CompositeIndex< Distance >, HierarchicalClusteringIndex< Distance >, KDTreeIndex< Distance >, KDTreeSingleIndex< Distance >, KMeansIndex< Distance >, and LshIndex< Distance >.
Generated on Tue Jul 12 2022 18:20:25 by
1.7.2