OpenCV: cvflann::UniqueResultSet< DistanceType > Class Template Reference

| OpenCV 3.4.2 Open Source Computer Vision

Classes | Public Member Functions | Protected Attributes | List of all members
cvflann::UniqueResultSet< DistanceType > Class Template Referenceabstract

`#include "result_set.h"`

Inheritance diagram for cvflann::UniqueResultSet< DistanceType >:

## Classes
struct | DistIndex

## Public Member Functions
| UniqueResultSet ()
virtual void | clear ()=0
virtual void | copy (int *indices, DistanceType *dist, int n_neighbors=-1) const
bool | full () const CV_OVERRIDE
size_t | size () const
virtual void | sortAndCopy (int *indices, DistanceType *dist, int n_neighbors=-1) const
DistanceType | worstDist () const CV_OVERRIDE
Public Member Functions inherited from cvflann::ResultSet< DistanceType >
virtual | ~ResultSet ()
virtual void | addPoint (DistanceType dist, int index)=0

## Protected Attributes
std::set< DistIndex > | dist_indices_
bool | is_full_
DistanceType | worst_distance_

## Detailed Description

### template<typename DistanceType>
class cvflann::UniqueResultSet< DistanceType >

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

## Constructor & Destructor Documentation

## ◆ UniqueResultSet()

template<typename DistanceType >

cvflann::UniqueResultSet< DistanceType >::UniqueResultSet | ( |  | ) |
| inline

Default cosntructor

## Member Function Documentation

## ◆ clear()

template<typename DistanceType >

virtual void cvflann::UniqueResultSet< DistanceType >::clear | ( |  | ) |
| pure virtual

Remove all elements in the set

Implemented in cvflann::KNNRadiusUniqueResultSet< DistanceType >, cvflann::RadiusUniqueResultSet< DistanceType >, and cvflann::KNNUniqueResultSet< DistanceType >.

## ◆ copy()

template<typename DistanceType >

virtual void cvflann::UniqueResultSet< DistanceType >::copy | ( | int * | indices,
|  | DistanceType * | dist,
|  | int | n_neighbors = `-1`
| ) |  | const
| inlinevirtual

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

## ◆ full()

template<typename DistanceType >

bool cvflann::UniqueResultSet< DistanceType >::full | ( |  | ) | const
| inlinevirtual

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
| inline

The number of neighbors in the set

Returns

## ◆ sortAndCopy()

template<typename DistanceType >

virtual void cvflann::UniqueResultSet< DistanceType >::sortAndCopy | ( | int * | indices,
|  | DistanceType * | dist,
|  | int | n_neighbors = `-1`
| ) |  | const
| inlinevirtual

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

## ◆ worstDist()

template<typename DistanceType >

DistanceType cvflann::UniqueResultSet< DistanceType >::worstDist | ( |  | ) | const
| inlinevirtual

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

## ◆ dist_indices_

template<typename DistanceType >

std::set<DistIndex> cvflann::UniqueResultSet< DistanceType >::dist_indices_
| protected

The best candidates so far

## ◆ is_full_

template<typename DistanceType >

bool cvflann::UniqueResultSet< DistanceType >::is_full_
| protected

Flag to say if the set is full

## ◆ worst_distance_

template<typename DistanceType >

DistanceType cvflann::UniqueResultSet< DistanceType >::worst_distance_
| protected

The worst distance found so far

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

- flann/include/opencv2/flann/result_set.h