opencv on mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

CompositeIndex< Distance > Class Template Reference

CompositeIndex< Distance > Class Template Reference

This index builds a kd-tree index and a k-means index and performs nearest neighbour search both indexes. More...

#include <composite_index.h>

Inherits cvflann::NNIndex< Distance >.

Public Member Functions

 CompositeIndex (const Matrix< ElementType > &inputData, const IndexParams &params=CompositeIndexParams(), Distance d=Distance())
 Index constructor.
flann_algorithm_t getType () const
size_t size () const
size_t veclen () const
int usedMemory () const
void buildIndex ()
 Builds the index.
void saveIndex (FILE *stream)
 Saves the index to a stream.
void loadIndex (FILE *stream)
 Loads the index from a stream.
IndexParams getParameters () const
void findNeighbors (ResultSet< DistanceType > &result, const ElementType *vec, const SearchParams &searchParams)
 Method that searches for nearest-neighbours.
virtual void knnSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, int knn, const SearchParams &params)
 Perform k-nearest neighbor search.
virtual int radiusSearch (const Matrix< ElementType > &query, Matrix< int > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams &params)
 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::CompositeIndex< Distance >

This index builds a kd-tree index and a k-means index and performs nearest neighbour search both indexes.

This gives a slight boost in search performance as some of the neighbours that are missed by one index are found by the other.

Definition at line 71 of file composite_index.h.


Constructor & Destructor Documentation

CompositeIndex ( const Matrix< ElementType > &  inputData,
const IndexParams &  params = CompositeIndexParams(),
Distance  d = Distance() 
)

Index constructor.

Parameters:
inputDatadataset containing the points to index
paramsIndex parameters
dDistance functor
Returns:

Definition at line 84 of file composite_index.h.


Member Function Documentation

void buildIndex (  ) [virtual]

Builds the index.

Implements NNIndex< Distance >.

Definition at line 136 of file composite_index.h.

void findNeighbors ( ResultSet< DistanceType > &  result,
const ElementType *  vec,
const SearchParams &  searchParams 
)

Method that searches for nearest-neighbours.

Definition at line 175 of file composite_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 167 of file composite_index.h.

flann_algorithm_t getType (  ) const [virtual]
Returns:
The index type

Implements NNIndex< Distance >.

Definition at line 104 of file composite_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]queriesThe query points for which to find the nearest neighbors
[out]indicesThe indices of the nearest neighbors found
[out]distsDistances to the nearest neighbors found
[in]knnNumber of nearest neighbors to return
[in]paramsSearch parameters

Definition at line 68 of file nn_index.h.

void loadIndex ( FILE *  stream ) [virtual]

Loads the index from a stream.

Parameters:
streamThe stream from which the index is loaded

Implements NNIndex< Distance >.

Definition at line 158 of file composite_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]queryThe query point
[out]indicesThe indinces of the neighbors found within the given radius
[out]distsThe distances to the nearest neighbors found
[in]radiusThe radius used for search
[in]paramsSearch 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:
streamThe stream to save the index to

Implements NNIndex< Distance >.

Definition at line 148 of file composite_index.h.

size_t size (  ) const [virtual]
Returns:
Size of the index

Implements NNIndex< Distance >.

Definition at line 112 of file composite_index.h.

int usedMemory (  ) const [virtual]
Returns:
The amount of memory (in bytes) used by the index.

Implements NNIndex< Distance >.

Definition at line 128 of file composite_index.h.

size_t veclen (  ) const [virtual]
Returns:
The dimensionality of the features in this index.

Implements NNIndex< Distance >.

Definition at line 120 of file composite_index.h.