31 #ifndef OPENCV_FLANN_COMPOSITE_INDEX_H_
32 #define OPENCV_FLANN_COMPOSITE_INDEX_H_
52 (*this)[
"trees"] = trees;
54 (*this)[
"branching"] = branching;
58 (*this)[
"centers_init"] = centers_init;
60 (*this)[
"cb_index"] = cb_index;
70 template <
typename Distance>
85 Distance
d = Distance()) : index_params_(
params)
114 return kdtree_index_->size();
122 return kdtree_index_->veclen();
130 return kmeans_index_->usedMemory() + kdtree_index_->usedMemory();
138 Logger::info(
"Building kmeans tree...\n");
139 kmeans_index_->buildIndex();
140 Logger::info(
"Building kdtree tree...\n");
141 kdtree_index_->buildIndex();
150 kmeans_index_->saveIndex(stream);
151 kdtree_index_->saveIndex(stream);
160 kmeans_index_->loadIndex(stream);
161 kdtree_index_->loadIndex(stream);
169 return index_params_;
177 kmeans_index_->findNeighbors(result, vec, searchParams);
178 kdtree_index_->findNeighbors(result, vec, searchParams);
194 #endif //OPENCV_FLANN_COMPOSITE_INDEX_H_
const CvArr CvSeq CvSeq CvMemStorage CvSURFParams params
Definition: compat.hpp:647
flann_algorithm_t
Definition: defines.h:81
Definition: kmeans_index.h:81
Definition: composite_index.h:45
flann_algorithm_t getType() const
Definition: composite_index.h:104
int d
Definition: legacy.hpp:3064
CompositeIndex(const Matrix< ElementType > &inputData, const IndexParams ¶ms=CompositeIndexParams(), Distance d=Distance())
Definition: composite_index.h:84
const CvArr const CvArr CvArr * result
Definition: core_c.h:805
Distance::ElementType ElementType
Definition: composite_index.h:74
CompositeIndexParams(int trees=4, int branching=32, int iterations=11, flann_centers_init_t centers_init=FLANN_CENTERS_RANDOM, float cb_index=0.2)
Definition: composite_index.h:47
int usedMemory() const
Definition: composite_index.h:128
Definition: composite_index.h:71
size_t veclen() const
Definition: composite_index.h:120
const CvArr CvArr double int int int iterations
Definition: tracking.hpp:102
Distance::ResultType DistanceType
Definition: composite_index.h:75
flann_centers_init_t
Definition: defines.h:105
void buildIndex()
Builds the index.
Definition: composite_index.h:136
Definition: result_set.h:66
std::map< std::string, any > IndexParams
Definition: params.h:42
virtual ~CompositeIndex()
Definition: composite_index.h:95
GLenum const GLfloat * params
Definition: compat.hpp:688
Definition: kdtree_index.h:70
IndexParams getParameters() const
Definition: composite_index.h:167
Definition: nn_index.h:48
void loadIndex(FILE *stream)
Loads the index from a stream.
Definition: composite_index.h:158
CompositeIndex & operator=(const CompositeIndex &)
Definition: defines.h:107
void findNeighbors(ResultSet< DistanceType > &result, const ElementType *vec, const SearchParams &searchParams)
Method that searches for nearest-neighbours.
Definition: composite_index.h:175
size_t size() const
Definition: composite_index.h:112
void saveIndex(FILE *stream)
Saves the index to a stream.
Definition: composite_index.h:148