MRPT  2.0.2
List of all members | Public Types | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes
mrpt::vision::CFeatureList Class Reference

Detailed Description

A list of visual features, to be used as output by detectors, as input/output by trackers, etc.

Definition at line 275 of file CFeature.h.

#include <mrpt/vision/CFeature.h>

Inheritance diagram for mrpt::vision::CFeatureList:

Public Types

using self_t = KDTreeCapable< CFeatureList, float, nanoflann::L2_Simple_Adaptor< float, CFeatureList > >
 

Public Member Functions

TKeyPointMethod get_type () const
 The type of the first feature in the list. More...
 
void saveToTextFile (const std::string &fileName, bool APPEND=false)
 Save feature list to a text file. More...
 
void loadFromTextFile (const std::string &fileName)
 Save feature list to a text file. More...
 
void copyListFrom (const CFeatureList &otherList)
 Copies the content of another CFeatureList inside this one. More...
 
TFeatureID getMaxID () const
 Get the maximum ID into the list. More...
 
const CFeaturegetByID (const TFeatureID &ID) const
 Get a reference to a Feature from its ID. More...
 
const CFeaturegetByID (const TFeatureID &ID, int &out_idx) const
 
const CFeaturenearest (const float x, const float y, double &max_dist) const
 Get a reference to the nearest feature to the a given 2D point (version returning distance to closest feature in "max_dist") More...
 
 CFeatureList ()=default
 Constructor. More...
 
virtual ~CFeatureList ()
 Virtual destructor. More...
 
void mark_kdtree_as_outdated () const
 Call this when the list of features has been modified so the KD-tree is marked as outdated. More...
 
const CFeatureListderived () const
 CRTP helper method. More...
 
CFeatureListderived ()
 CRTP helper method. More...
 
Methods that MUST be implemented by children classes of

KDTreeCapable

size_t kdtree_get_point_count () const
 Must return the number of data points. More...
 
float kdtree_get_pt (const size_t idx, int dim) const
 Returns the dim'th component of the idx'th point in the class: More...
 
float kdtree_distance (const float *p1, const size_t idx_p2, [[maybe_unused]] 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: More...
 
template<typename BBOX >
bool kdtree_get_bbox ([[maybe_unused]] BBOX &bb) const
 
getFeature*() methods for template-based access to feature list
float getFeatureX (size_t i) const
 
float getFeatureY (size_t i) const
 
TFeatureID getFeatureID (size_t i) const
 
float getFeatureResponse (size_t i) const
 
bool isPointFeature (size_t i) const
 
float getScale (size_t i) const
 
TFeatureTrackStatus getTrackStatus (size_t i)
 
void setFeatureX (size_t i, float x)
 
void setFeatureXf (size_t i, float x)
 
void setFeatureY (size_t i, float y)
 
void setFeatureYf (size_t i, float y)
 
void setFeatureID (size_t i, TFeatureID id)
 
void setFeatureResponse (size_t i, float r)
 
void setScale (size_t i, uint8_t s)
 
void setTrackStatus (size_t i, TFeatureTrackStatus s)
 
void mark_as_outdated () const
 
Public utility methods to query the KD-tree
size_t kdTreeClosestPoint2D (float x0, float y0, float &out_x, float &out_y, float &out_dist_sqr) const
 KD Tree-based search for the closest point (only ONE) to some given 2D coordinates. More...
 
size_t kdTreeClosestPoint2D (float x0, float y0, float &out_dist_sqr) const
 
size_t kdTreeClosestPoint2D (const TPoint2D &p0, TPoint2D &pOut, float &outDistSqr) const
 
float kdTreeClosestPoint2DsqrError (float x0, float y0) const
 Like kdTreeClosestPoint2D, but just return the square error from some point to its closest neighbor. More...
 
float kdTreeClosestPoint2DsqrError (const TPoint2D &p0) const
 
void kdTreeTwoClosestPoint2D (float x0, float y0, float &out_x1, float &out_y1, float &out_x2, float &out_y2, float &out_dist_sqr1, float &out_dist_sqr2) const
 KD Tree-based search for the TWO closest point to some given 2D coordinates. More...
 
void kdTreeTwoClosestPoint2D (const TPoint2D &p0, TPoint2D &pOut1, TPoint2D &pOut2, float &outDistSqr1, float &outDistSqr2) const
 
std::vector< size_t > kdTreeNClosestPoint2D (float x0, float y0, size_t knn, std::vector< float > &out_x, std::vector< float > &out_y, std::vector< float > &out_dist_sqr) const
 KD Tree-based search for the N closest point to some given 2D coordinates. More...
 
std::vector< size_t > kdTreeNClosestPoint2D (const TPoint2D &p0, size_t N, std::vector< TPoint2D > &pOut, std::vector< float > &outDistSqr) const
 
void kdTreeNClosestPoint2DIdx (float x0, float y0, size_t knn, std::vector< size_t > &out_idx, std::vector< float > &out_dist_sqr) const
 KD Tree-based search for the N closest point to some given 2D coordinates and returns their indexes. More...
 
void kdTreeNClosestPoint2DIdx (const TPoint2D &p0, size_t N, std::vector< size_t > &outIdx, std::vector< float > &outDistSqr) const
 
size_t kdTreeClosestPoint3D (float x0, float y0, float z0, float &out_x, float &out_y, float &out_z, float &out_dist_sqr) const
 KD Tree-based search for the closest point (only ONE) to some given 3D coordinates. More...
 
size_t kdTreeClosestPoint3D (float x0, float y0, float z0, float &out_dist_sqr) const
 
size_t kdTreeClosestPoint3D (const TPoint3D &p0, TPoint3D &pOut, float &outDistSqr) const
 
void kdTreeNClosestPoint3D (float x0, float y0, float z0, size_t knn, std::vector< float > &out_x, std::vector< float > &out_y, std::vector< float > &out_z, std::vector< float > &out_dist_sqr) const
 KD Tree-based search for the N closest points to some given 3D coordinates. More...
 
void kdTreeNClosestPoint3D (const TPoint3D &p0, size_t N, std::vector< TPoint3D > &pOut, std::vector< float > &outDistSqr) const
 
void kdTreeNClosestPoint3DWithIdx (float x0, float y0, float z0, size_t knn, std::vector< float > &out_x, std::vector< float > &out_y, std::vector< float > &out_z, std::vector< size_t > &out_idx, std::vector< float > &out_dist_sqr) const
 KD Tree-based search for the N closest points to some given 3D coordinates. More...
 
size_t kdTreeRadiusSearch3D (const float x0, const float y0, const float z0, const float maxRadiusSqr, std::vector< std::pair< size_t, float >> &out_indices_dist) const
 KD Tree-based search for all the points within a given radius of some 3D point. More...
 
size_t kdTreeRadiusSearch2D (const float x0, const float y0, const float maxRadiusSqr, std::vector< std::pair< size_t, float >> &out_indices_dist) const
 KD Tree-based search for all the points within a given radius of some 2D point. More...
 
void kdTreeNClosestPoint3DIdx (float x0, float y0, float z0, size_t knn, std::vector< size_t > &out_idx, std::vector< float > &out_dist_sqr) const
 KD Tree-based search for the N closest point to some given 3D coordinates and returns their indexes. More...
 
void kdTreeNClosestPoint3DIdx (const TPoint3D &p0, size_t N, std::vector< size_t > &outIdx, std::vector< float > &outDistSqr) const
 
void kdTreeEnsureIndexBuilt3D ()
 
void kdTreeEnsureIndexBuilt2D ()
 

Public Attributes

TKDTreeSearchParams kdtree_search_params
 Parameters to tune the ANN searches. More...
 

Protected Types

using TInternalFeatList = std::vector< CFeature >
 

Protected Member Functions

void kdtree_mark_as_outdated () const
 To be called by child classes when KD tree data changes. More...
 

Protected Attributes

TInternalFeatList m_feats
 The actual container with the list of features. More...
 

Method and datatypes to emulate a STL container

using iterator = TInternalFeatList::iterator
 
using const_iterator = TInternalFeatList::const_iterator
 
using reverse_iterator = TInternalFeatList::reverse_iterator
 
using const_reverse_iterator = TInternalFeatList::const_reverse_iterator
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
iterator erase (const iterator &it)
 
bool empty () const
 
size_t size () const
 
void clear ()
 
void resize (size_t N)
 
void emplace_back (CFeature &&f)
 
void push_back (const CFeature &f)
 
CFeatureoperator[] (const unsigned int index)
 
const CFeatureoperator[] (const unsigned int index) const
 

Member Typedef Documentation

◆ const_iterator

using mrpt::vision::CFeatureList::const_iterator = TInternalFeatList::const_iterator

Definition at line 332 of file CFeature.h.

◆ const_reverse_iterator

using mrpt::vision::CFeatureList::const_reverse_iterator = TInternalFeatList::const_reverse_iterator

Definition at line 335 of file CFeature.h.

◆ iterator

using mrpt::vision::CFeatureList::iterator = TInternalFeatList::iterator

Definition at line 331 of file CFeature.h.

◆ reverse_iterator

using mrpt::vision::CFeatureList::reverse_iterator = TInternalFeatList::reverse_iterator

Definition at line 334 of file CFeature.h.

◆ self_t

Definition at line 87 of file KDTreeCapable.h.

◆ TInternalFeatList

Definition at line 278 of file CFeature.h.

Constructor & Destructor Documentation

◆ CFeatureList()

mrpt::vision::CFeatureList::CFeatureList ( )
default

Constructor.

◆ ~CFeatureList()

CFeatureList::~CFeatureList ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ begin() [1/2]

iterator mrpt::vision::CFeatureList::begin ( )
inline

Definition at line 337 of file CFeature.h.

References m_feats.

Referenced by copyListFrom(), get_type(), mrpt::maps::CLandmarksMap::loadSiftFeaturesFromImageObservation(), mrpt::vision::matchFeatures(), mrpt::vision::projectMatchedFeatures(), and mrpt::vision::detail::trackFeatures_deleteOOB().

Here is the caller graph for this function:

◆ begin() [2/2]

const_iterator mrpt::vision::CFeatureList::begin ( ) const
inline

Definition at line 339 of file CFeature.h.

References m_feats.

◆ clear()

void mrpt::vision::CFeatureList::clear ( )
inline

Definition at line 353 of file CFeature.h.

References m_feats, and mark_kdtree_as_outdated().

Referenced by mrpt::vision::CFeatureExtraction::extractFeaturesAKAZE(), mrpt::vision::CFeatureExtraction::extractFeaturesFAST(), mrpt::vision::CFeatureExtraction::extractFeaturesKLT(), mrpt::vision::CFeatureExtraction::extractFeaturesLSD(), mrpt::vision::CFeatureExtraction::extractFeaturesORB(), mrpt::vision::CFeatureExtraction::extractFeaturesSIFT(), and mrpt::vision::CFeatureExtraction::extractFeaturesSURF().

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

◆ copyListFrom()

void CFeatureList::copyListFrom ( const CFeatureList otherList)

Copies the content of another CFeatureList inside this one.

The inner features are also copied.

Definition at line 1074 of file CFeature.cpp.

References mrpt::containers::begin(), begin(), end(), resize(), and size().

Here is the call graph for this function:

◆ derived() [1/2]

const CFeatureList & mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::derived ( ) const
inlineinherited

CRTP helper method.

Definition at line 100 of file KDTreeCapable.h.

◆ derived() [2/2]

CFeatureList & mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::derived ( )
inlineinherited

CRTP helper method.

Definition at line 105 of file KDTreeCapable.h.

◆ emplace_back()

void mrpt::vision::CFeatureList::emplace_back ( CFeature &&  f)
inline

Definition at line 364 of file CFeature.h.

References m_feats, and mark_kdtree_as_outdated().

Referenced by mrpt::vision::CFeatureExtraction::extractFeaturesAKAZE(), mrpt::vision::CFeatureExtraction::extractFeaturesFAST(), mrpt::vision::CFeatureExtraction::extractFeaturesKLT(), mrpt::vision::CFeatureExtraction::extractFeaturesLSD(), mrpt::vision::CFeatureExtraction::extractFeaturesORB(), and mrpt::vision::CFeatureExtraction::extractFeaturesSURF().

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

◆ empty()

bool mrpt::vision::CFeatureList::empty ( ) const
inline

◆ end() [1/2]

iterator mrpt::vision::CFeatureList::end ( )
inline

Definition at line 338 of file CFeature.h.

References m_feats.

Referenced by copyListFrom(), mrpt::maps::CLandmarksMap::loadSiftFeaturesFromImageObservation(), mrpt::vision::matchFeatures(), mrpt::vision::projectMatchedFeatures(), and mrpt::vision::detail::trackFeatures_deleteOOB().

Here is the caller graph for this function:

◆ end() [2/2]

const_iterator mrpt::vision::CFeatureList::end ( ) const
inline

Definition at line 340 of file CFeature.h.

References m_feats.

◆ erase()

iterator mrpt::vision::CFeatureList::erase ( const iterator it)
inline

Definition at line 345 of file CFeature.h.

References m_feats, and mark_kdtree_as_outdated().

Referenced by mrpt::vision::projectMatchedFeatures(), and mrpt::vision::detail::trackFeatures_deleteOOB().

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

◆ get_type()

TKeyPointMethod mrpt::vision::CFeatureList::get_type ( ) const
inline

The type of the first feature in the list.

Definition at line 285 of file CFeature.h.

References begin(), empty(), and mrpt::vision::featNotDefined.

Referenced by mrpt::vision::matchFeatures().

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

◆ getByID() [1/2]

const CFeature * CFeatureList::getByID ( const TFeatureID ID) const

Get a reference to a Feature from its ID.

Definition at line 1086 of file CFeature.cpp.

◆ getByID() [2/2]

const CFeature * CFeatureList::getByID ( const TFeatureID ID,
int &  out_idx 
) const

Definition at line 1094 of file CFeature.cpp.

References mrpt::containers::begin(), and mrpt::containers::end().

Here is the call graph for this function:

◆ getFeatureID()

TFeatureID mrpt::vision::CFeatureList::getFeatureID ( size_t  i) const
inline

Definition at line 439 of file CFeature.h.

References m_feats.

◆ getFeatureResponse()

float mrpt::vision::CFeatureList::getFeatureResponse ( size_t  i) const
inline

Definition at line 443 of file CFeature.h.

References m_feats.

◆ getFeatureX()

float mrpt::vision::CFeatureList::getFeatureX ( size_t  i) const
inline

Definition at line 431 of file CFeature.h.

References m_feats.

◆ getFeatureY()

float mrpt::vision::CFeatureList::getFeatureY ( size_t  i) const
inline

Definition at line 435 of file CFeature.h.

References m_feats.

◆ getMaxID()

TFeatureID CFeatureList::getMaxID ( ) const

Get the maximum ID into the list.

Definition at line 1135 of file CFeature.cpp.

References ASSERT_, mrpt::containers::begin(), mrpt::containers::empty(), mrpt::keep_max(), MRPT_END, and MRPT_START.

Here is the call graph for this function:

◆ getScale()

float mrpt::vision::CFeatureList::getScale ( size_t  i) const
inline

Definition at line 451 of file CFeature.h.

References m_feats.

◆ getTrackStatus()

TFeatureTrackStatus mrpt::vision::CFeatureList::getTrackStatus ( size_t  i)
inline

Definition at line 452 of file CFeature.h.

References m_feats.

◆ isPointFeature()

bool mrpt::vision::CFeatureList::isPointFeature ( size_t  i) const
inline

Definition at line 447 of file CFeature.h.

References m_feats.

◆ kdtree_distance()

float mrpt::vision::CFeatureList::kdtree_distance ( const float *  p1,
const size_t  idx_p2,
[[maybe_unused] ] size_t  size 
) const
inline

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

Definition at line 404 of file CFeature.h.

References ASSERTDEB_, m_feats, and size().

Here is the call graph for this function:

◆ kdtree_get_bbox()

template<typename BBOX >
bool mrpt::vision::CFeatureList::kdtree_get_bbox ( [[maybe_unused] ] BBOX &  bb) const
inline

Definition at line 422 of file CFeature.h.

◆ kdtree_get_point_count()

size_t mrpt::vision::CFeatureList::kdtree_get_point_count ( ) const
inline

Must return the number of data points.

Definition at line 391 of file CFeature.h.

References size().

Here is the call graph for this function:

◆ kdtree_get_pt()

float mrpt::vision::CFeatureList::kdtree_get_pt ( const size_t  idx,
int  dim 
) const
inline

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

Definition at line 393 of file CFeature.h.

References ASSERTDEB_, and m_feats.

◆ kdtree_mark_as_outdated()

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdtree_mark_as_outdated ( ) const
inlineprotectedinherited

◆ kdTreeClosestPoint2D() [1/3]

size_t mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeClosestPoint2D ( float  x0,
float  y0,
float &  out_x,
float &  out_y,
float &  out_dist_sqr 
) const
inlineinherited

KD Tree-based search for the closest point (only ONE) to some given 2D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 3D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
out_xThe X coordinate of the found closest correspondence.
out_yThe Y coordinate of the found closest correspondence.
out_dist_sqrThe square distance between the query and the returned point.
Returns
The index of the closest point in the map array.
See also
kdTreeClosestPoint3D, kdTreeTwoClosestPoint2D

Definition at line 136 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::derived(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::index, nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::init(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree2d_data, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::m_num_points, MRPT_END, MRPT_START, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_2D(), and THROW_EXCEPTION.

◆ kdTreeClosestPoint2D() [2/3]

size_t mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeClosestPoint2D ( float  x0,
float  y0,
float &  out_dist_sqr 
) const
inlineinherited

◆ kdTreeClosestPoint2D() [3/3]

size_t mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeClosestPoint2D ( const TPoint2D p0,
TPoint2D pOut,
float &  outDistSqr 
) const
inlineinherited

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 185 of file KDTreeCapable.h.

References mrpt::d2f(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint2D(), mrpt::math::TPoint2D_data< T >::x, and mrpt::math::TPoint2D_data< T >::y.

◆ kdTreeClosestPoint2DsqrError() [1/2]

float mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeClosestPoint2DsqrError ( float  x0,
float  y0 
) const
inlineinherited

Like kdTreeClosestPoint2D, but just return the square error from some point to its closest neighbor.

Definition at line 199 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint2D().

◆ kdTreeClosestPoint2DsqrError() [2/2]

float mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeClosestPoint2DsqrError ( const TPoint2D p0) const
inlineinherited

◆ kdTreeClosestPoint3D() [1/3]

size_t mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeClosestPoint3D ( float  x0,
float  y0,
float  z0,
float &  out_x,
float &  out_y,
float &  out_z,
float &  out_dist_sqr 
) const
inlineinherited

KD Tree-based search for the closest point (only ONE) to some given 3D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 2D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
z0The Z coordinate of the query.
out_xThe X coordinate of the found closest correspondence.
out_yThe Y coordinate of the found closest correspondence.
out_zThe Z coordinate of the found closest correspondence.
out_dist_sqrThe square distance between the query and the returned point.
Returns
The index of the closest point in the map array.
See also
kdTreeClosestPoint2D

Definition at line 405 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::derived(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::index, nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::init(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree3d_data, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::m_num_points, MRPT_END, MRPT_START, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_3D(), and THROW_EXCEPTION.

◆ kdTreeClosestPoint3D() [2/3]

size_t mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeClosestPoint3D ( float  x0,
float  y0,
float  z0,
float &  out_dist_sqr 
) const
inlineinherited

◆ kdTreeClosestPoint3D() [3/3]

size_t mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeClosestPoint3D ( const TPoint3D p0,
TPoint3D pOut,
float &  outDistSqr 
) const
inlineinherited

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 455 of file KDTreeCapable.h.

References mrpt::d2f(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint3D(), mrpt::math::TPoint3D_data< T >::x, mrpt::math::TPoint3D_data< T >::y, and mrpt::math::TPoint3D_data< T >::z.

◆ kdTreeEnsureIndexBuilt2D()

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeEnsureIndexBuilt2D ( )
inlineinherited

◆ kdTreeEnsureIndexBuilt3D()

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeEnsureIndexBuilt3D ( )
inlineinherited

◆ kdTreeNClosestPoint2D() [1/2]

std::vector<size_t> mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeNClosestPoint2D ( float  x0,
float  y0,
size_t  knn,
std::vector< float > &  out_x,
std::vector< float > &  out_y,
std::vector< float > &  out_dist_sqr 
) const
inlineinherited

KD Tree-based search for the N closest point to some given 2D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 3D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
NThe number of closest points to search.
out_xThe vector containing the X coordinates of the correspondences.
out_yThe vector containing the Y coordinates of the correspondences.
out_dist_sqrThe vector containing the square distance between the query and the returned points.
Returns
The list of indices
See also
kdTreeClosestPoint2D
kdTreeTwoClosestPoint2D

Definition at line 296 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::derived(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::index, nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::init(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree2d_data, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::m_num_points, MRPT_END, MRPT_START, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_2D(), and THROW_EXCEPTION.

◆ kdTreeNClosestPoint2D() [2/2]

std::vector<size_t> mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeNClosestPoint2D ( const TPoint2D p0,
size_t  N,
std::vector< TPoint2D > &  pOut,
std::vector< float > &  outDistSqr 
) const
inlineinherited

◆ kdTreeNClosestPoint2DIdx() [1/2]

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeNClosestPoint2DIdx ( float  x0,
float  y0,
size_t  knn,
std::vector< size_t > &  out_idx,
std::vector< float > &  out_dist_sqr 
) const
inlineinherited

KD Tree-based search for the N closest point to some given 2D coordinates and returns their indexes.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 3D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
NThe number of closest points to search.
out_idxThe indexes of the found closest correspondence.
out_dist_sqrThe square distance between the query and the returned point.
See also
kdTreeClosestPoint2D

Definition at line 358 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::index, nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::init(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree2d_data, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::m_num_points, MRPT_END, MRPT_START, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_2D(), and THROW_EXCEPTION.

◆ kdTreeNClosestPoint2DIdx() [2/2]

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeNClosestPoint2DIdx ( const TPoint2D p0,
size_t  N,
std::vector< size_t > &  outIdx,
std::vector< float > &  outDistSqr 
) const
inlineinherited

◆ kdTreeNClosestPoint3D() [1/2]

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeNClosestPoint3D ( float  x0,
float  y0,
float  z0,
size_t  knn,
std::vector< float > &  out_x,
std::vector< float > &  out_y,
std::vector< float > &  out_z,
std::vector< float > &  out_dist_sqr 
) const
inlineinherited

KD Tree-based search for the N closest points to some given 3D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 2D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
z0The Z coordinate of the query.
NThe number of closest points to search.
out_xThe vector containing the X coordinates of the correspondences.
out_yThe vector containing the Y coordinates of the correspondences.
out_zThe vector containing the Z coordinates of the correspondences.
out_dist_sqrThe vector containing the square distance between the query and the returned points.
See also
kdTreeNClosestPoint2D

Definition at line 489 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::derived(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::index, nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::init(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree3d_data, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::m_num_points, MRPT_END, MRPT_START, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_3D(), and THROW_EXCEPTION.

◆ kdTreeNClosestPoint3D() [2/2]

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeNClosestPoint3D ( const TPoint3D p0,
size_t  N,
std::vector< TPoint3D > &  pOut,
std::vector< float > &  outDistSqr 
) const
inlineinherited

◆ kdTreeNClosestPoint3DIdx() [1/2]

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeNClosestPoint3DIdx ( float  x0,
float  y0,
float  z0,
size_t  knn,
std::vector< size_t > &  out_idx,
std::vector< float > &  out_dist_sqr 
) const
inlineinherited

KD Tree-based search for the N closest point to some given 3D coordinates and returns their indexes.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 2D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
z0The Z coordinate of the query.
NThe number of closest points to search.
out_idxThe indexes of the found closest correspondence.
out_dist_sqrThe square distance between the query and the returned point.
See also
kdTreeClosestPoint2D, kdTreeRadiusSearch3D

Definition at line 679 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::index, nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::init(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree3d_data, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::m_num_points, MRPT_END, MRPT_START, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_3D(), and THROW_EXCEPTION.

◆ kdTreeNClosestPoint3DIdx() [2/2]

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeNClosestPoint3DIdx ( const TPoint3D p0,
size_t  N,
std::vector< size_t > &  outIdx,
std::vector< float > &  outDistSqr 
) const
inlineinherited

◆ kdTreeNClosestPoint3DWithIdx()

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeNClosestPoint3DWithIdx ( float  x0,
float  y0,
float  z0,
size_t  knn,
std::vector< float > &  out_x,
std::vector< float > &  out_y,
std::vector< float > &  out_z,
std::vector< size_t > &  out_idx,
std::vector< float > &  out_dist_sqr 
) const
inlineinherited

KD Tree-based search for the N closest points to some given 3D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 2D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
z0The Z coordinate of the query.
NThe number of closest points to search.
out_xThe vector containing the X coordinates of the correspondences.
out_yThe vector containing the Y coordinates of the correspondences.
out_zThe vector containing the Z coordinates of the correspondences.
out_idxThe vector containing the indexes of the correspondences.
out_dist_sqrThe vector containing the square distance between the query and the returned points.
See also
kdTreeNClosestPoint2D

Definition at line 544 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::derived(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::index, nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::init(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree3d_data, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::m_num_points, MRPT_END, MRPT_START, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_3D(), and THROW_EXCEPTION.

◆ kdTreeRadiusSearch2D()

size_t mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeRadiusSearch2D ( const float  x0,
const float  y0,
const float  maxRadiusSqr,
std::vector< std::pair< size_t, float >> &  out_indices_dist 
) const
inlineinherited

KD Tree-based search for all the points within a given radius of some 2D point.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 3D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
maxRadiusSqrThe square of the desired search radius.
out_indices_distThe output list, with pairs of indeces/squared distances for the found correspondences.
Returns
Number of found points.
See also
kdTreeRadiusSearch3D, kdTreeNClosestPoint2DIdx

Definition at line 644 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::index, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree2d_data, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::m_num_points, MRPT_END, MRPT_START, and mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_2D().

◆ kdTreeRadiusSearch3D()

size_t mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeRadiusSearch3D ( const float  x0,
const float  y0,
const float  z0,
const float  maxRadiusSqr,
std::vector< std::pair< size_t, float >> &  out_indices_dist 
) const
inlineinherited

KD Tree-based search for all the points within a given radius of some 3D point.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 2D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
z0The Z coordinate of the query.
maxRadiusSqrThe square of the desired search radius.
out_indices_distThe output list, with pairs of indeces/squared distances for the found correspondences.
Returns
Number of found points.
See also
kdTreeRadiusSearch2D, kdTreeNClosestPoint3DIdx

Definition at line 609 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::index, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree3d_data, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::m_num_points, MRPT_END, MRPT_START, and mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_3D().

◆ kdTreeTwoClosestPoint2D() [1/2]

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeTwoClosestPoint2D ( float  x0,
float  y0,
float &  out_x1,
float &  out_y1,
float &  out_x2,
float &  out_y2,
float &  out_dist_sqr1,
float &  out_dist_sqr2 
) const
inlineinherited

KD Tree-based search for the TWO closest point to some given 2D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 3D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
out_x1The X coordinate of the first correspondence.
out_y1The Y coordinate of the first correspondence.
out_x2The X coordinate of the second correspondence.
out_y2The Y coordinate of the second correspondence.
out_dist_sqr1The square distance between the query and the first returned point.
out_dist_sqr2The square distance between the query and the second returned point.
See also
kdTreeClosestPoint2D

Definition at line 231 of file KDTreeCapable.h.

References mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::derived(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::index, nanoflann::KNNResultSet< DistanceType, IndexType, CountType >::init(), mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree2d_data, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::TKDTreeDataHolder< _DIM >::m_num_points, MRPT_END, MRPT_START, mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_2D(), and THROW_EXCEPTION.

◆ kdTreeTwoClosestPoint2D() [2/2]

void mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdTreeTwoClosestPoint2D ( const TPoint2D p0,
TPoint2D pOut1,
TPoint2D pOut2,
float &  outDistSqr1,
float &  outDistSqr2 
) const
inlineinherited

◆ loadFromTextFile()

void CFeatureList::loadFromTextFile ( const std::string &  fileName)

◆ mark_as_outdated()

void mrpt::vision::CFeatureList::mark_as_outdated ( ) const
inline

Definition at line 484 of file CFeature.h.

References mrpt::math::KDTreeCapable< CFeatureList >::kdtree_mark_as_outdated().

Here is the call graph for this function:

◆ mark_kdtree_as_outdated()

void mrpt::vision::CFeatureList::mark_kdtree_as_outdated ( ) const
inline

Call this when the list of features has been modified so the KD-tree is marked as outdated.

Definition at line 328 of file CFeature.h.

References mrpt::math::KDTreeCapable< CFeatureList >::kdtree_mark_as_outdated().

Referenced by clear(), emplace_back(), erase(), push_back(), and resize().

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

◆ nearest()

const CFeature * CFeatureList::nearest ( const float  x,
const float  y,
double &  max_dist 
) const

Get a reference to the nearest feature to the a given 2D point (version returning distance to closest feature in "max_dist")

Parameters
x[IN] The query point x-coordinate
y[IN] The query point y-coordinate
max_dist[IN/OUT] At input: The maximum distance to search for. At output: The actual distance to the feature.
Returns
A pointer to the found feature, or nullptr if not found.
Note
See also all the available KD-tree search methods, listed in mrpt::math::KDTreeCapable

Definition at line 1110 of file CFeature.cpp.

References mrpt::containers::empty().

Here is the call graph for this function:

◆ operator[]() [1/2]

CFeature& mrpt::vision::CFeatureList::operator[] ( const unsigned int  index)
inline

Definition at line 375 of file CFeature.h.

References m_feats.

◆ operator[]() [2/2]

const CFeature& mrpt::vision::CFeatureList::operator[] ( const unsigned int  index) const
inline

Definition at line 379 of file CFeature.h.

References m_feats.

◆ push_back()

void mrpt::vision::CFeatureList::push_back ( const CFeature f)
inline

Definition at line 369 of file CFeature.h.

References m_feats, and mark_kdtree_as_outdated().

Referenced by mrpt::vision::CFeatureExtraction::extractFeaturesSIFT().

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

◆ rbegin() [1/2]

reverse_iterator mrpt::vision::CFeatureList::rbegin ( )
inline

Definition at line 341 of file CFeature.h.

References m_feats.

◆ rbegin() [2/2]

const_reverse_iterator mrpt::vision::CFeatureList::rbegin ( ) const
inline

Definition at line 343 of file CFeature.h.

References m_feats.

◆ rend() [1/2]

reverse_iterator mrpt::vision::CFeatureList::rend ( )
inline

Definition at line 342 of file CFeature.h.

References m_feats.

◆ rend() [2/2]

const_reverse_iterator mrpt::vision::CFeatureList::rend ( ) const
inline

Definition at line 344 of file CFeature.h.

References m_feats.

◆ resize()

void mrpt::vision::CFeatureList::resize ( size_t  N)
inline

Definition at line 358 of file CFeature.h.

References m_feats, and mark_kdtree_as_outdated().

Referenced by mrpt::vision::CFeatureExtraction::extractFeaturesORB(), mrpt::vision::CFeatureExtraction::extractFeaturesSIFT(), mrpt::vision::CMatchedFeatureList::getBothFeatureLists(), and mrpt::vision::CFeatureExtraction::internal_computeORBDescriptors().

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

◆ saveToTextFile()

void CFeatureList::saveToTextFile ( const std::string &  fileName,
bool  APPEND = false 
)

Save feature list to a text file.

Definition at line 881 of file CFeature.cpp.

References MRPT_END, MRPT_START, and THROW_EXCEPTION.

◆ setFeatureID()

void mrpt::vision::CFeatureList::setFeatureID ( size_t  i,
TFeatureID  id 
)
inline

Definition at line 467 of file CFeature.h.

References m_feats.

◆ setFeatureResponse()

void mrpt::vision::CFeatureList::setFeatureResponse ( size_t  i,
float  r 
)
inline

Definition at line 471 of file CFeature.h.

References m_feats.

◆ setFeatureX()

void mrpt::vision::CFeatureList::setFeatureX ( size_t  i,
float  x 
)
inline

Definition at line 457 of file CFeature.h.

References m_feats.

◆ setFeatureXf()

void mrpt::vision::CFeatureList::setFeatureXf ( size_t  i,
float  x 
)
inline

Definition at line 458 of file CFeature.h.

References m_feats.

◆ setFeatureY()

void mrpt::vision::CFeatureList::setFeatureY ( size_t  i,
float  y 
)
inline

Definition at line 462 of file CFeature.h.

References m_feats.

◆ setFeatureYf()

void mrpt::vision::CFeatureList::setFeatureYf ( size_t  i,
float  y 
)
inline

Definition at line 463 of file CFeature.h.

References m_feats.

◆ setScale()

void mrpt::vision::CFeatureList::setScale ( size_t  i,
uint8_t  s 
)
inline

Definition at line 475 of file CFeature.h.

References m_feats.

◆ setTrackStatus()

void mrpt::vision::CFeatureList::setTrackStatus ( size_t  i,
TFeatureTrackStatus  s 
)
inline

Definition at line 479 of file CFeature.h.

References m_feats.

◆ size()

size_t mrpt::vision::CFeatureList::size ( ) const
inline

Member Data Documentation

◆ kdtree_search_params

TKDTreeSearchParams mrpt::math::KDTreeCapable< CFeatureList , float , nanoflann::L2_Simple_Adaptor<float , CFeatureList > >::kdtree_search_params
inherited

Parameters to tune the ANN searches.

Definition at line 114 of file KDTreeCapable.h.

◆ m_feats

TInternalFeatList mrpt::vision::CFeatureList::m_feats
protected



Page generated by Doxygen 1.8.14 for MRPT 2.0.2 Git: 9b4fd2465 Mon May 4 16:59:08 2020 +0200 at lun may 4 17:26:07 CEST 2020