OpenCV  4.1.1-pre
Open Source Computer Vision
Looking for a C++ dev who knows OpenCV?
I'm looking for work. Hire me!
cvflann::KNNUniqueResultSet< DistanceType > Class Template Reference

Class that holds the k NN neighbors Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays. More...

#include <opencv2/flann/result_set.h>

Inheritance diagram for cvflann::KNNUniqueResultSet< DistanceType >:
Collaboration diagram for cvflann::KNNUniqueResultSet< DistanceType >:

Public Member Functions

 KNNUniqueResultSet (unsigned int capacity)
 Constructor. More...
 
void addPoint (DistanceType dist, int index) CV_OVERRIDE
 Add a possible candidate to the best neighbors. More...
 
void clear () CV_OVERRIDE
 Remove all elements in the set. More...
 
virtual void copy (int *indices, DistanceType *dist, int n_neighbors=-1) const
 Copy the set to two C arrays. More...
 
bool full () const CV_OVERRIDE
 Check the status of the set. More...
 
size_t size () const
 The number of neighbors in the set. More...
 
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. More...
 
DistanceType worstDist () const CV_OVERRIDE
 The distance of the furthest neighbor If we don't have enough neighbors, it returns the max possible value. More...
 

Protected Types

typedef UniqueResultSet< DistanceType >::DistIndex DistIndex
 

Protected Attributes

unsigned int capacity_
 The number of neighbors to keep. More...
 
std::set< DistIndexdist_indices_
 The best candidates so far. More...
 
bool is_full_
 Flag to say if the set is full. More...
 
DistanceType worst_distance_
 The worst distance found so far. More...
 

Detailed Description

template<typename DistanceType>
class cvflann::KNNUniqueResultSet< DistanceType >

Class that holds the k NN neighbors Faster than KNNResultSet as it uses a binary heap and does not maintain two arrays.

Member Typedef Documentation

◆ DistIndex

template<typename DistanceType>
typedef UniqueResultSet<DistanceType>::DistIndex cvflann::KNNUniqueResultSet< DistanceType >::DistIndex
protected

Constructor & Destructor Documentation

◆ KNNUniqueResultSet()

template<typename DistanceType>
cvflann::KNNUniqueResultSet< DistanceType >::KNNUniqueResultSet ( unsigned int  capacity)
inline

Constructor.

Parameters
capacitythe number of neighbors to store at max

Member Function Documentation

◆ addPoint()

template<typename DistanceType>
void cvflann::KNNUniqueResultSet< DistanceType >::addPoint ( DistanceType  dist,
int  index 
)
inlinevirtual

Add a possible candidate to the best neighbors.

Parameters
distdistance for that neighbor
indexindex of that neighbor

Implements cvflann::ResultSet< DistanceType >.

◆ clear()

template<typename DistanceType>
void cvflann::KNNUniqueResultSet< DistanceType >::clear ( )
inlinevirtual

Remove all elements in the set.

Implements cvflann::UniqueResultSet< DistanceType >.

Reimplemented in cvflann::KNNRadiusUniqueResultSet< DistanceType >.

References cv::max().

Referenced by cvflann::NNIndex< cv::L1< ElementType > >::knnSearch(), and cvflann::LshIndex< Distance >::knnSearch().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copy()

template<typename DistanceType >
virtual void cvflann::UniqueResultSet< DistanceType >::copy ( int *  indices,
DistanceType *  dist,
int  n_neighbors = -1 
) const
inlinevirtualinherited

Copy the set to two C arrays.

Parameters
indicespointer to a C array of indices
distpointer to a C array of distances
n_neighborsthe number of neighbors to copy

Referenced by cvflann::NNIndex< cv::L1< ElementType > >::knnSearch(), cvflann::LshIndex< Distance >::knnSearch(), and cvflann::NNIndex< cv::L1< ElementType > >::radiusSearch().

Here is the caller graph for this function:

◆ full()

template<typename DistanceType >
bool cvflann::UniqueResultSet< DistanceType >::full ( ) const
inlinevirtualinherited

Check the status of the set.

Returns
true if we have k NN

Implements cvflann::ResultSet< DistanceType >.

Reimplemented in cvflann::RadiusUniqueResultSet< DistanceType >.

◆ size()

template<typename DistanceType >
size_t cvflann::UniqueResultSet< DistanceType >::size ( ) const
inlineinherited

The number of neighbors in the set.

Returns

Referenced by cvflann::NNIndex< cv::L1< ElementType > >::radiusSearch().

Here is the caller graph for this function:

◆ sortAndCopy()

template<typename DistanceType >
virtual void cvflann::UniqueResultSet< DistanceType >::sortAndCopy ( int *  indices,
DistanceType *  dist,
int  n_neighbors = -1 
) const
inlinevirtualinherited

Copy the set to two C arrays but sort it according to the distance first.

Parameters
indicespointer to a C array of indices
distpointer to a C array of distances
n_neighborsthe number of neighbors to copy

Referenced by cvflann::NNIndex< cv::L1< ElementType > >::knnSearch(), cvflann::LshIndex< Distance >::knnSearch(), and cvflann::NNIndex< cv::L1< ElementType > >::radiusSearch().

Here is the caller graph for this function:

◆ worstDist()

template<typename DistanceType >
DistanceType cvflann::UniqueResultSet< DistanceType >::worstDist ( ) const
inlinevirtualinherited

The distance of the furthest neighbor If we don't have enough neighbors, it returns the max possible value.

Returns

Implements cvflann::ResultSet< DistanceType >.

Reimplemented in cvflann::RadiusUniqueResultSet< DistanceType >.

Member Data Documentation

◆ capacity_

template<typename DistanceType>
unsigned int cvflann::KNNUniqueResultSet< DistanceType >::capacity_
protected

The number of neighbors to keep.

◆ dist_indices_

template<typename DistanceType >
std::set<DistIndex> cvflann::UniqueResultSet< DistanceType >::dist_indices_
protectedinherited

The best candidates so far.

◆ is_full_

template<typename DistanceType >
bool cvflann::UniqueResultSet< DistanceType >::is_full_
protectedinherited

Flag to say if the set is full.

◆ worst_distance_

template<typename DistanceType >
DistanceType cvflann::UniqueResultSet< DistanceType >::worst_distance_
protectedinherited

The worst distance found so far.


The documentation for this class was generated from the following file: