mirror of
https://github.com/opencv/opencv.git
synced 2025-07-24 14:06:27 +08:00
flann: apply CV_OVERRIDE/CV_FINAL
This commit is contained in:
parent
1ca7ae9630
commit
4df4a37b11
@ -54,50 +54,50 @@ struct base_any_policy
|
||||
template<typename T>
|
||||
struct typed_base_any_policy : base_any_policy
|
||||
{
|
||||
virtual ::size_t get_size() { return sizeof(T); }
|
||||
virtual const std::type_info& type() { return typeid(T); }
|
||||
virtual ::size_t get_size() CV_OVERRIDE { return sizeof(T); }
|
||||
virtual const std::type_info& type() CV_OVERRIDE { return typeid(T); }
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct small_any_policy : typed_base_any_policy<T>
|
||||
struct small_any_policy CV_FINAL : typed_base_any_policy<T>
|
||||
{
|
||||
virtual void static_delete(void**) { }
|
||||
virtual void copy_from_value(void const* src, void** dest)
|
||||
virtual void static_delete(void**) CV_OVERRIDE { }
|
||||
virtual void copy_from_value(void const* src, void** dest) CV_OVERRIDE
|
||||
{
|
||||
new (dest) T(* reinterpret_cast<T const*>(src));
|
||||
}
|
||||
virtual void clone(void* const* src, void** dest) { *dest = *src; }
|
||||
virtual void move(void* const* src, void** dest) { *dest = *src; }
|
||||
virtual void* get_value(void** src) { return reinterpret_cast<void*>(src); }
|
||||
virtual const void* get_value(void* const * src) { return reinterpret_cast<const void*>(src); }
|
||||
virtual void print(std::ostream& out, void* const* src) { out << *reinterpret_cast<T const*>(src); }
|
||||
virtual void clone(void* const* src, void** dest) CV_OVERRIDE { *dest = *src; }
|
||||
virtual void move(void* const* src, void** dest) CV_OVERRIDE { *dest = *src; }
|
||||
virtual void* get_value(void** src) CV_OVERRIDE { return reinterpret_cast<void*>(src); }
|
||||
virtual const void* get_value(void* const * src) CV_OVERRIDE { return reinterpret_cast<const void*>(src); }
|
||||
virtual void print(std::ostream& out, void* const* src) CV_OVERRIDE { out << *reinterpret_cast<T const*>(src); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct big_any_policy : typed_base_any_policy<T>
|
||||
struct big_any_policy CV_FINAL : typed_base_any_policy<T>
|
||||
{
|
||||
virtual void static_delete(void** x)
|
||||
virtual void static_delete(void** x) CV_OVERRIDE
|
||||
{
|
||||
if (* x) delete (* reinterpret_cast<T**>(x));
|
||||
*x = NULL;
|
||||
}
|
||||
virtual void copy_from_value(void const* src, void** dest)
|
||||
virtual void copy_from_value(void const* src, void** dest) CV_OVERRIDE
|
||||
{
|
||||
*dest = new T(*reinterpret_cast<T const*>(src));
|
||||
}
|
||||
virtual void clone(void* const* src, void** dest)
|
||||
virtual void clone(void* const* src, void** dest) CV_OVERRIDE
|
||||
{
|
||||
*dest = new T(**reinterpret_cast<T* const*>(src));
|
||||
}
|
||||
virtual void move(void* const* src, void** dest)
|
||||
virtual void move(void* const* src, void** dest) CV_OVERRIDE
|
||||
{
|
||||
(*reinterpret_cast<T**>(dest))->~T();
|
||||
**reinterpret_cast<T**>(dest) = **reinterpret_cast<T* const*>(src);
|
||||
}
|
||||
virtual void* get_value(void** src) { return *src; }
|
||||
virtual const void* get_value(void* const * src) { return *src; }
|
||||
virtual void print(std::ostream& out, void* const* src) { out << *reinterpret_cast<T const*>(*src); }
|
||||
virtual void* get_value(void** src) CV_OVERRIDE { return *src; }
|
||||
virtual const void* get_value(void* const * src) CV_OVERRIDE { return *src; }
|
||||
virtual void print(std::ostream& out, void* const* src) CV_OVERRIDE { out << *reinterpret_cast<T const*>(*src); }
|
||||
};
|
||||
|
||||
template<> inline void big_any_policy<flann_centers_init_t>::print(std::ostream& out, void* const* src)
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
/**
|
||||
* Method responsible with building the index.
|
||||
*/
|
||||
virtual void buildIndex()
|
||||
virtual void buildIndex() CV_OVERRIDE
|
||||
{
|
||||
std::ostringstream stream;
|
||||
bestParams_ = estimateBuildParams();
|
||||
@ -124,7 +124,7 @@ public:
|
||||
/**
|
||||
* Saves the index to a stream
|
||||
*/
|
||||
virtual void saveIndex(FILE* stream)
|
||||
virtual void saveIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
save_value(stream, (int)bestIndex_->getType());
|
||||
bestIndex_->saveIndex(stream);
|
||||
@ -134,7 +134,7 @@ public:
|
||||
/**
|
||||
* Loads the index from a stream
|
||||
*/
|
||||
virtual void loadIndex(FILE* stream)
|
||||
virtual void loadIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
int index_type;
|
||||
|
||||
@ -151,7 +151,7 @@ public:
|
||||
/**
|
||||
* Method that searches for nearest-neighbors
|
||||
*/
|
||||
virtual void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
|
||||
virtual void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE
|
||||
{
|
||||
int checks = get_param<int>(searchParams,"checks",FLANN_CHECKS_AUTOTUNED);
|
||||
if (checks == FLANN_CHECKS_AUTOTUNED) {
|
||||
@ -163,7 +163,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
IndexParams getParameters() const
|
||||
IndexParams getParameters() const CV_OVERRIDE
|
||||
{
|
||||
return bestIndex_->getParameters();
|
||||
}
|
||||
@ -182,7 +182,7 @@ public:
|
||||
/**
|
||||
* Number of features in this index.
|
||||
*/
|
||||
virtual size_t size() const
|
||||
virtual size_t size() const CV_OVERRIDE
|
||||
{
|
||||
return bestIndex_->size();
|
||||
}
|
||||
@ -190,7 +190,7 @@ public:
|
||||
/**
|
||||
* The length of each vector in this index.
|
||||
*/
|
||||
virtual size_t veclen() const
|
||||
virtual size_t veclen() const CV_OVERRIDE
|
||||
{
|
||||
return bestIndex_->veclen();
|
||||
}
|
||||
@ -198,7 +198,7 @@ public:
|
||||
/**
|
||||
* The amount of memory (in bytes) this index uses.
|
||||
*/
|
||||
virtual int usedMemory() const
|
||||
virtual int usedMemory() const CV_OVERRIDE
|
||||
{
|
||||
return bestIndex_->usedMemory();
|
||||
}
|
||||
@ -206,7 +206,7 @@ public:
|
||||
/**
|
||||
* Algorithm name
|
||||
*/
|
||||
virtual flann_algorithm_t getType() const
|
||||
virtual flann_algorithm_t getType() const CV_OVERRIDE
|
||||
{
|
||||
return FLANN_INDEX_AUTOTUNED;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
/**
|
||||
* @return The index type
|
||||
*/
|
||||
flann_algorithm_t getType() const
|
||||
flann_algorithm_t getType() const CV_OVERRIDE
|
||||
{
|
||||
return FLANN_INDEX_COMPOSITE;
|
||||
}
|
||||
@ -109,7 +109,7 @@ public:
|
||||
/**
|
||||
* @return Size of the index
|
||||
*/
|
||||
size_t size() const
|
||||
size_t size() const CV_OVERRIDE
|
||||
{
|
||||
return kdtree_index_->size();
|
||||
}
|
||||
@ -117,7 +117,7 @@ public:
|
||||
/**
|
||||
* \returns The dimensionality of the features in this index.
|
||||
*/
|
||||
size_t veclen() const
|
||||
size_t veclen() const CV_OVERRIDE
|
||||
{
|
||||
return kdtree_index_->veclen();
|
||||
}
|
||||
@ -125,7 +125,7 @@ public:
|
||||
/**
|
||||
* \returns The amount of memory (in bytes) used by the index.
|
||||
*/
|
||||
int usedMemory() const
|
||||
int usedMemory() const CV_OVERRIDE
|
||||
{
|
||||
return kmeans_index_->usedMemory() + kdtree_index_->usedMemory();
|
||||
}
|
||||
@ -133,7 +133,7 @@ public:
|
||||
/**
|
||||
* \brief Builds the index
|
||||
*/
|
||||
void buildIndex()
|
||||
void buildIndex() CV_OVERRIDE
|
||||
{
|
||||
Logger::info("Building kmeans tree...\n");
|
||||
kmeans_index_->buildIndex();
|
||||
@ -145,7 +145,7 @@ public:
|
||||
* \brief Saves the index to a stream
|
||||
* \param stream The stream to save the index to
|
||||
*/
|
||||
void saveIndex(FILE* stream)
|
||||
void saveIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
kmeans_index_->saveIndex(stream);
|
||||
kdtree_index_->saveIndex(stream);
|
||||
@ -155,7 +155,7 @@ public:
|
||||
* \brief Loads the index from a stream
|
||||
* \param stream The stream from which the index is loaded
|
||||
*/
|
||||
void loadIndex(FILE* stream)
|
||||
void loadIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
kmeans_index_->loadIndex(stream);
|
||||
kdtree_index_->loadIndex(stream);
|
||||
@ -164,7 +164,7 @@ public:
|
||||
/**
|
||||
* \returns The index parameters
|
||||
*/
|
||||
IndexParams getParameters() const
|
||||
IndexParams getParameters() const CV_OVERRIDE
|
||||
{
|
||||
return index_params_;
|
||||
}
|
||||
@ -172,7 +172,7 @@ public:
|
||||
/**
|
||||
* \brief Method that searches for nearest-neighbours
|
||||
*/
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE
|
||||
{
|
||||
kmeans_index_->findNeighbors(result, vec, searchParams);
|
||||
kdtree_index_->findNeighbors(result, vec, searchParams);
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
/**
|
||||
* Builds the index.
|
||||
*/
|
||||
void buildIndex()
|
||||
void buildIndex() CV_OVERRIDE
|
||||
{
|
||||
if (!loaded_) {
|
||||
nnIndex_->buildIndex();
|
||||
@ -150,7 +150,7 @@ public:
|
||||
* \brief Saves the index to a stream
|
||||
* \param stream The stream to save the index to
|
||||
*/
|
||||
virtual void saveIndex(FILE* stream)
|
||||
virtual void saveIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
nnIndex_->saveIndex(stream);
|
||||
}
|
||||
@ -159,7 +159,7 @@ public:
|
||||
* \brief Loads the index from a stream
|
||||
* \param stream The stream from which the index is loaded
|
||||
*/
|
||||
virtual void loadIndex(FILE* stream)
|
||||
virtual void loadIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
nnIndex_->loadIndex(stream);
|
||||
}
|
||||
@ -167,7 +167,7 @@ public:
|
||||
/**
|
||||
* \returns number of features in this index.
|
||||
*/
|
||||
size_t veclen() const
|
||||
size_t veclen() const CV_OVERRIDE
|
||||
{
|
||||
return nnIndex_->veclen();
|
||||
}
|
||||
@ -175,7 +175,7 @@ public:
|
||||
/**
|
||||
* \returns The dimensionality of the features in this index.
|
||||
*/
|
||||
size_t size() const
|
||||
size_t size() const CV_OVERRIDE
|
||||
{
|
||||
return nnIndex_->size();
|
||||
}
|
||||
@ -183,7 +183,7 @@ public:
|
||||
/**
|
||||
* \returns The index type (kdtree, kmeans,...)
|
||||
*/
|
||||
flann_algorithm_t getType() const
|
||||
flann_algorithm_t getType() const CV_OVERRIDE
|
||||
{
|
||||
return nnIndex_->getType();
|
||||
}
|
||||
@ -191,7 +191,7 @@ public:
|
||||
/**
|
||||
* \returns The amount of memory (in bytes) used by the index.
|
||||
*/
|
||||
virtual int usedMemory() const
|
||||
virtual int usedMemory() const CV_OVERRIDE
|
||||
{
|
||||
return nnIndex_->usedMemory();
|
||||
}
|
||||
@ -200,7 +200,7 @@ public:
|
||||
/**
|
||||
* \returns The index parameters
|
||||
*/
|
||||
IndexParams getParameters() const
|
||||
IndexParams getParameters() const CV_OVERRIDE
|
||||
{
|
||||
return nnIndex_->getParameters();
|
||||
}
|
||||
@ -213,7 +213,7 @@ public:
|
||||
* \param[in] knn Number of nearest neighbors to return
|
||||
* \param[in] params Search parameters
|
||||
*/
|
||||
void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
|
||||
void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params) CV_OVERRIDE
|
||||
{
|
||||
nnIndex_->knnSearch(queries, indices, dists, knn, params);
|
||||
}
|
||||
@ -227,7 +227,7 @@ public:
|
||||
* \param[in] params Search parameters
|
||||
* \returns Number of neighbors found
|
||||
*/
|
||||
int radiusSearch(const Matrix<ElementType>& query, Matrix<int>& indices, Matrix<DistanceType>& dists, float radius, const SearchParams& params)
|
||||
int radiusSearch(const Matrix<ElementType>& query, Matrix<int>& indices, Matrix<DistanceType>& dists, float radius, const SearchParams& params) CV_OVERRIDE
|
||||
{
|
||||
return nnIndex_->radiusSearch(query, indices, dists, radius, params);
|
||||
}
|
||||
@ -235,7 +235,7 @@ public:
|
||||
/**
|
||||
* \brief Method that searches for nearest-neighbours
|
||||
*/
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE
|
||||
{
|
||||
nnIndex_->findNeighbors(result, vec, searchParams);
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ public:
|
||||
/**
|
||||
* Returns size of index.
|
||||
*/
|
||||
size_t size() const
|
||||
size_t size() const CV_OVERRIDE
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
@ -443,7 +443,7 @@ public:
|
||||
/**
|
||||
* Returns the length of an index feature.
|
||||
*/
|
||||
size_t veclen() const
|
||||
size_t veclen() const CV_OVERRIDE
|
||||
{
|
||||
return veclen_;
|
||||
}
|
||||
@ -453,7 +453,7 @@ public:
|
||||
* Computes the inde memory usage
|
||||
* Returns: memory used by the index
|
||||
*/
|
||||
int usedMemory() const
|
||||
int usedMemory() const CV_OVERRIDE
|
||||
{
|
||||
return pool.usedMemory+pool.wastedMemory+memoryCounter;
|
||||
}
|
||||
@ -461,7 +461,7 @@ public:
|
||||
/**
|
||||
* Builds the index
|
||||
*/
|
||||
void buildIndex()
|
||||
void buildIndex() CV_OVERRIDE
|
||||
{
|
||||
if (branching_<2) {
|
||||
throw FLANNException("Branching factor must be at least 2");
|
||||
@ -480,13 +480,13 @@ public:
|
||||
}
|
||||
|
||||
|
||||
flann_algorithm_t getType() const
|
||||
flann_algorithm_t getType() const CV_OVERRIDE
|
||||
{
|
||||
return FLANN_INDEX_HIERARCHICAL;
|
||||
}
|
||||
|
||||
|
||||
void saveIndex(FILE* stream)
|
||||
void saveIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
save_value(stream, branching_);
|
||||
save_value(stream, trees_);
|
||||
@ -501,7 +501,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void loadIndex(FILE* stream)
|
||||
void loadIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
free_elements();
|
||||
|
||||
@ -544,7 +544,7 @@ public:
|
||||
* vec = the vector for which to search the nearest neighbors
|
||||
* searchParams = parameters that influence the search algorithm (checks)
|
||||
*/
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE
|
||||
{
|
||||
|
||||
int maxChecks = get_param(searchParams,"checks",32);
|
||||
@ -569,7 +569,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
IndexParams getParameters() const
|
||||
IndexParams getParameters() const CV_OVERRIDE
|
||||
{
|
||||
return params;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
/**
|
||||
* Builds the index
|
||||
*/
|
||||
void buildIndex()
|
||||
void buildIndex() CV_OVERRIDE
|
||||
{
|
||||
/* Construct the randomized trees. */
|
||||
for (int i = 0; i < trees_; i++) {
|
||||
@ -136,13 +136,13 @@ public:
|
||||
}
|
||||
|
||||
|
||||
flann_algorithm_t getType() const
|
||||
flann_algorithm_t getType() const CV_OVERRIDE
|
||||
{
|
||||
return FLANN_INDEX_KDTREE;
|
||||
}
|
||||
|
||||
|
||||
void saveIndex(FILE* stream)
|
||||
void saveIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
save_value(stream, trees_);
|
||||
for (int i=0; i<trees_; ++i) {
|
||||
@ -152,7 +152,7 @@ public:
|
||||
|
||||
|
||||
|
||||
void loadIndex(FILE* stream)
|
||||
void loadIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
load_value(stream, trees_);
|
||||
if (tree_roots_!=NULL) {
|
||||
@ -170,7 +170,7 @@ public:
|
||||
/**
|
||||
* Returns size of index.
|
||||
*/
|
||||
size_t size() const
|
||||
size_t size() const CV_OVERRIDE
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
@ -178,7 +178,7 @@ public:
|
||||
/**
|
||||
* Returns the length of an index feature.
|
||||
*/
|
||||
size_t veclen() const
|
||||
size_t veclen() const CV_OVERRIDE
|
||||
{
|
||||
return veclen_;
|
||||
}
|
||||
@ -187,7 +187,7 @@ public:
|
||||
* Computes the inde memory usage
|
||||
* Returns: memory used by the index
|
||||
*/
|
||||
int usedMemory() const
|
||||
int usedMemory() const CV_OVERRIDE
|
||||
{
|
||||
return int(pool_.usedMemory+pool_.wastedMemory+dataset_.rows*sizeof(int)); // pool memory and vind array memory
|
||||
}
|
||||
@ -201,7 +201,7 @@ public:
|
||||
* vec = the vector for which to search the nearest neighbors
|
||||
* maxCheck = the maximum number of restarts (in a best-bin-first manner)
|
||||
*/
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE
|
||||
{
|
||||
int maxChecks = get_param(searchParams,"checks", 32);
|
||||
float epsError = 1+get_param(searchParams,"eps",0.0f);
|
||||
@ -214,7 +214,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
IndexParams getParameters() const
|
||||
IndexParams getParameters() const CV_OVERRIDE
|
||||
{
|
||||
return index_params_;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public:
|
||||
/**
|
||||
* Builds the index
|
||||
*/
|
||||
void buildIndex()
|
||||
void buildIndex() CV_OVERRIDE
|
||||
{
|
||||
computeBoundingBox(root_bbox_);
|
||||
root_node_ = divideTree(0, (int)size_, root_bbox_ ); // construct the tree
|
||||
@ -133,13 +133,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
flann_algorithm_t getType() const
|
||||
flann_algorithm_t getType() const CV_OVERRIDE
|
||||
{
|
||||
return FLANN_INDEX_KDTREE_SINGLE;
|
||||
}
|
||||
|
||||
|
||||
void saveIndex(FILE* stream)
|
||||
void saveIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
save_value(stream, size_);
|
||||
save_value(stream, dim_);
|
||||
@ -154,7 +154,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void loadIndex(FILE* stream)
|
||||
void loadIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
load_value(stream, size_);
|
||||
load_value(stream, dim_);
|
||||
@ -179,7 +179,7 @@ public:
|
||||
/**
|
||||
* Returns size of index.
|
||||
*/
|
||||
size_t size() const
|
||||
size_t size() const CV_OVERRIDE
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
@ -187,7 +187,7 @@ public:
|
||||
/**
|
||||
* Returns the length of an index feature.
|
||||
*/
|
||||
size_t veclen() const
|
||||
size_t veclen() const CV_OVERRIDE
|
||||
{
|
||||
return dim_;
|
||||
}
|
||||
@ -196,7 +196,7 @@ public:
|
||||
* Computes the inde memory usage
|
||||
* Returns: memory used by the index
|
||||
*/
|
||||
int usedMemory() const
|
||||
int usedMemory() const CV_OVERRIDE
|
||||
{
|
||||
return (int)(pool_.usedMemory+pool_.wastedMemory+dataset_.rows*sizeof(int)); // pool memory and vind array memory
|
||||
}
|
||||
@ -210,7 +210,7 @@ public:
|
||||
* \param[in] knn Number of nearest neighbors to return
|
||||
* \param[in] params Search parameters
|
||||
*/
|
||||
void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
|
||||
void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params) CV_OVERRIDE
|
||||
{
|
||||
assert(queries.cols == veclen());
|
||||
assert(indices.rows >= queries.rows);
|
||||
@ -225,7 +225,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
IndexParams getParameters() const
|
||||
IndexParams getParameters() const CV_OVERRIDE
|
||||
{
|
||||
return index_params_;
|
||||
}
|
||||
@ -239,7 +239,7 @@ public:
|
||||
* vec = the vector for which to search the nearest neighbors
|
||||
* maxCheck = the maximum number of restarts (in a best-bin-first manner)
|
||||
*/
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE
|
||||
{
|
||||
float epsError = 1+get_param(searchParams,"eps",0.0f);
|
||||
|
||||
|
@ -266,7 +266,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
flann_algorithm_t getType() const
|
||||
flann_algorithm_t getType() const CV_OVERRIDE
|
||||
{
|
||||
return FLANN_INDEX_KMEANS;
|
||||
}
|
||||
@ -291,7 +291,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(const cv::Range& range) const
|
||||
void operator()(const cv::Range& range) const CV_OVERRIDE
|
||||
{
|
||||
const int begin = range.start;
|
||||
const int end = range.end;
|
||||
@ -398,7 +398,7 @@ public:
|
||||
/**
|
||||
* Returns size of index.
|
||||
*/
|
||||
size_t size() const
|
||||
size_t size() const CV_OVERRIDE
|
||||
{
|
||||
return size_;
|
||||
}
|
||||
@ -406,7 +406,7 @@ public:
|
||||
/**
|
||||
* Returns the length of an index feature.
|
||||
*/
|
||||
size_t veclen() const
|
||||
size_t veclen() const CV_OVERRIDE
|
||||
{
|
||||
return veclen_;
|
||||
}
|
||||
@ -421,7 +421,7 @@ public:
|
||||
* Computes the inde memory usage
|
||||
* Returns: memory used by the index
|
||||
*/
|
||||
int usedMemory() const
|
||||
int usedMemory() const CV_OVERRIDE
|
||||
{
|
||||
return pool_.usedMemory+pool_.wastedMemory+memoryCounter_;
|
||||
}
|
||||
@ -429,7 +429,7 @@ public:
|
||||
/**
|
||||
* Builds the index
|
||||
*/
|
||||
void buildIndex()
|
||||
void buildIndex() CV_OVERRIDE
|
||||
{
|
||||
if (branching_<2) {
|
||||
throw FLANNException("Branching factor must be at least 2");
|
||||
@ -448,7 +448,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void saveIndex(FILE* stream)
|
||||
void saveIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
save_value(stream, branching_);
|
||||
save_value(stream, iterations_);
|
||||
@ -460,7 +460,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void loadIndex(FILE* stream)
|
||||
void loadIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
load_value(stream, branching_);
|
||||
load_value(stream, iterations_);
|
||||
@ -495,7 +495,7 @@ public:
|
||||
* vec = the vector for which to search the nearest neighbors
|
||||
* searchParams = parameters that influence the search algorithm (checks, cb_index)
|
||||
*/
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams)
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& searchParams) CV_OVERRIDE
|
||||
{
|
||||
|
||||
int maxChecks = get_param(searchParams,"checks",32);
|
||||
@ -554,7 +554,7 @@ public:
|
||||
return clusterCount;
|
||||
}
|
||||
|
||||
IndexParams getParameters() const
|
||||
IndexParams getParameters() const CV_OVERRIDE
|
||||
{
|
||||
return index_params_;
|
||||
}
|
||||
|
@ -63,47 +63,47 @@ public:
|
||||
LinearIndex(const LinearIndex&);
|
||||
LinearIndex& operator=(const LinearIndex&);
|
||||
|
||||
flann_algorithm_t getType() const
|
||||
flann_algorithm_t getType() const CV_OVERRIDE
|
||||
{
|
||||
return FLANN_INDEX_LINEAR;
|
||||
}
|
||||
|
||||
|
||||
size_t size() const
|
||||
size_t size() const CV_OVERRIDE
|
||||
{
|
||||
return dataset_.rows;
|
||||
}
|
||||
|
||||
size_t veclen() const
|
||||
size_t veclen() const CV_OVERRIDE
|
||||
{
|
||||
return dataset_.cols;
|
||||
}
|
||||
|
||||
|
||||
int usedMemory() const
|
||||
int usedMemory() const CV_OVERRIDE
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void buildIndex()
|
||||
void buildIndex() CV_OVERRIDE
|
||||
{
|
||||
/* nothing to do here for linear search */
|
||||
}
|
||||
|
||||
void saveIndex(FILE*)
|
||||
void saveIndex(FILE*) CV_OVERRIDE
|
||||
{
|
||||
/* nothing to do here for linear search */
|
||||
}
|
||||
|
||||
|
||||
void loadIndex(FILE*)
|
||||
void loadIndex(FILE*) CV_OVERRIDE
|
||||
{
|
||||
/* nothing to do here for linear search */
|
||||
|
||||
index_params_["algorithm"] = getType();
|
||||
}
|
||||
|
||||
void findNeighbors(ResultSet<DistanceType>& resultSet, const ElementType* vec, const SearchParams& /*searchParams*/)
|
||||
void findNeighbors(ResultSet<DistanceType>& resultSet, const ElementType* vec, const SearchParams& /*searchParams*/) CV_OVERRIDE
|
||||
{
|
||||
ElementType* data = dataset_.data;
|
||||
for (size_t i = 0; i < dataset_.rows; ++i, data += dataset_.cols) {
|
||||
@ -112,7 +112,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
IndexParams getParameters() const
|
||||
IndexParams getParameters() const CV_OVERRIDE
|
||||
{
|
||||
return index_params_;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
/**
|
||||
* Builds the index
|
||||
*/
|
||||
void buildIndex()
|
||||
void buildIndex() CV_OVERRIDE
|
||||
{
|
||||
tables_.resize(table_number_);
|
||||
for (unsigned int i = 0; i < table_number_; ++i) {
|
||||
@ -119,13 +119,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
flann_algorithm_t getType() const
|
||||
flann_algorithm_t getType() const CV_OVERRIDE
|
||||
{
|
||||
return FLANN_INDEX_LSH;
|
||||
}
|
||||
|
||||
|
||||
void saveIndex(FILE* stream)
|
||||
void saveIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
save_value(stream,table_number_);
|
||||
save_value(stream,key_size_);
|
||||
@ -133,7 +133,7 @@ public:
|
||||
save_value(stream, dataset_);
|
||||
}
|
||||
|
||||
void loadIndex(FILE* stream)
|
||||
void loadIndex(FILE* stream) CV_OVERRIDE
|
||||
{
|
||||
load_value(stream, table_number_);
|
||||
load_value(stream, key_size_);
|
||||
@ -151,7 +151,7 @@ public:
|
||||
/**
|
||||
* Returns size of index.
|
||||
*/
|
||||
size_t size() const
|
||||
size_t size() const CV_OVERRIDE
|
||||
{
|
||||
return dataset_.rows;
|
||||
}
|
||||
@ -159,7 +159,7 @@ public:
|
||||
/**
|
||||
* Returns the length of an index feature.
|
||||
*/
|
||||
size_t veclen() const
|
||||
size_t veclen() const CV_OVERRIDE
|
||||
{
|
||||
return feature_size_;
|
||||
}
|
||||
@ -168,13 +168,13 @@ public:
|
||||
* Computes the index memory usage
|
||||
* Returns: memory used by the index
|
||||
*/
|
||||
int usedMemory() const
|
||||
int usedMemory() const CV_OVERRIDE
|
||||
{
|
||||
return (int)(dataset_.rows * sizeof(int));
|
||||
}
|
||||
|
||||
|
||||
IndexParams getParameters() const
|
||||
IndexParams getParameters() const CV_OVERRIDE
|
||||
{
|
||||
return index_params_;
|
||||
}
|
||||
@ -187,7 +187,7 @@ public:
|
||||
* \param[in] knn Number of nearest neighbors to return
|
||||
* \param[in] params Search parameters
|
||||
*/
|
||||
virtual void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params)
|
||||
virtual void knnSearch(const Matrix<ElementType>& queries, Matrix<int>& indices, Matrix<DistanceType>& dists, int knn, const SearchParams& params) CV_OVERRIDE
|
||||
{
|
||||
assert(queries.cols == veclen());
|
||||
assert(indices.rows >= queries.rows);
|
||||
@ -217,7 +217,7 @@ public:
|
||||
* vec = the vector for which to search the nearest neighbors
|
||||
* maxCheck = the maximum number of restarts (in a best-bin-first manner)
|
||||
*/
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& /*searchParams*/)
|
||||
void findNeighbors(ResultSet<DistanceType>& result, const ElementType* vec, const SearchParams& /*searchParams*/) CV_OVERRIDE
|
||||
{
|
||||
getNeighbors(vec, result);
|
||||
}
|
||||
|
@ -109,13 +109,13 @@ public:
|
||||
return count;
|
||||
}
|
||||
|
||||
bool full() const
|
||||
bool full() const CV_OVERRIDE
|
||||
{
|
||||
return count == capacity;
|
||||
}
|
||||
|
||||
|
||||
void addPoint(DistanceType dist, int index)
|
||||
void addPoint(DistanceType dist, int index) CV_OVERRIDE
|
||||
{
|
||||
if (dist >= worst_distance_) return;
|
||||
int i;
|
||||
@ -139,7 +139,7 @@ public:
|
||||
worst_distance_ = dists[capacity-1];
|
||||
}
|
||||
|
||||
DistanceType worstDist() const
|
||||
DistanceType worstDist() const CV_OVERRIDE
|
||||
{
|
||||
return worst_distance_;
|
||||
}
|
||||
@ -176,13 +176,13 @@ public:
|
||||
return count;
|
||||
}
|
||||
|
||||
bool full() const
|
||||
bool full() const CV_OVERRIDE
|
||||
{
|
||||
return count == capacity;
|
||||
}
|
||||
|
||||
|
||||
void addPoint(DistanceType dist, int index)
|
||||
void addPoint(DistanceType dist, int index) CV_OVERRIDE
|
||||
{
|
||||
if (dist >= worst_distance_) return;
|
||||
int i;
|
||||
@ -215,7 +215,7 @@ public:
|
||||
worst_distance_ = dists[capacity-1];
|
||||
}
|
||||
|
||||
DistanceType worstDist() const
|
||||
DistanceType worstDist() const CV_OVERRIDE
|
||||
{
|
||||
return worst_distance_;
|
||||
}
|
||||
@ -310,7 +310,7 @@ public:
|
||||
/** Check the status of the set
|
||||
* @return true if we have k NN
|
||||
*/
|
||||
inline bool full() const
|
||||
inline bool full() const CV_OVERRIDE
|
||||
{
|
||||
return is_full_;
|
||||
}
|
||||
@ -365,7 +365,7 @@ public:
|
||||
* If we don't have enough neighbors, it returns the max possible value
|
||||
* @return
|
||||
*/
|
||||
inline DistanceType worstDist() const
|
||||
inline DistanceType worstDist() const CV_OVERRIDE
|
||||
{
|
||||
return worst_distance_;
|
||||
}
|
||||
@ -402,7 +402,7 @@ public:
|
||||
* @param dist distance for that neighbor
|
||||
* @param index index of that neighbor
|
||||
*/
|
||||
inline void addPoint(DistanceType dist, int index)
|
||||
inline void addPoint(DistanceType dist, int index) CV_OVERRIDE
|
||||
{
|
||||
// Don't do anything if we are worse than the worst
|
||||
if (dist >= worst_distance_) return;
|
||||
@ -422,7 +422,7 @@ public:
|
||||
|
||||
/** Remove all elements in the set
|
||||
*/
|
||||
void clear()
|
||||
void clear() CV_OVERRIDE
|
||||
{
|
||||
dist_indices_.clear();
|
||||
worst_distance_ = std::numeric_limits<DistanceType>::max();
|
||||
@ -461,14 +461,14 @@ public:
|
||||
* @param dist distance for that neighbor
|
||||
* @param index index of that neighbor
|
||||
*/
|
||||
void addPoint(DistanceType dist, int index)
|
||||
void addPoint(DistanceType dist, int index) CV_OVERRIDE
|
||||
{
|
||||
if (dist <= radius_) dist_indices_.insert(DistIndex(dist, index));
|
||||
}
|
||||
|
||||
/** Remove all elements in the set
|
||||
*/
|
||||
inline void clear()
|
||||
inline void clear() CV_OVERRIDE
|
||||
{
|
||||
dist_indices_.clear();
|
||||
}
|
||||
@ -477,7 +477,7 @@ public:
|
||||
/** Check the status of the set
|
||||
* @return alwys false
|
||||
*/
|
||||
inline bool full() const
|
||||
inline bool full() const CV_OVERRIDE
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -486,7 +486,7 @@ public:
|
||||
* If we don't have enough neighbors, it returns the max possible value
|
||||
* @return
|
||||
*/
|
||||
inline DistanceType worstDist() const
|
||||
inline DistanceType worstDist() const CV_OVERRIDE
|
||||
{
|
||||
return radius_;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user