template class cvflann::KNNUniqueResultSet

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 KNNUniqueResultSet: public cvflann::UniqueResultSet
{
public:
    // construction

    KNNUniqueResultSet(unsigned int capacity);

    // methods

    virtual
    void
    addPoint(
        DistanceType dist,
        int index
        );

    virtual
    void
    clear();

protected:
    // typedefs

    typedef UniqueResultSet<DistanceType>::DistIndex DistIndex;

    // fields

    unsigned int capacity_;
};

// direct descendants

template <typename DistanceType>
class KNNRadiusUniqueResultSet;

Inherited Members

public:
    // structs

    struct DistIndex;

    // methods

    virtual
    void
    addPoint(
        DistanceType dist,
        int index
        ) = 0;

    virtual
    bool
    full() const = 0;

    virtual
    DistanceType
    worstDist() const = 0;

    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_;

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

unsigned int capacity_

The number of neighbors to keep

Construction

KNNUniqueResultSet(unsigned int capacity)

Constructor

Parameters:

capacity the number of neighbors to store at max

Methods

virtual
void
addPoint(
    DistanceType dist,
    int index
    )

Add a possible candidate to the best neighbors

Parameters:

dist distance for that neighbor
index index of that neighbor
virtual
void
clear()

Remove all elements in the set