#include <kmeans_index.h>
Inherits cvflann::NNIndex< ELEM_TYPE >.
Classes | |
struct | KMeansNodeSt |
Public Member Functions | |
flann_algorithm_t | getType () const |
KMeansIndex (const Matrix< ELEM_TYPE > &inputData, const KMeansIndexParams ¶ms=KMeansIndexParams()) | |
virtual | ~KMeansIndex () |
size_t | size () const |
size_t | veclen () const |
void | set_cb_index (float index) |
int | usedMemory () const |
void | buildIndex () |
void | saveIndex (FILE *stream) |
void | loadIndex (FILE *stream) |
void | findNeighbors (ResultSet< ELEM_TYPE > &result, const ELEM_TYPE *vec, const SearchParams &searchParams) |
int | getClusterCenters (Matrix< DIST_TYPE > ¢ers) |
const IndexParams * | getParameters () const |
Hierarchical kmeans index
Contains a tree constructed through a hierarchical kmeans clustering and other information for indexing a set of points for nearest-neighbour matching.
cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::KMeansIndex | ( | const Matrix< ELEM_TYPE > & | inputData, | |
const KMeansIndexParams & | params = KMeansIndexParams() | |||
) |
Index constructor
Params: inputData = dataset with the input features params = parameters passed to the hierarchical k-means algorithm
virtual cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::~KMeansIndex | ( | ) | [virtual] |
Index destructor.
Release the memory used by the index.
flann_algorithm_t cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::getType | ( | ) | const [virtual] |
Algorithm name
Implements cvflann::NNIndex< ELEM_TYPE >.
size_t cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::size | ( | ) | const [virtual] |
Returns size of index.
Implements cvflann::NNIndex< ELEM_TYPE >.
size_t cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::veclen | ( | ) | const [virtual] |
Returns the length of an index feature.
Implements cvflann::NNIndex< ELEM_TYPE >.
void cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::set_cb_index | ( | float | index | ) |
int cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::usedMemory | ( | ) | const [virtual] |
Computes the inde memory usage Returns: memory used by the index
Implements cvflann::NNIndex< ELEM_TYPE >.
void cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::buildIndex | ( | ) | [virtual] |
Builds the index
Implements cvflann::NNIndex< ELEM_TYPE >.
void cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::saveIndex | ( | FILE * | stream | ) | [virtual] |
Saves the index to a stream
Implements cvflann::NNIndex< ELEM_TYPE >.
void cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::loadIndex | ( | FILE * | stream | ) | [virtual] |
Loads the index from a stream
Implements cvflann::NNIndex< ELEM_TYPE >.
void cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::findNeighbors | ( | ResultSet< ELEM_TYPE > & | result, | |
const ELEM_TYPE * | vec, | |||
const SearchParams & | searchParams | |||
) | [virtual] |
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 searchParams = parameters that influence the search algorithm (checks, cb_index)
Implements cvflann::NNIndex< ELEM_TYPE >.
int cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::getClusterCenters | ( | Matrix< DIST_TYPE > & | centers | ) |
Clustering function that takes a cut in the hierarchical k-means tree and return the clusters centers of that clustering. Params: numClusters = number of clusters to have in the clustering computed Returns: number of cluster centers
const IndexParams* cvflann::KMeansIndex< ELEM_TYPE, DIST_TYPE >::getParameters | ( | ) | const [virtual] |
Returns the parameters used for the index
Implements cvflann::NNIndex< ELEM_TYPE >.