opencv on mbed
KDTreeIndex< Distance > Class Template Reference
Randomized kd-tree index. More...
#include <kdtree_index.h>
Inherits cvflann::NNIndex< Distance >.
Public Member Functions | |
KDTreeIndex (const Matrix< ElementType > &inputData, const IndexParams ¶ms=KDTreeIndexParams(), Distance d=Distance()) | |
KDTree constructor. | |
~KDTreeIndex () | |
Standard destructor. | |
void | buildIndex () |
Builds the index. | |
flann_algorithm_t | getType () const |
void | saveIndex (FILE *stream) |
Saves the index to a stream. | |
void | loadIndex (FILE *stream) |
Loads the index from a stream. | |
size_t | size () const |
Returns size of index. | |
size_t | veclen () const |
Returns the length of an index feature. | |
int | usedMemory () const |
Computes the inde memory usage Returns: memory used by the index. | |
void | findNeighbors (ResultSet< DistanceType > &result, const ElementType *vec, const SearchParams &searchParams) |
Find set of nearest neighbors to vec. | |
IndexParams | getParameters () const |
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 | findNeighbors (ResultSet< DistanceType > &result, const ElementType *vec, const SearchParams &searchParams)=0 |
Method that searches for nearest-neighbours. |
Detailed Description
template<typename Distance>
class cvflann::KDTreeIndex< Distance >
Randomized kd-tree index.
Contains the k-d trees and other information for indexing a set of points for nearest-neighbor matching.
Definition at line 70 of file kdtree_index.h.
Constructor & Destructor Documentation
KDTreeIndex | ( | const Matrix< ElementType > & | inputData, |
const IndexParams & | params = KDTreeIndexParams() , |
||
Distance | d = Distance() |
||
) |
KDTree constructor.
Params: inputData = dataset with the input features params = parameters passed to the kdtree algorithm
Definition at line 84 of file kdtree_index.h.
~KDTreeIndex | ( | ) |
Standard destructor.
Definition at line 111 of file kdtree_index.h.
Member Function Documentation
void buildIndex | ( | ) | [virtual] |
void findNeighbors | ( | ResultSet< DistanceType > & | result, |
const ElementType * | vec, | ||
const SearchParams & | searchParams | ||
) |
Find set of nearest neighbors to vec.
Their indices are stored inside the result object.
Params: result = the result object in which the indices of the nearest-neighbors are stored vec = the vector for which to search the nearest neighbors maxCheck = the maximum number of restarts (in a best-bin-first manner)
Definition at line 199 of file kdtree_index.h.
virtual void findNeighbors | ( | ResultSet< DistanceType > & | result, |
const ElementType * | vec, | ||
const SearchParams & | searchParams | ||
) | [pure virtual, inherited] |
Method that searches for nearest-neighbours.
IndexParams getParameters | ( | ) | const [virtual] |
- Returns:
- The index parameters
Implements NNIndex< Distance >.
Definition at line 212 of file kdtree_index.h.
flann_algorithm_t getType | ( | ) | const [virtual] |
- Returns:
- The index type (kdtree, kmeans,...)
Implements NNIndex< Distance >.
Definition at line 134 of file kdtree_index.h.
virtual void knnSearch | ( | const Matrix< ElementType > & | queries, |
Matrix< int > & | indices, | ||
Matrix< DistanceType > & | dists, | ||
int | knn, | ||
const SearchParams & | params | ||
) | [virtual, inherited] |
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.
void loadIndex | ( | FILE * | stream ) | [virtual] |
Loads the index from a stream.
- Parameters:
-
stream The stream from which the index is loaded
Implements NNIndex< Distance >.
Definition at line 150 of file kdtree_index.h.
virtual int radiusSearch | ( | const Matrix< ElementType > & | query, |
Matrix< int > & | indices, | ||
Matrix< DistanceType > & | dists, | ||
float | radius, | ||
const SearchParams & | params | ||
) | [virtual, inherited] |
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.
void saveIndex | ( | FILE * | stream ) | [virtual] |
Saves the index to a stream.
- Parameters:
-
stream The stream to save the index to
Implements NNIndex< Distance >.
Definition at line 140 of file kdtree_index.h.
size_t size | ( | ) | const [virtual] |
Returns size of index.
Implements NNIndex< Distance >.
Definition at line 168 of file kdtree_index.h.
int usedMemory | ( | ) | const [virtual] |
Computes the inde memory usage Returns: memory used by the index.
Implements NNIndex< Distance >.
Definition at line 185 of file kdtree_index.h.
size_t veclen | ( | ) | const [virtual] |
Returns the length of an index feature.
Implements NNIndex< Distance >.
Definition at line 176 of file kdtree_index.h.
Generated on Tue Jul 12 2022 16:42:45 by 1.7.2