#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... | |
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... | |
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 |
NNIndex (Distance d) | |
NNIndex (const IndexParams ¶ms, Distance d) | |
NNIndex (const NNIndex &other) | |
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, Matrix< int > &indices, Matrix< 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... | |
int | radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams ¶ms) const |
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 73 of file nn_index.h.
typedef Distance::ResultType rtflann::NNIndex< Distance >::DistanceType |
Definition at line 77 of file nn_index.h.
typedef Distance::ElementType rtflann::NNIndex< Distance >::ElementType |
Definition at line 76 of file nn_index.h.
|
inline |
Definition at line 79 of file nn_index.h.
|
inline |
Definition at line 84 of file nn_index.h.
|
inline |
Definition at line 89 of file nn_index.h.
|
inlinevirtual |
Definition at line 112 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 152 of file nn_index.h.
|
inlinevirtual |
Builds the index
Reimplemented in rtflann::CompositeIndex< Distance >, and rtflann::AutotunedIndex< Distance >.
Definition at line 125 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 141 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 792 of file nn_index.h.
|
pure virtual |
Implemented in rtflann::KDTreeIndex< Distance >, rtflann::HierarchicalClusteringIndex< Distance >, rtflann::KMeansIndex< Distance >, rtflann::LshIndex< Distance >, rtflann::KDTreeSingleIndex< Distance >, rtflann::AutotunedIndex< Distance >, rtflann::CompositeIndex< Distance >, and rtflann::LinearIndex< Distance >.
|
inlineprotected |
Definition at line 773 of file nn_index.h.
|
pure virtual |
Implemented in rtflann::LshIndex< Distance >, rtflann::AutotunedIndex< Distance >, rtflann::KDTreeIndex< Distance >, rtflann::HierarchicalClusteringIndex< Distance >, rtflann::KMeansIndex< Distance >, rtflann::KDTreeSingleIndex< Distance >, rtflann::CompositeIndex< Distance >, and rtflann::LinearIndex< 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 229 of file nn_index.h.
|
inlinevirtual |
|
inlineprotected |
Definition at line 715 of file nn_index.h.
|
inlineprotected |
Definition at line 747 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 315 of file nn_index.h.
|
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 405 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 501 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 611 of file nn_index.h.
|
inline |
|
inline |
Definition at line 206 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 161 of file nn_index.h.
|
inline |
Definition at line 236 of file nn_index.h.
|
inlineprotected |
Definition at line 756 of file nn_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 201 of file nn_index.h.
|
inline |
Definition at line 211 of file nn_index.h.
|
inlineprotected |
Definition at line 812 of file nn_index.h.
|
inlinevirtual |
Implements rtflann::IndexBase.
Definition at line 219 of file nn_index.h.
|
protected |
Pointer to dataset memory if allocated by this index, otherwise NULL
Definition at line 891 of file nn_index.h.
|
protected |
The distance functor
Definition at line 833 of file nn_index.h.
|
protected |
Array of point IDs, returned by nearest-neighbour operations
Definition at line 881 of file nn_index.h.
|
protected |
Parameters of the index.
Definition at line 861 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 841 of file nn_index.h.
|
protected |
Point data
Definition at line 886 of file nn_index.h.
|
protected |
Flag indicating if at least a point was removed from the index
Definition at line 866 of file nn_index.h.
|
protected |
Number of points removed from the index
Definition at line 876 of file nn_index.h.
|
protected |
Array used to mark points removed from the index
Definition at line 871 of file nn_index.h.
|
protected |
Number of points in the index (and database)
Definition at line 846 of file nn_index.h.
|
protected |
Number of features in the dataset when the index was last built.
Definition at line 851 of file nn_index.h.
|
protected |
Size of one point in the index (and database)
Definition at line 856 of file nn_index.h.