template class mrpt::vision::CFeatureListKDTree

Helper class: KD-tree search class for vector<KeyPoint>: Call mark_as_outdated() to force rebuilding the kd-tree after modifying the linked feature list.

Parameters:

FEAT

Can be cv::KeyPoint or mrpt::vision::TKeyPoint

#include <mrpt/vision/TKeyPoint.h>

template <typename FEAT>
class CFeatureListKDTree: public mrpt::math::KDTreeCapable
{
public:
    //
fields

    const std::vector<FEAT>& m_data;

    // construction

    CFeatureListKDTree(const std::vector<FEAT>& data);

    //
methods

    size_t kdtree_get_point_count() const;
    float kdtree_get_pt(const size_t idx, int dim) const;
    float kdtree_distance(const float* p1, const size_t idx_p2, ] size_t size) const;

    template <typename BBOX>
    bool kdtree_get_bbox(] BBOX& bb) const;

    void mark_as_outdated();
};

Inherited Members

public:
    // typedefs

    typedef KDTreeCapable<Derived, num_t, metric_t> self_t;

    // structs

    template <int _DIM = -1>
    struct TKDTreeDataHolder;

    struct TKDTreeSearchParams;

    //
methods

    float kdTreeClosestPoint2DsqrError(const TPoint2D& p0) const;
    void kdTreeTwoClosestPoint2D(const TPoint2D& p0, TPoint2D& pOut1, TPoint2D& pOut2, float& outDistSqr1, float& outDistSqr2) const;

    std::vector<size_t> kdTreeNClosestPoint2D(
        const TPoint2D& p0,
        size_t N,
        std::vector<TPoint2D>& pOut,
        std::vector<float>& outDistSqr
        ) const;

    void kdTreeNClosestPoint2DIdx(
        const TPoint2D& p0,
        size_t N,
        std::vector<size_t>& outIdx,
        std::vector<float>& outDistSqr
        ) const;

    void kdTreeNClosestPoint3D(const TPoint3D& p0, size_t N, std::vector<TPoint3D>& pOut, std::vector<float>& outDistSqr) const;

    void kdTreeNClosestPoint3DIdx(
        const TPoint3D& p0,
        size_t N,
        std::vector<size_t>& outIdx,
        std::vector<float>& outDistSqr
        ) const;

    void kdTreeEnsureIndexBuilt3D();
    void kdTreeEnsureIndexBuilt2D();
    KDTreeCapable& operator = (const KDTreeCapable&);

Methods

size_t kdtree_get_point_count() const

Must return the number of data points.

float kdtree_get_pt(const size_t idx, int dim) const

Returns the dim’th component of the idx’th point in the class:

float kdtree_distance(const float* p1, const size_t idx_p2, ] size_t size) const

Returns the distance between the vector “p1[0:size-1]” and the data point with index “idx_p2” stored in the class: