Point Cloud Library (PCL)  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions
pcl::KdTreeFLANN< PointT, Dist > Class Template Reference

KdTreeFLANN is a generic type of 3D spatial locator using kD-tree structures. More...

#include <pcl/kdtree/kdtree_flann.h>

Inheritance diagram for pcl::KdTreeFLANN< PointT, Dist >:
Inheritance graph
[legend]
Collaboration diagram for pcl::KdTreeFLANN< PointT, Dist >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef boost::shared_ptr
< KdTreeFLANN< PointT > > 
Ptr
typedef boost::shared_ptr
< const KdTreeFLANN< PointT > > 
ConstPtr
typedef boost::shared_ptr
< PointCloud
PointCloudPtr
typedef
pcl::PointRepresentation
< PointT > 
PointRepresentation
typedef boost::shared_ptr
< const PointRepresentation
PointRepresentationConstPtr

Public Member Functions

 KdTreeFLANN (bool sorted=true)
 Default Constructor for KdTreeFLANN.
 KdTreeFLANN (KdTreeFLANN &tree)
 Copy constructor.
void setEpsilon (double eps)
 Set the search epsilon precision (error bound) for nearest neighbors searches.
Ptr makeShared ()
KdTreeFLANNoperator= (const KdTreeFLANN &tree)
 Asignment operator (shallow copy)
void shallowCopy (const KdTreeFLANN &tree)
 Perform a shallow copy of the tree.
virtual ~KdTreeFLANN ()
 Destructor for KdTreeFLANN.
void setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr())
 Provide a pointer to the input dataset.
int nearestKSearch (const PointT &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances)
 Search for 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 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 k-nearest neighbors for the given query point (zero-copy).
int radiusSearch (const PointT &point, 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) const
 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).
IndicesConstPtr const getIndices ()
 Get a pointer to the vector of indices used.
PointCloudConstPtr getInputCloud ()
 Get a pointer to the input point cloud dataset.
void setPointRepresentation (const PointRepresentationConstPtr &point_representation)
 Provide a pointer to the point representation to use to convert points into k-D vectors.
PointRepresentationConstPtr const getPointRepresentation ()
 Get a pointer to the point representation used when converting points into k-D vectors.
template<typename PointTDiff >
int nearestKSearchT (const PointTDiff &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances)
 Search for k-nearest neighbors for the given query point.
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) const
 Search for all the nearest neighbors of the query point in a given radius.
double getEpsilon ()
 Get the search epsilon precision (error bound) for nearest neighbors searches.
void setMinPts (int min_pts)
 Minimum allowed number of k nearest neighbors points that a viable result must contain.
float getMinPts ()
 Get the minimum allowed number of k nearest neighbors points that a viable result must contain.

Detailed Description

template<typename PointT, typename Dist = flann::L2_Simple<float>>
class pcl::KdTreeFLANN< PointT, Dist >

KdTreeFLANN 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, Marius Muja

Definition at line 57 of file kdtree_flann.h.


Member Typedef Documentation

template<typename PointT, typename Dist = flann::L2_Simple<float>>
typedef boost::shared_ptr<const KdTreeFLANN<PointT> > pcl::KdTreeFLANN< PointT, Dist >::ConstPtr

Reimplemented from pcl::KdTree< PointT >.

Definition at line 76 of file kdtree_flann.h.

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

Definition at line 63 of file kdtree.h.

template<typename PointT>
typedef pcl::PointRepresentation<PointT> pcl::KdTree< PointT >::PointRepresentation [inherited]

Definition at line 66 of file kdtree.h.

template<typename PointT>
typedef boost::shared_ptr<const PointRepresentation> pcl::KdTree< PointT >::PointRepresentationConstPtr [inherited]

Definition at line 68 of file kdtree.h.

template<typename PointT, typename Dist = flann::L2_Simple<float>>
typedef boost::shared_ptr<KdTreeFLANN<PointT> > pcl::KdTreeFLANN< PointT, Dist >::Ptr

Reimplemented from pcl::KdTree< PointT >.

Definition at line 75 of file kdtree_flann.h.


Constructor & Destructor Documentation

template<typename PointT, typename Dist = flann::L2_Simple<float>>
pcl::KdTreeFLANN< PointT, Dist >::KdTreeFLANN ( bool  sorted = true) [inline]

Default Constructor for KdTreeFLANN.

Parameters:
[in]sortedset to true if the application that the tree will be used for requires sorted nearest neighbor indices (default). False otherwise.

By setting sorted to false, the radiusSearch operations will be faster.

Definition at line 83 of file kdtree_flann.h.

template<typename PointT, typename Dist = flann::L2_Simple<float>>
pcl::KdTreeFLANN< PointT, Dist >::KdTreeFLANN ( KdTreeFLANN< PointT, Dist > &  tree) [inline]

Copy constructor.

This copy constructor does shallow copy of the tree, the only reason why it's needed is because boost::mutex is non-copyable, so the default copy constructor would not work

Parameters:
[in]treethe tree to copy

Definition at line 98 of file kdtree_flann.h.

template<typename PointT, typename Dist = flann::L2_Simple<float>>
virtual pcl::KdTreeFLANN< PointT, Dist >::~KdTreeFLANN ( ) [inline, virtual]

Destructor for KdTreeFLANN.

Deletes all allocated data arrays and destroys the kd-tree structures.

Definition at line 144 of file kdtree_flann.h.


Member Function Documentation

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

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

Definition at line 258 of file kdtree.h.

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

Get a pointer to the vector of indices used.

Definition at line 97 of file kdtree.h.

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

Get a pointer to the input point cloud dataset.

Definition at line 104 of file kdtree.h.

template<typename PointT>
float pcl::KdTree< PointT >::getMinPts ( ) [inline, inherited]

Get the minimum allowed number of k nearest neighbors points that a viable result must contain.

Definition at line 274 of file kdtree.h.

template<typename PointT>
PointRepresentationConstPtr const pcl::KdTree< PointT >::getPointRepresentation ( ) [inline, inherited]

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

Definition at line 121 of file kdtree.h.

template<typename PointT, typename Dist = flann::L2_Simple<float>>
Ptr pcl::KdTreeFLANN< PointT, Dist >::makeShared ( ) [inline]

Definition at line 114 of file kdtree_flann.h.

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

Search for 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::KdTree< PointT >.

Definition at line 77 of file kdtree_flann.hpp.

template<typename PointT, typename Dist = flann::L2_Simple<float>>
int pcl::KdTreeFLANN< PointT, Dist >::nearestKSearch ( const PointCloud cloud,
int  index,
int  k,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances 
) [inline, virtual]

Search for 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::KdTree< PointT >.

Definition at line 178 of file kdtree_flann.h.

template<typename PointT, typename Dist = flann::L2_Simple<float>>
int pcl::KdTreeFLANN< PointT, Dist >::nearestKSearch ( int  index,
int  k,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances 
) [inline, virtual]

Search for 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::KdTree< PointT >.

Definition at line 196 of file kdtree_flann.h.

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

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

This method accepts a different template parameter for the point type.

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

template<typename PointT, typename Dist = flann::L2_Simple<float>>
KdTreeFLANN& pcl::KdTreeFLANN< PointT, Dist >::operator= ( const KdTreeFLANN< PointT, Dist > &  tree) [inline]

Asignment operator (shallow copy)

Parameters:
[in]treethe tree to copy

Definition at line 119 of file kdtree_flann.h.

template<typename PointT, typename Dist >
int pcl::KdTreeFLANN< PointT, Dist >::radiusSearch ( const PointT &  point,
double  radius,
std::vector< int > &  k_indices,
std::vector< float > &  k_sqr_distances,
int  max_nn = -1 
) const [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::KdTree< PointT >.

Definition at line 117 of file kdtree_flann.hpp.

template<typename PointT, typename Dist = flann::L2_Simple<float>>
int pcl::KdTreeFLANN< PointT, Dist >::radiusSearch ( const PointCloud cloud,
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.

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::KdTree< PointT >.

Definition at line 235 of file kdtree_flann.h.

template<typename PointT, typename Dist = flann::L2_Simple<float>>
int pcl::KdTreeFLANN< PointT, Dist >::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::KdTree< PointT >.

Definition at line 254 of file kdtree_flann.h.

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

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

Definition at line 222 of file kdtree.h.

template<typename PointT, typename Dist = flann::L2_Simple<float>>
void pcl::KdTreeFLANN< PointT, Dist >::setEpsilon ( double  eps) [inline, virtual]

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

Parameters:
[in]epsprecision (error bound) for nearest neighbors searches

Reimplemented from pcl::KdTree< PointT >.

Definition at line 107 of file kdtree_flann.h.

template<typename PointT , typename Dist >
void pcl::KdTreeFLANN< PointT, Dist >::setInputCloud ( const PointCloudConstPtr cloud,
const IndicesConstPtr &  indices = IndicesConstPtr () 
) [virtual]

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 - if NULL the whole cloud is used

Reimplemented from pcl::KdTree< PointT >.

Definition at line 46 of file kdtree_flann.hpp.

template<typename PointT>
void pcl::KdTree< PointT >::setMinPts ( int  min_pts) [inline, inherited]

Minimum allowed number of k nearest neighbors points that a viable result must contain.

Parameters:
[in]min_ptsthe minimum number of neighbors in a viable neighborhood

Definition at line 267 of file kdtree.h.

template<typename PointT>
void pcl::KdTree< PointT >::setPointRepresentation ( const PointRepresentationConstPtr point_representation) [inline, inherited]

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

template<typename PointT, typename Dist = flann::L2_Simple<float>>
void pcl::KdTreeFLANN< PointT, Dist >::shallowCopy ( const KdTreeFLANN< PointT, Dist > &  tree) [inline]

Perform a shallow copy of the tree.

Parameters:
[in]treethe tree to copy

Definition at line 131 of file kdtree_flann.h.


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