#include <nn_index.h>
Public Types | |
typedef Distance::ResultType | DistanceType |
typedef Distance::ElementType | ElementType |
Public Member Functions | |
virtual void | addPoints (const Matrix< ElementType > &points, float rebuild_threshold=2) |
Incrementally add points to the index. More... | |
virtual void | buildIndex () |
virtual void | buildIndex (const Matrix< ElementType > &dataset) |
virtual NNIndex * | clone () const =0 |
virtual void | findNeighbors (ResultSet< DistanceType > &result, const ElementType *vec, const SearchParams &searchParams) const =0 |
IndexParams | getParameters () const |
virtual ElementType * | getPoint (size_t id) |
virtual int | knnSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, size_t knn, const SearchParams ¶ms) const |
Perform k-nearest neighbor search. More... | |
int | knnSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, size_t knn, const SearchParams ¶ms) const |
virtual int | knnSearch (const Matrix< ElementType > &queries, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< DistanceType > > &dists, size_t knn, const SearchParams ¶ms) const |
Perform k-nearest neighbor search. More... | |
NNIndex (const IndexParams ¶ms, Distance d) | |
NNIndex (const NNIndex &other) | |
NNIndex (Distance d) | |
int | radiusSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams ¶ms) const |
virtual int | radiusSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams ¶ms) const |
Perform radius search. More... | |
int | radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams ¶ms) const |
virtual int | radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams ¶ms) const |
Perform radius search. More... | |
size_t | removedCount () const |
virtual void | removePoint (size_t id) |
template<typename Archive > | |
void | serialize (Archive &ar) |
size_t | size () const |
size_t | sizeAtBuild () const |
size_t | veclen () const |
virtual | ~NNIndex () |
Public Member Functions inherited from rtflann::IndexBase | |
virtual flann_algorithm_t | getType () const =0 |
virtual void | loadIndex (FILE *stream)=0 |
virtual void | saveIndex (FILE *stream)=0 |
virtual int | usedMemory () const =0 |
virtual | ~IndexBase () |
Protected Member Functions | |
virtual void | buildIndexImpl ()=0 |
void | cleanRemovedPoints () |
void | extendDataset (const Matrix< ElementType > &new_points) |
virtual void | freeIndex ()=0 |
size_t | id_to_index (size_t id) |
void | indices_to_ids (const size_t *in, size_t *out, size_t size) const |
void | setDataset (const Matrix< ElementType > &dataset) |
void | swap (NNIndex &other) |
Protected Attributes | |
ElementType * | data_ptr_ |
Distance | distance_ |
std::vector< size_t > | ids_ |
IndexParams | index_params_ |
size_t | last_id_ |
std::vector< ElementType * > | points_ |
bool | removed_ |
size_t | removed_count_ |
DynamicBitset | removed_points_ |
size_t | size_ |
size_t | size_at_build_ |
size_t | veclen_ |
Nearest-neighbour index base class
Definition at line 101 of file nn_index.h.
typedef Distance::ResultType rtflann::NNIndex< Distance >::DistanceType |
Definition at line 105 of file nn_index.h.
typedef Distance::ElementType rtflann::NNIndex< Distance >::ElementType |
Definition at line 104 of file nn_index.h.
|
inline |
Definition at line 107 of file nn_index.h.
|
inline |
Definition at line 112 of file nn_index.h.
|
inline |
Definition at line 117 of file nn_index.h.
|
inlinevirtual |
Definition at line 140 of file nn_index.h.
|
inlinevirtual |
Incrementally add points to the index.
points | Matrix with points to be added |
rebuild_threshold |
Reimplemented in rtflann::KMeansIndex< Distance >, rtflann::KDTreeIndex< Distance >, rtflann::HierarchicalClusteringIndex< Distance >, rtflann::CompositeIndex< Distance >, rtflann::AutotunedIndex< Distance >, rtflann::LshIndex< Distance >, rtflann::KDTreeSingleIndex< Distance >, and rtflann::LinearIndex< Distance >.
Definition at line 180 of file nn_index.h.
|
inlinevirtual |
Builds the index
Reimplemented in rtflann::CompositeIndex< Distance >, and rtflann::AutotunedIndex< Distance >.
Definition at line 153 of file nn_index.h.
|
inlinevirtual |
Builds the index using the specified dataset
dataset | the dataset to use |
Reimplemented in rtflann::AutotunedIndex< Distance >.
Definition at line 169 of file nn_index.h.
|
protectedpure virtual |
Implemented in rtflann::KDTreeIndex< Distance >, rtflann::LshIndex< Distance >, rtflann::AutotunedIndex< Distance >, rtflann::KMeansIndex< Distance >, rtflann::HierarchicalClusteringIndex< Distance >, rtflann::KDTreeSingleIndex< Distance >, rtflann::CompositeIndex< Distance >, and rtflann::LinearIndex< Distance >.
|
inlineprotected |
Definition at line 820 of file nn_index.h.
|
pure virtual |
Implemented in rtflann::KDTreeIndex< Distance >, rtflann::KMeansIndex< Distance >, rtflann::HierarchicalClusteringIndex< Distance >, rtflann::LshIndex< Distance >, rtflann::KDTreeSingleIndex< Distance >, rtflann::AutotunedIndex< Distance >, rtflann::CompositeIndex< Distance >, and rtflann::LinearIndex< Distance >.
|
inlineprotected |
Definition at line 801 of file nn_index.h.
|
pure virtual |
Implemented in rtflann::LinearIndex< Distance >, rtflann::KDTreeIndex< Distance >, rtflann::AutotunedIndex< Distance >, rtflann::KMeansIndex< Distance >, rtflann::HierarchicalClusteringIndex< Distance >, rtflann::KDTreeSingleIndex< Distance >, rtflann::CompositeIndex< Distance >, and rtflann::LshIndex< Distance >.
|
protectedpure virtual |
Implemented in rtflann::KDTreeIndex< Distance >, rtflann::KMeansIndex< Distance >, rtflann::HierarchicalClusteringIndex< Distance >, rtflann::LshIndex< Distance >, rtflann::AutotunedIndex< Distance >, rtflann::KDTreeSingleIndex< Distance >, rtflann::CompositeIndex< Distance >, and rtflann::LinearIndex< Distance >.
|
inlinevirtual |
Returns the parameters used by the index.
Implements rtflann::IndexBase.
Definition at line 257 of file nn_index.h.
|
inlinevirtual |
|
inlineprotected |
Definition at line 743 of file nn_index.h.
|
inlineprotected |
Definition at line 775 of file nn_index.h.
|
inlinevirtual |
Perform k-nearest neighbor search.
[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 |
Reimplemented in rtflann::AutotunedIndex< Distance >, and rtflann::LshIndex< Distance >.
Definition at line 343 of file nn_index.h.
|
inline |
|
inlinevirtual |
Perform k-nearest neighbor search.
queries | |
indices | |
dists | |
knn | |
params |
[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 |
Reimplemented in rtflann::LshIndex< Distance >, and rtflann::AutotunedIndex< Distance >.
Definition at line 433 of file nn_index.h.
|
inline |
|
inlinevirtual |
Perform radius search.
[in] | query | The query point |
[out] | indices | The indices 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 |
Definition at line 529 of file nn_index.h.
|
inline |
|
inlinevirtual |
Perform radius search.
[in] | query | The query point |
[out] | indices | The indices 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 |
Definition at line 639 of file nn_index.h.
|
inline |
Definition at line 234 of file nn_index.h.
|
inlinevirtual |
Remove point from the index
index | Index of point to be removed |
Reimplemented in rtflann::CompositeIndex< Distance >, and rtflann::AutotunedIndex< Distance >.
Definition at line 189 of file nn_index.h.
|
inline |
Definition at line 264 of file nn_index.h.
|
inlineprotected |
Definition at line 784 of file nn_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 229 of file nn_index.h.
|
inline |
Definition at line 239 of file nn_index.h.
|
inlineprotected |
Definition at line 840 of file nn_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 247 of file nn_index.h.
|
protected |
Pointer to dataset memory if allocated by this index, otherwise NULL
Definition at line 919 of file nn_index.h.
|
protected |
The distance functor
Definition at line 861 of file nn_index.h.
|
protected |
Array of point IDs, returned by nearest-neighbour operations
Definition at line 909 of file nn_index.h.
|
protected |
Parameters of the index.
Definition at line 889 of file nn_index.h.
|
protected |
Each index point has an associated ID. IDs are assigned sequentially in increasing order. This indicates the ID assigned to the last point added to the index.
Definition at line 869 of file nn_index.h.
|
protected |
Point data
Definition at line 914 of file nn_index.h.
|
protected |
Flag indicating if at least a point was removed from the index
Definition at line 894 of file nn_index.h.
|
protected |
Number of points removed from the index
Definition at line 904 of file nn_index.h.
|
protected |
Array used to mark points removed from the index
Definition at line 899 of file nn_index.h.
|
protected |
Number of points in the index (and database)
Definition at line 874 of file nn_index.h.
|
protected |
Number of features in the dataset when the index was last built.
Definition at line 879 of file nn_index.h.
|
protected |
Size of one point in the index (and database)
Definition at line 884 of file nn_index.h.