#include <result_set.h>
Inherits cvflann::UniqueResultSet< DistanceType >.
Inherited by cvflann::KNNRadiusUniqueResultSet< DistanceType >.
Public Member Functions | |
| KNNUniqueResultSet (unsigned int capacity) | |
| void | addPoint (DistanceType dist, int index) |
| void | clear () |
| bool | full () const |
| virtual void | copy (int *indices, DistanceType *dist, int n_neighbors=-1) const |
| virtual void | sortAndCopy (int *indices, DistanceType *dist, int n_neighbors=-1) const |
| size_t | size () const |
| DistanceType | worstDist () const |
Protected Types | |
| typedef UniqueResultSet < DistanceType >::DistIndex | DistIndex |
Protected Attributes | |
| unsigned int | capacity_ |
| bool | is_full_ |
| DistanceType | worst_distance_ |
| std::set< DistIndex > | dist_indices_ |
Class that holds the k NN neighbors Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays
typedef UniqueResultSet<DistanceType>::DistIndex cvflann::KNNUniqueResultSet< DistanceType >::DistIndex [protected] |
| cvflann::KNNUniqueResultSet< DistanceType >::KNNUniqueResultSet | ( | unsigned int | capacity | ) |
Constructor
| capacity | the number of neighbors to store at max |
| void cvflann::KNNUniqueResultSet< DistanceType >::addPoint | ( | DistanceType | dist, |
| int | index | ||
| ) | [virtual] |
Add a possible candidate to the best neighbors
| dist | distance for that neighbor |
| index | index of that neighbor |
Implements cvflann::ResultSet< DistanceType >.
| void cvflann::KNNUniqueResultSet< DistanceType >::clear | ( | ) | [virtual] |
Remove all elements in the set
Implements cvflann::UniqueResultSet< DistanceType >.
Reimplemented in cvflann::KNNRadiusUniqueResultSet< DistanceType >.
| bool cvflann::UniqueResultSet< DistanceType >::full | ( | ) | const [virtual, inherited] |
Check the status of the set
Implements cvflann::ResultSet< DistanceType >.
Reimplemented in cvflann::RadiusUniqueResultSet< DistanceType >.
| virtual void cvflann::UniqueResultSet< DistanceType >::copy | ( | int * | indices, |
| DistanceType * | dist, | ||
| int | n_neighbors = -1 |
||
| ) | const [virtual, inherited] |
Copy the set to two C arrays
| 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 void cvflann::UniqueResultSet< DistanceType >::sortAndCopy | ( | int * | indices, |
| DistanceType * | dist, | ||
| int | n_neighbors = -1 |
||
| ) | const [virtual, inherited] |
Copy the set to two C arrays but sort it according to the distance first
| indices | pointer to a C array of indices |
| dist | pointer to a C array of distances |
| n_neighbors | the number of neighbors to copy |
| size_t cvflann::UniqueResultSet< DistanceType >::size | ( | ) | const [inherited] |
The number of neighbors in the set
| DistanceType cvflann::UniqueResultSet< DistanceType >::worstDist | ( | ) | const [virtual, inherited] |
The distance of the furthest neighbor If we don't have enough neighbors, it returns the max possible value
Implements cvflann::ResultSet< DistanceType >.
Reimplemented in cvflann::RadiusUniqueResultSet< DistanceType >.
unsigned int cvflann::KNNUniqueResultSet< DistanceType >::capacity_ [protected] |
The number of neighbors to keep
bool cvflann::UniqueResultSet< DistanceType >::is_full_ [protected, inherited] |
Flag to say if the set is full
DistanceType cvflann::UniqueResultSet< DistanceType >::worst_distance_ [protected, inherited] |
The worst distance found so far
std::set<DistIndex> cvflann::UniqueResultSet< DistanceType >::dist_indices_ [protected, inherited] |
The best candidates so far