Main MRPT website > C++ reference
MRPT logo
Public Types | Public Member Functions | Public Attributes | Protected Member Functions
mrpt::vision::CFeatureListKDTree Class Reference

Detailed Description

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.

Template Parameters:
FEATCan be cv::KeyPoint or mrpt::vision::TSimpleFeature

#include <mrpt/vision/TSimpleFeature.h>

Inheritance diagram for mrpt::vision::CFeatureListKDTree:
Inheritance graph
[legend]

List of all members.

Public Types

typedef KDTreeCapable< Derived,
num_t, metric_t > 
self_t

Public Member Functions

void mark_as_outdated ()
 CFeatureListKDTree (const std::vector< FEAT > &data)
const Derived & derived () const
 CRTP helper method.
Derived & derived ()
 CRTP helper method.
Methods that MUST be implemented by children classes of KDTreeCapable
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:
template<typename BBOX >
bool kdtree_get_bbox (BBOX &bb) 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.
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.
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.
void kdTreeTwoClosestPoint2D (const TPoint2D &p0, TPoint2D &pOut1, TPoint2D &pOut2, float &outDistSqr1, float &outDistSqr2) const
std::vector< int > 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.
std::vector< int > 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< int > &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.
void kdTreeNClosestPoint2DIdx (const TPoint2D &p0, size_t N, std::vector< int > &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.
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.
void kdTreeNClosestPoint3D (const TPoint3D &p0, size_t N, std::vector< TPoint3D > &pOut, std::vector< float > &outDistSqr) const
void kdTreeNClosestPoint3DIdx (float x0, float y0, float z0, size_t knn, std::vector< int > &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.
void kdTreeNClosestPoint3DIdx (const TPoint3D &p0, size_t N, std::vector< int > &outIdx, std::vector< float > &outDistSqr) const

Public Attributes

const std::vector< FEAT > & m_data
TKDTreeSearchParams kdtree_search_params
 Parameters to tune the ANN searches.

Protected Member Functions

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

Member Typedef Documentation

typedef KDTreeCapable<Derived,num_t,metric_t> mrpt::math::KDTreeCapable::self_t [inherited]

Definition at line 90 of file KDTreeCapable.h.


Constructor & Destructor Documentation

mrpt::vision::CFeatureListKDTree::CFeatureListKDTree ( const std::vector< FEAT > &  data) [inline]

Definition at line 236 of file TSimpleFeature.h.


Member Function Documentation

const Derived& mrpt::math::KDTreeCapable::derived ( ) const [inline, inherited]

CRTP helper method.

Definition at line 100 of file KDTreeCapable.h.

Derived& mrpt::math::KDTreeCapable::derived ( ) [inline, inherited]

CRTP helper method.

Definition at line 102 of file KDTreeCapable.h.

float mrpt::vision::CFeatureListKDTree::kdtree_distance ( const float *  p1,
const size_t  idx_p2,
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 253 of file TSimpleFeature.h.

References ASSERTDEB_, and m_data.

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

Definition at line 266 of file TSimpleFeature.h.

size_t mrpt::vision::CFeatureListKDTree::kdtree_get_point_count ( ) const [inline]

Must return the number of data points.

Definition at line 243 of file TSimpleFeature.h.

References m_data.

float mrpt::vision::CFeatureListKDTree::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 246 of file TSimpleFeature.h.

References ASSERTDEB_, and m_data.

void mrpt::math::KDTreeCapable::kdtree_mark_as_outdated ( ) const [inline, protected, inherited]

To be called by child classes when KD tree data changes.

Definition at line 575 of file KDTreeCapable.h.

Referenced by mark_as_outdated().

size_t mrpt::math::KDTreeCapable::kdTreeClosestPoint2D ( float  x0,
float  y0,
float &  out_x,
float &  out_y,
float &  out_dist_sqr 
) const [inline, inherited]

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.

size_t mrpt::math::KDTreeCapable::kdTreeClosestPoint2D ( float  x0,
float  y0,
float &  out_dist_sqr 
) const [inline, inherited]

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 166 of file KDTreeCapable.h.

size_t mrpt::math::KDTreeCapable::kdTreeClosestPoint2D ( const TPoint2D p0,
TPoint2D pOut,
float &  outDistSqr 
) const [inline, inherited]

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 189 of file KDTreeCapable.h.

float mrpt::math::KDTreeCapable::kdTreeClosestPoint2DsqrError ( float  x0,
float  y0 
) const [inline, inherited]

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

Definition at line 199 of file KDTreeCapable.h.

float mrpt::math::KDTreeCapable::kdTreeClosestPoint2DsqrError ( const TPoint2D p0) const [inline, inherited]

Definition at line 208 of file KDTreeCapable.h.

size_t mrpt::math::KDTreeCapable::kdTreeClosestPoint3D ( float  x0,
float  y0,
float  z0,
float &  out_x,
float &  out_y,
float &  out_z,
float &  out_dist_sqr 
) const [inline, inherited]

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 394 of file KDTreeCapable.h.

size_t mrpt::math::KDTreeCapable::kdTreeClosestPoint3D ( float  x0,
float  y0,
float  z0,
float &  out_dist_sqr 
) const [inline, inherited]

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 428 of file KDTreeCapable.h.

size_t mrpt::math::KDTreeCapable::kdTreeClosestPoint3D ( const TPoint3D p0,
TPoint3D pOut,
float &  outDistSqr 
) const [inline, inherited]

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 454 of file KDTreeCapable.h.

std::vector<int> mrpt::math::KDTreeCapable::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 [inline, inherited]

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 293 of file KDTreeCapable.h.

std::vector<int> mrpt::math::KDTreeCapable::kdTreeNClosestPoint2D ( const TPoint2D p0,
size_t  N,
std::vector< TPoint2D > &  pOut,
std::vector< float > &  outDistSqr 
) const [inline, inherited]

Definition at line 326 of file KDTreeCapable.h.

void mrpt::math::KDTreeCapable::kdTreeNClosestPoint2DIdx ( float  x0,
float  y0,
size_t  knn,
std::vector< int > &  out_idx,
std::vector< float > &  out_dist_sqr 
) const [inline, inherited]

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 351 of file KDTreeCapable.h.

void mrpt::math::KDTreeCapable::kdTreeNClosestPoint2DIdx ( const TPoint2D p0,
size_t  N,
std::vector< int > &  outIdx,
std::vector< float > &  outDistSqr 
) const [inline, inherited]

Definition at line 373 of file KDTreeCapable.h.

void mrpt::math::KDTreeCapable::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 [inline, inherited]

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 480 of file KDTreeCapable.h.

void mrpt::math::KDTreeCapable::kdTreeNClosestPoint3D ( const TPoint3D p0,
size_t  N,
std::vector< TPoint3D > &  pOut,
std::vector< float > &  outDistSqr 
) const [inline, inherited]

Definition at line 517 of file KDTreeCapable.h.

void mrpt::math::KDTreeCapable::kdTreeNClosestPoint3DIdx ( float  x0,
float  y0,
float  z0,
size_t  knn,
std::vector< int > &  out_idx,
std::vector< float > &  out_dist_sqr 
) const [inline, inherited]

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

Definition at line 543 of file KDTreeCapable.h.

void mrpt::math::KDTreeCapable::kdTreeNClosestPoint3DIdx ( const TPoint3D p0,
size_t  N,
std::vector< int > &  outIdx,
std::vector< float > &  outDistSqr 
) const [inline, inherited]

Definition at line 567 of file KDTreeCapable.h.

void mrpt::math::KDTreeCapable::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 [inline, inherited]

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 229 of file KDTreeCapable.h.

void mrpt::math::KDTreeCapable::kdTreeTwoClosestPoint2D ( const TPoint2D p0,
TPoint2D pOut1,
TPoint2D pOut2,
float &  outDistSqr1,
float &  outDistSqr2 
) const [inline, inherited]

Definition at line 266 of file KDTreeCapable.h.

void mrpt::vision::CFeatureListKDTree::mark_as_outdated ( ) [inline]

Member Data Documentation

TKDTreeSearchParams mrpt::math::KDTreeCapable::kdtree_search_params [inherited]

Parameters to tune the ANN searches.

Definition at line 116 of file KDTreeCapable.h.

Definition at line 235 of file TSimpleFeature.h.

Referenced by kdtree_get_point_count(), kdtree_get_pt(), and kdtree_distance().




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011