template class cvflann::UniqueResultSet
Overview
Class that holds the k NN neighbors Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays More…
#include <result_set.h> template <typename DistanceType> class UniqueResultSet: public cvflann::ResultSet { public: // structs struct DistIndex; // methods virtual void clear() = 0; virtual void copy( int* indices, DistanceType* dist, int n_neighbors = -1 ) const; virtual bool full() const; size_t size() const; virtual void sortAndCopy( int* indices, DistanceType* dist, int n_neighbors = -1 ) const; virtual DistanceType worstDist() const; protected: // fields std::set<DistIndex> dist_indices_; bool is_full_; DistanceType worst_distance_; }; // direct descendants template <typename DistanceType> class KNNUniqueResultSet; template <typename DistanceType> class RadiusUniqueResultSet;
Detailed Documentation
Class that holds the k NN neighbors Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays
Fields
std::set<DistIndex> dist_indices_
The best candidates so far
bool is_full_
Flag to say if the set is full
DistanceType worst_distance_
The worst distance found so far
Methods
virtual void clear() = 0
Remove all elements in the set
virtual void copy( int* indices, DistanceType* dist, int n_neighbors = -1 ) const
Copy the set to two C arrays
Parameters:
indices | pointer to a C array of indices |
dist | pointer to a C array of distances |
n_neighbors | the number of neighbors to copy |
virtual bool full() const
Check the status of the set
Returns:
true if we have k NN
size_t size() const
The number of neighbors in the set
Returns:
virtual void sortAndCopy( int* indices, DistanceType* dist, int n_neighbors = -1 ) const
Copy the set to two C arrays but sort it according to the distance first
Parameters:
indices | pointer to a C array of indices |
dist | pointer to a C array of distances |
n_neighbors | the number of neighbors to copy |
virtual DistanceType worstDist() const
The distance of the furthest neighbor If we don’t have enough neighbors, it returns the max possible value
Returns: