Point Cloud Library (PCL)  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions
pcl::search::KdTree< PointT > 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 >:
Inheritance graph
[legend]
Collaboration diagram for pcl::search::KdTree< PointT >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef boost::shared_ptr
< KdTree< PointT > > 
Ptr
typedef boost::shared_ptr
< const KdTree< PointT > > 
ConstPtr
typedef boost::shared_ptr
< pcl::KdTreeFLANN< PointT > > 
KdTreeFLANNPtr
typedef boost::shared_ptr
< const pcl::KdTreeFLANN
< PointT > > 
KdTreeFLANNConstPtr
typedef PointCloud::Ptr PointCloudPtr

Public Member Functions

 KdTree (bool sorted=true)
 Constructor for KdTree.
virtual ~KdTree ()
 Destructor for KdTree.
void setEpsilon (double eps)
 Set the search epsilon precision (error bound) for nearest neighbors searches.
double getEpsilon ()
 Get the search epsilon precision (error bound) for nearest neighbors searches.
void setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices)
 Provide a pointer to the input dataset.
void setInputCloud (const PointCloudConstPtr &cloud)
 Provide a pointer to the input dataset.
PointCloudConstPtr getInputCloud ()
 Get a pointer to the input dataset as passed by the user.
virtual IndicesConstPtr const getIndices ()
 Get a pointer to the set of input indices used as passed by the user.
int nearestKSearch (const PointT &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances)
 Search for the k-nearest neighbors for the given query point.
int nearestKSearch (const PointCloud &cloud, int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances)
 Search for the k-nearest neighbors for the given query point.
int nearestKSearch (int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances)
 Search for the k-nearest neighbors for the given query point (zero-copy).
int radiusSearch (const PointT &point, const double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, int max_nn=-1) const
 Search for all the nearest neighbors of the query point in a given radius.
int radiusSearch (const PointCloud &cloud, int index, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, int max_nn=-1)
 Search for all the nearest neighbors of the query point in a given radius.
int radiusSearch (int index, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, int max_nn=-1) const
 Search for all the nearest neighbors of the query point in a given radius (zero-copy).
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)
 Search for the k-nearest neighbors for the given query point.
template<typename PointTDiff >
int nearestKSearchT (const PointTDiff &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances)
 Search for the k-nearest neighbors for the given query point.
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)
 Search for the k-nearest neighbors for the given query point.
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, int max_nn=-1)
 Search for all the nearest neighbors of the query point in a given radius.
template<typename PointTDiff >
int radiusSearchT (const PointTDiff &point, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, int max_nn=-1)
 Search for all the nearest neighbors of the query point in a given radius.
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, int max_nn=-1)
 Search for all the nearest neighbors of the query points in a given radius.

Detailed Description

template<typename PointT>
class pcl::search::KdTree< PointT >

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


Member Typedef Documentation

template<typename PointT>
typedef boost::shared_ptr<const KdTree<PointT> > pcl::search::KdTree< PointT >::ConstPtr

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

Definition at line 69 of file kdtree.h.

template<typename PointT>
typedef boost::shared_ptr<const pcl::KdTreeFLANN<PointT> > pcl::search::KdTree< PointT >::KdTreeFLANNConstPtr

Definition at line 72 of file kdtree.h.

template<typename PointT>
typedef boost::shared_ptr<pcl::KdTreeFLANN<PointT> > pcl::search::KdTree< PointT >::KdTreeFLANNPtr

Definition at line 71 of file kdtree.h.

template<typename PointT>
typedef PointCloud::Ptr pcl::search::Search< PointT >::PointCloudPtr [inherited]
template<typename PointT>
typedef boost::shared_ptr<KdTree<PointT> > pcl::search::KdTree< PointT >::Ptr

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

Definition at line 68 of file kdtree.h.


Constructor & Destructor Documentation

template<typename PointT>
pcl::search::KdTree< PointT >::KdTree ( bool  sorted = true) [inline]

Constructor for KdTree.

Parameters:
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 81 of file kdtree.h.

template<typename PointT>
virtual pcl::search::KdTree< PointT >::~KdTree ( ) [inline, virtual]

Destructor for KdTree.

Definition at line 88 of file kdtree.h.


Member Function Documentation

template<typename PointT>
double pcl::search::KdTree< PointT >::getEpsilon ( ) [inline]

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

Definition at line 103 of file kdtree.h.

template<typename PointT>
virtual IndicesConstPtr const pcl::search::KdTree< PointT >::getIndices ( ) [inline, virtual]

Get a pointer to the set of input indices used as passed by the user.

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

Definition at line 137 of file kdtree.h.

template<typename PointT>
PointCloudConstPtr pcl::search::KdTree< PointT >::getInputCloud ( ) [inline, virtual]

Get a pointer to the input dataset as passed by the user.

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

Definition at line 130 of file kdtree.h.

template<typename PointT>
int pcl::search::KdTree< PointT >::nearestKSearch ( const PointT &  point,
int  k,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances 
) [inline, virtual]

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

template<typename PointT>
int pcl::search::KdTree< PointT >::nearestKSearch ( const PointCloud cloud,
int  index,
int  k,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances 
) [inline, virtual]

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

Parameters:
[in]cloudthe point cloud data
[in]indexthe index in cloud representing the 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 166 of file kdtree.h.

template<typename PointT>
int pcl::search::KdTree< PointT >::nearestKSearch ( int  index,
int  k,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances 
) [inline, virtual]

Search for the k-nearest neighbors for the given query point (zero-copy).

Parameters:
[in]indexthe index representing the query point in the dataset given by setInputCloud if indices were given in setInputCloud, index will be the position in the indices vector
[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 184 of file kdtree.h.

template<typename PointT>
virtual void pcl::search::Search< PointT >::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 
) [inline, virtual, inherited]

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

Parameters:
[in]cloudthe point cloud data
[in]indicesa vector of point cloud indices to query for nearest neighbors
[in]kthe number of neighbors to search for
[out]k_indicesthe resultant indices of the neighboring points, k_indices[i] corresponds to the neighbors of the query point i
[out]k_sqr_distancesthe resultant squared distances to the neighboring points, k_sqr_distances[i] corresponds to the neighbors of the query point i

Definition at line 184 of file search.h.

template<typename PointT>
template<typename PointTDiff >
int pcl::search::Search< PointT >::nearestKSearchT ( const PointTDiff &  point,
int  k,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances 
) [inline, inherited]

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

Use this method if the query points are of a different type than the points in the data set (e.g. PointXYZRGB instead of PointXYZ).

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

Definition at line 138 of file search.h.

template<typename PointT>
template<typename PointTDiff >
void pcl::search::Search< PointT >::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 
) [inline, inherited]

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

Use this method if the query points are of a different type than the points in the data set (e.g. PointXYZRGB instead of PointXYZ).

Parameters:
[in]cloudthe point cloud data
[in]indicesa vector of point cloud indices to query for nearest neighbors
[in]kthe number of neighbors to search for
[out]k_indicesthe resultant indices of the neighboring points, k_indices[i] corresponds to the neighbors of the query point i
[out]k_sqr_distancesthe resultant squared distances to the neighboring points, k_sqr_distances[i] corresponds to the neighbors of the query point i
Note:
This method copies the input point cloud of type PointTDiff to a temporary cloud of type PointT and performs the batch search on the new cloud. You should prefer the single-point search if you don't use a search algorithm that accelerates batch NN search.

Definition at line 212 of file search.h.

template<typename PointT>
int pcl::search::KdTree< PointT >::radiusSearch ( const PointT &  point,
const double  radius,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances,
int  max_nn = -1 
) const [inline, virtual]

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
Returns:
number of neighbors found in radius

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

Definition at line 198 of file kdtree.h.

template<typename PointT>
int pcl::search::KdTree< PointT >::radiusSearch ( const PointCloud cloud,
int  index,
double  radius,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances,
int  max_nn = -1 
) [inline, virtual]

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

Parameters:
[in]cloudthe point cloud data
[in]indexthe index in cloud representing the 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
Returns:
number of neighbors found in radius

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

Definition at line 215 of file kdtree.h.

template<typename PointT>
int pcl::search::KdTree< PointT >::radiusSearch ( int  index,
double  radius,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances,
int  max_nn = -1 
) const [inline, virtual]

Search for all the nearest neighbors of the query point in a given radius (zero-copy).

Parameters:
[in]indexthe index representing the query point in the dataset given by setInputCloud if indices were given in setInputCloud, index will be the position in the indices vector
[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
Returns:
number of neighbors found in radius

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

Definition at line 231 of file kdtree.h.

template<typename PointT>
virtual void pcl::search::Search< PointT >::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,
int  max_nn = -1 
) [inline, virtual, inherited]

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

Parameters:
[in]cloudthe point cloud data
[in]indicesthe indices in cloud. If indices is empty, neighbors will be searched for all points.
[in]radiusthe radius of the sphere bounding all of p_q's neighbors
[out]k_indicesthe resultant indices of the neighboring points, k_indices[i] corresponds to the neighbors of the query point i
[out]k_sqr_distancesthe resultant squared distances to the neighboring points, k_sqr_distances[i] corresponds to the neighbors of the query point i
[in]max_nnif given, bounds the maximum returned neighbors to this value

Definition at line 312 of file search.h.

template<typename PointT>
template<typename PointTDiff >
int pcl::search::Search< PointT >::radiusSearchT ( const PointTDiff &  point,
double  radius,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances,
int  max_nn = -1 
) [inline, inherited]

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

Use this method if the query points are of a different type than the points in the data set (e.g. PointXYZRGB instead of PointXYZ).

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
Returns:
number of neighbors found in radius

Definition at line 264 of file search.h.

template<typename PointT>
template<typename PointTDiff >
void pcl::search::Search< PointT >::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,
int  max_nn = -1 
) [inline, inherited]

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

Parameters:
[in]cloudthe point cloud data
[in]indicesa vector of point cloud indices to query for nearest neighbors
[in]radiusthe radius of the sphere bounding all of p_q's neighbors
[out]k_indicesthe resultant indices of the neighboring points, k_indices[i] corresponds to the neighbors of the query point i
[out]k_sqr_distancesthe resultant squared distances to the neighboring points, k_sqr_distances[i] corresponds to the neighbors of the query point i
[in]max_nnif given, bounds the maximum returned neighbors per query point to this value
Note:
This method copies the input point cloud of type PointTDiff to a temporary cloud of type PointT and performs the batch search on the new cloud. You should prefer the single-point search if you don't use a search algorithm that accelerates batch NN search.

Definition at line 342 of file search.h.

template<typename PointT>
void pcl::search::KdTree< PointT >::setEpsilon ( double  eps) [inline]

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

Parameters:
epsprecision (error bound) for nearest neighbors searches

Definition at line 96 of file kdtree.h.

template<typename PointT>
void pcl::search::KdTree< PointT >::setInputCloud ( const PointCloudConstPtr &  cloud,
const IndicesConstPtr &  indices 
) [inline, virtual]

Provide a pointer to the input dataset.

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

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

Definition at line 113 of file kdtree.h.

template<typename PointT>
void pcl::search::KdTree< PointT >::setInputCloud ( const PointCloudConstPtr &  cloud) [inline, virtual]

Provide a pointer to the input dataset.

Parameters:
cloudthe const boost shared pointer to a PointCloud message

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

Definition at line 122 of file kdtree.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines