pcl::search::KdTree< PointT, Tree > Class Template Reference
Module search

search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search functions using KdTree structure. More...

`#include <pcl/search/kdtree.h>`

Inheritance diagram for pcl::search::KdTree< PointT, Tree >:

## Public Types

typedef Search< PointT >::PointCloud | PointCloud
typedef Search< PointT >::PointCloudConstPtr | PointCloudConstPtr
typedef boost::shared_ptr< std::vector< int > > | IndicesPtr
typedef boost::shared_ptr< const std::vector< int > > | IndicesConstPtr
typedef boost::shared_ptr< KdTree< PointT, Tree > > | Ptr
typedef boost::shared_ptr< const KdTree< PointT, Tree > > | ConstPtr
typedef boost::shared_ptr< Tree > | KdTreePtr
typedef boost::shared_ptr< const Tree > | KdTreeConstPtr
typedef boost::shared_ptr< const PointRepresentation< PointT > > | PointRepresentationConstPtr
Public Types inherited from pcl::search::Search< PointT >
typedef pcl::PointCloud< PointT > | PointCloud
typedef PointCloud::Ptr | PointCloudPtr
typedef PointCloud::ConstPtr | PointCloudConstPtr
typedef boost::shared_ptr< pcl::search::Search< PointT > > | Ptr
typedef boost::shared_ptr< const pcl::search::Search< PointT > > | ConstPtr
typedef boost::shared_ptr< std::vector< int > > | IndicesPtr
typedef boost::shared_ptr< const std::vector< int > > | IndicesConstPtr

## Public Member Functions

| KdTree (bool sorted=true)
| Constructor for KdTree. More...
virtual | ~KdTree ()
| Destructor for KdTree. More...
void | setPointRepresentation (const PointRepresentationConstPtr &point_representation)
| Provide a pointer to the point representation to use to convert points into k-D vectors. More...
PointRepresentationConstPtr | getPointRepresentation () const
| Get a pointer to the point representation used when converting points into k-D vectors. More...
void | setSortedResults (bool sorted_results)
| Sets whether the results have to be sorted or not. More...
void | setEpsilon (float eps)
| Set the search epsilon precision (error bound) for nearest neighbors searches. More...
float | getEpsilon () const
| Get the search epsilon precision (error bound) for nearest neighbors searches. More...
void | setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr())
| Provide a pointer to the input dataset. More...
int | nearestKSearch (const PointT &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
| Search for the k-nearest neighbors for the given query point. More...
int | radiusSearch (const PointT &point, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const
| Search for all the nearest neighbors of the query point in a given radius. More...
Public Member Functions inherited from pcl::search::Search< PointT >
| Search (const std::string &name="", bool sorted=false)
| Constructor. More...
virtual | ~Search ()
| Destructor. More...
virtual const std::string & | getName () const
| Returns the search method name. More...
virtual bool | getSortedResults ()
| Gets whether the results should be sorted (ascending in the distance) or not Otherwise the results may be returned in any order. More...
virtual PointCloudConstPtr | getInputCloud () const
| Get a pointer to the input point cloud dataset. More...
virtual IndicesConstPtr | getIndices () const
| Get a pointer to the vector of indices used. More...
template<typename PointTDiff >
int | nearestKSearchT (const PointTDiff &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
| Search for k-nearest neighbors for the given query point. More...
virtual int | nearestKSearch (const PointCloud &cloud, int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
| Search for k-nearest neighbors for the given query point. More...
virtual int | nearestKSearch (int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
| Search for k-nearest neighbors for the given query point (zero-copy). More...
virtual void | nearestKSearch (const PointCloud &cloud, const std::vector< int > &indices, int k, std::vector< std::vector< int > > &k_indices, std::vector< std::vector< float > > &k_sqr_distances) const
| Search for the k-nearest neighbors for the given query point. More...
template<typename PointTDiff >
void | nearestKSearchT (const pcl::PointCloud< PointTDiff > &cloud, const std::vector< int > &indices, int k, std::vector< std::vector< int > > &k_indices, std::vector< std::vector< float > > &k_sqr_distances) const
| Search for the k-nearest neighbors for the given query point. More...
template<typename PointTDiff >
int | radiusSearchT (const PointTDiff &point, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const
| Search for all the nearest neighbors of the query point in a given radius. More...
virtual int | radiusSearch (const PointCloud &cloud, int index, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const
| Search for all the nearest neighbors of the query point in a given radius. More...
virtual int | radiusSearch (int index, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const
| Search for all the nearest neighbors of the query point in a given radius (zero-copy). More...
virtual void | radiusSearch (const PointCloud &cloud, const std::vector< int > &indices, double radius, std::vector< std::vector< int > > &k_indices, std::vector< std::vector< float > > &k_sqr_distances, unsigned int max_nn=0) const
| Search for all the nearest neighbors of the query point in a given radius. More...
template<typename PointTDiff >
void | radiusSearchT (const pcl::PointCloud< PointTDiff > &cloud, const std::vector< int > &indices, double radius, std::vector< std::vector< int > > &k_indices, std::vector< std::vector< float > > &k_sqr_distances, unsigned int max_nn=0) const
| Search for all the nearest neighbors of the query points in a given radius. More...

## Protected Attributes

KdTreePtr | tree_
| A pointer to the internal KdTree object. More...
Protected Attributes inherited from pcl::search::Search< PointT >
PointCloudConstPtr | input_
IndicesConstPtr | indices_
bool | sorted_results_
std::string | name_

## Additional Inherited Members

Protected Member Functions inherited from pcl::search::Search< PointT >
void | sortResults (std::vector< int > &indices, std::vector< float > &distances) const

## Detailed Description

### template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>
class pcl::search::KdTree< PointT, Tree >

search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search functions using KdTree structure.

KdTree is a generic type of 3D spatial locator using kD-tree structures. The class is making use of the FLANN (Fast Library for Approximate Nearest Neighbor) project by Marius Muja and David Lowe.

Author
  Radu B. Rusu

Definition at line 62 of file kdtree.h.

## Member Typedef Documentation

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

typedef boost::shared_ptr<const KdTree<PointT, Tree> > pcl::search::KdTree< PointT, Tree >::ConstPtr

Definition at line 80 of file kdtree.h.

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

typedef boost::shared_ptr<const std::vector<int> > pcl::search::KdTree< PointT, Tree >::IndicesConstPtr

Definition at line 69 of file kdtree.h.

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

typedef boost::shared_ptr<std::vector<int> > pcl::search::KdTree< PointT, Tree >::IndicesPtr

Definition at line 68 of file kdtree.h.

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

typedef boost::shared_ptr<const Tree> pcl::search::KdTree< PointT, Tree >::KdTreeConstPtr

Definition at line 83 of file kdtree.h.

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

typedef boost::shared_ptr<Tree> pcl::search::KdTree< PointT, Tree >::KdTreePtr

Definition at line 82 of file kdtree.h.

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

typedef Search<PointT>::PointCloud pcl::search::KdTree< PointT, Tree >::PointCloud

Definition at line 65 of file kdtree.h.

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

typedef Search<PointT>::PointCloudConstPtr pcl::search::KdTree< PointT, Tree >::PointCloudConstPtr

Definition at line 66 of file kdtree.h.

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

typedef boost::shared_ptr<const PointRepresentation<PointT> > pcl::search::KdTree< PointT, Tree >::PointRepresentationConstPtr

Definition at line 84 of file kdtree.h.

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

typedef boost::shared_ptr<KdTree<PointT, Tree> > pcl::search::KdTree< PointT, Tree >::Ptr

Definition at line 79 of file kdtree.h.

## Constructor & Destructor Documentation

template<typename PointT , class Tree >

pcl::search::KdTree< PointT, Tree >::KdTree | ( | bool | sorted = `true` | ) |

Constructor for KdTree.

Parameters

  [in] | sorted | set to true if the nearest neighbor search results need to be sorted in ascending order based on their distance to the query point

Definition at line 46 of file kdtree.hpp.

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

virtual pcl::search::KdTree< PointT, Tree >::~KdTree | ( |  | ) |

inline virtual

Destructor for KdTree.

Definition at line 97 of file kdtree.h.

## Member Function Documentation

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

float pcl::search::KdTree< PointT, Tree >::getEpsilon | ( |  | ) | const

inline

Get the search epsilon precision (error bound) for nearest neighbors searches.

Definition at line 128 of file kdtree.h.

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

PointRepresentationConstPtr pcl::search::KdTree< PointT, Tree >::getPointRepresentation | ( |  | ) | const

inline

Get a pointer to the point representation used when converting points into k-D vectors.

Definition at line 109 of file kdtree.h.

template<typename PointT, class Tree >

int pcl::search::KdTree< PointT, Tree >::nearestKSearch | ( | const PointT & | point,
|  | int | k,
|  | std::vector< int > & | k_indices,
|  | std::vector< float > & | k_sqr_distances
| ) |  | const

virtual

Search for the k-nearest neighbors for the given query point.

Parameters

  [in] | point | the given query point
  [in] | k | the number of neighbors to search for
  [out] | k_indices | the resultant indices of the neighboring points (must be resized to k a priori!)
  [out] | k_sqr_distances | the resultant squared distances to the neighboring points (must be resized to k a priori!)

Returns
  number of neighbors found

Implements pcl::search::Search< PointT >.

Definition at line 88 of file kdtree.hpp.

References pcl::search::KdTree< PointT, Tree >::tree_.

Referenced by pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget >::computeCovariances(), pcl::search::KdTree< PointTarget >::getEpsilon(), and pcl::SupervoxelClustering< PointT >::refineSupervoxels().

template<typename PointT, class Tree >

int pcl::search::KdTree< PointT, Tree >::radiusSearch | ( | const PointT & | point,
|  | double | radius,
|  | std::vector< int > & | k_indices,
|  | std::vector< float > & | k_sqr_distances,
|  | unsigned int | max_nn = `0`
| ) |  | const

virtual

Search for all the nearest neighbors of the query point in a given radius.

Parameters

  [in] | point | the given query point
  [in] | radius | the radius of the sphere bounding all of p_q's neighbors
  [out] | k_indices | the resultant indices of the neighboring points
  [out] | k_sqr_distances | the resultant squared distances to the neighboring points
  [in] | max_nn | if given, bounds the maximum returned neighbors to this value. If max_nn is set to 0 or to a number higher than the number of points in the input cloud, all neighbors in radius will be returned.

Returns
  number of neighbors found in radius

Implements pcl::search::Search< PointT >.

Definition at line 97 of file kdtree.hpp.

References pcl::search::KdTree< PointT, Tree >::tree_.

Referenced by pcl::search::KdTree< PointTarget >::getEpsilon(), pcl::HarrisKeypoint6D< PointInT, PointOutT, NormalT >::refineCorners(), and pcl::SupervoxelClustering< PointT >::refineSupervoxels().

template<typename PointT , class Tree >

void pcl::search::KdTree< PointT, Tree >::setEpsilon | ( | float | eps | ) |

Set the search epsilon precision (error bound) for nearest neighbors searches.

Parameters

  [in] | eps | precision (error bound) for nearest neighbors searches

Definition at line 70 of file kdtree.hpp.

References pcl::search::KdTree< PointT, Tree >::tree_.

Referenced by pcl::search::KdTree< PointTarget >::getPointRepresentation().

template<typename PointT , class Tree >

void pcl::search::KdTree< PointT, Tree >::setInputCloud | ( | const PointCloudConstPtr & | cloud,
|  | const IndicesConstPtr & | indices = `IndicesConstPtr ()`
| ) |  |

virtual

Provide a pointer to the input dataset.

Parameters

  [in] | cloud | the const boost shared pointer to a PointCloud message
  [in] | indices | the point indices subset that is to be used from cloud

Reimplemented from pcl::search::Search< PointT >.

Definition at line 77 of file kdtree.hpp.

References pcl::search::Search< PointT >::indices_, pcl::search::Search< PointT >::input_, and pcl::search::KdTree< PointT, Tree >::tree_.

Referenced by pcl::people::GroundBasedPeopleDetectionApp< PointT >::compute(), pcl::search::KdTree< PointTarget >::getEpsilon(), pcl::HarrisKeypoint6D< PointInT, PointOutT, NormalT >::refineCorners(), pcl::SupervoxelClustering< PointT >::refineSupervoxels(), pcl::HypothesisVerification< ModelT, SceneT >::setSceneCloud(), and pcl::GlobalHypothesesVerification< ModelT, SceneT >::verify().

template<typename PointT , class Tree >

void pcl::search::KdTree< PointT, Tree >::setPointRepresentation | ( | const PointRepresentationConstPtr & | point_representation | ) |

Provide a pointer to the point representation to use to convert points into k-D vectors.

Parameters

  [in] | point_representation | the const boost shared pointer to a PointRepresentation

Definition at line 54 of file kdtree.hpp.

References pcl::search::KdTree< PointT, Tree >::tree_.

Referenced by pcl::search::KdTree< PointTarget >::~KdTree().

template<typename PointT , class Tree >

void pcl::search::KdTree< PointT, Tree >::setSortedResults | ( | bool | sorted_results | ) |

virtual

Sets whether the results have to be sorted or not.

Parameters

  [in] | sorted_results | set to true if the radius search results should be sorted

Reimplemented from pcl::search::Search< PointT >.

Definition at line 62 of file kdtree.hpp.

References pcl::search::Search< PointT >::sorted_results_, and pcl::search::KdTree< PointT, Tree >::tree_.

Referenced by pcl::search::KdTree< PointTarget >::getPointRepresentation().

## Member Data Documentation

template<typename PointT, class Tree = pcl::KdTreeFLANN<PointT>>

KdTreePtr pcl::search::KdTree< PointT, Tree >::tree_

protected

A pointer to the internal KdTree object.

Definition at line 171 of file kdtree.h.

Referenced by pcl::search::KdTree< PointTarget >::getEpsilon(), pcl::search::KdTree< PointTarget >::getPointRepresentation(), pcl::search::KdTree< PointT, Tree >::nearestKSearch(), pcl::search::KdTree< PointT, Tree >::radiusSearch(), pcl::search::KdTree< PointT, Tree >::setEpsilon(), pcl::search::KdTree< PointT, Tree >::setInputCloud(), pcl::search::KdTree< PointT, Tree >::setPointRepresentation(), and pcl::search::KdTree< PointT, Tree >::setSortedResults().

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

- /build/pcl-6_P28C/pcl-1.7.2/search/include/pcl/search/kdtree.h
- /build/pcl-6_P28C/pcl-1.7.2/search/include/pcl/search/impl/kdtree.hpp