Point Cloud Library (PCL)  1.14.0-dev
List of all members | Public Types | Public Member Functions | Protected Attributes
pcl::search::KdTree< PointT, Tree > Class Template Reference

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 >:
+ Collaboration diagram for pcl::search::KdTree< PointT, Tree >:

Public Types

using PointCloud = typename Search< PointT >::PointCloud
 
using PointCloudConstPtr = typename Search< PointT >::PointCloudConstPtr
 
using Ptr = shared_ptr< KdTree< PointT, Tree > >
 
using ConstPtr = shared_ptr< const KdTree< PointT, Tree > >
 
using KdTreePtr = typename Tree::Ptr
 
using KdTreeConstPtr = typename Tree::ConstPtr
 
using PointRepresentationConstPtr = typename PointRepresentation< PointT >::ConstPtr
 

Public Member Functions

 KdTree (bool sorted=true)
 Constructor for KdTree. More...
 
 ~KdTree () override=default
 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) override
 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...
 
bool setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) override
 Provide a pointer to the input dataset. More...
 
int nearestKSearch (const PointT &point, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const override
 Search for the k-nearest neighbors for the given query point. More...
 
int radiusSearch (const PointT &point, double radius, Indices &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const override
 Search for all the nearest neighbors of the query point in a given radius. More...
 

Protected Attributes

KdTreePtr tree_
 A pointer to the internal KdTree object. More...
 

Additional Inherited Members

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 61 of file kdtree.h.

Member Typedef Documentation

◆ ConstPtr

template<typename PointT , class Tree = pcl::KdTreeFLANN<PointT>>
using pcl::search::KdTree< PointT, Tree >::ConstPtr = shared_ptr<const KdTree<PointT, Tree> >

Definition at line 76 of file kdtree.h.

◆ KdTreeConstPtr

template<typename PointT , class Tree = pcl::KdTreeFLANN<PointT>>
using pcl::search::KdTree< PointT, Tree >::KdTreeConstPtr = typename Tree::ConstPtr

Definition at line 79 of file kdtree.h.

◆ KdTreePtr

template<typename PointT , class Tree = pcl::KdTreeFLANN<PointT>>
using pcl::search::KdTree< PointT, Tree >::KdTreePtr = typename Tree::Ptr

Definition at line 78 of file kdtree.h.

◆ PointCloud

template<typename PointT , class Tree = pcl::KdTreeFLANN<PointT>>
using pcl::search::KdTree< PointT, Tree >::PointCloud = typename Search<PointT>::PointCloud

Definition at line 64 of file kdtree.h.

◆ PointCloudConstPtr

template<typename PointT , class Tree = pcl::KdTreeFLANN<PointT>>
using pcl::search::KdTree< PointT, Tree >::PointCloudConstPtr = typename Search<PointT>::PointCloudConstPtr

Definition at line 65 of file kdtree.h.

◆ PointRepresentationConstPtr

template<typename PointT , class Tree = pcl::KdTreeFLANN<PointT>>
using pcl::search::KdTree< PointT, Tree >::PointRepresentationConstPtr = typename PointRepresentation<PointT>::ConstPtr

Definition at line 80 of file kdtree.h.

◆ Ptr

template<typename PointT , class Tree = pcl::KdTreeFLANN<PointT>>
using pcl::search::KdTree< PointT, Tree >::Ptr = shared_ptr<KdTree<PointT, Tree> >

Definition at line 75 of file kdtree.h.

Constructor & Destructor Documentation

◆ KdTree()

template<typename PointT , class Tree >
pcl::search::KdTree< PointT, Tree >::KdTree ( bool  sorted = true)

Constructor for KdTree.

Parameters
[in]sortedset 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 45 of file kdtree.hpp.

◆ ~KdTree()

template<typename PointT , class Tree = pcl::KdTreeFLANN<PointT>>
pcl::search::KdTree< PointT, Tree >::~KdTree ( )
overridedefault

Destructor for KdTree.

Member Function Documentation

◆ getEpsilon()

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 122 of file kdtree.h.

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

◆ getPointRepresentation()

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 103 of file kdtree.h.

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

◆ nearestKSearch()

template<typename PointT , class Tree >
int pcl::search::KdTree< PointT, Tree >::nearestKSearch ( const PointT point,
int  k,
Indices k_indices,
std::vector< float > &  k_sqr_distances 
) const
overridevirtual

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

Parameters
[in]pointthe given query point
[in]kthe number of neighbors to search for
[out]k_indicesthe resultant indices of the neighboring points (must be resized to k a priori!)
[out]k_sqr_distancesthe 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.

Referenced by pcl::GeneralizedIterativeClosestPoint< PointSource, PointTarget, Scalar >::computeCovariances(), pcl::registration::FPCSInitialAlignment< PointSource, PointTarget, pcl::Normal, float >::FPCSInitialAlignment(), and pcl::getMeanPointDensity().

◆ radiusSearch()

template<typename PointT , class Tree >
int pcl::search::KdTree< PointT, Tree >::radiusSearch ( const PointT point,
double  radius,
Indices k_indices,
std::vector< float > &  k_sqr_distances,
unsigned int  max_nn = 0 
) const
overridevirtual

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

Parameters
[in]pointthe given query point
[in]radiusthe radius of the sphere bounding all of p_q's neighbors
[out]k_indicesthe resultant indices of the neighboring points
[out]k_sqr_distancesthe resultant squared distances to the neighboring points
[in]max_nnif 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.

Referenced by pcl::HarrisKeypoint6D< PointInT, PointOutT, NormalT >::refineCorners().

◆ setEpsilon()

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]epsprecision (error bound) for nearest neighbors searches

Definition at line 69 of file kdtree.hpp.

◆ setInputCloud()

template<typename PointT , class Tree >
bool pcl::search::KdTree< PointT, Tree >::setInputCloud ( const PointCloudConstPtr cloud,
const IndicesConstPtr indices = IndicesConstPtr () 
)
overridevirtual

Provide a pointer to the input dataset.

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

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

Definition at line 76 of file kdtree.hpp.

Referenced by pcl::people::GroundBasedPeopleDetectionApp< PointT >::compute(), pcl::getMeanPointDensity(), pcl::HarrisKeypoint6D< PointInT, PointOutT, NormalT >::refineCorners(), and pcl::HypothesisVerification< ModelT, SceneT >::setSceneCloud().

◆ setPointRepresentation()

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_representationthe const boost shared pointer to a PointRepresentation

Definition at line 53 of file kdtree.hpp.

◆ setSortedResults()

template<typename PointT , class Tree >
void pcl::search::KdTree< PointT, Tree >::setSortedResults ( bool  sorted_results)
overridevirtual

Sets whether the results have to be sorted or not.

Parameters
[in]sorted_resultsset to true if the radius search results should be sorted

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

Definition at line 61 of file kdtree.hpp.

Member Data Documentation

◆ tree_

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 165 of file kdtree.h.

Referenced by pcl::search::KdTree< PointT, Tree >::getEpsilon(), and pcl::search::KdTree< PointT, Tree >::getPointRepresentation().


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