Public Types | Public Member Functions

pcl::KdTreeFLANN< PointT > Class Template Reference
[Module kdtree]

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 >:
Inheritance graph
[legend]
Collaboration diagram for pcl::KdTreeFLANN< PointT >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef boost::shared_ptr
< KdTreeFLANN< PointT > > 
Ptr
typedef boost::shared_ptr
< const KdTreeFLANN< PointT > > 
ConstPtr

Public Member Functions

 KdTreeFLANN (bool sorted=true)
 Constructor for KdTree.
 KdTreeFLANN (KdTreeFLANN &tree)
 Copy constructor.
Ptr makeShared ()
KdTreeFLANNoperator= (const KdTreeFLANN &tree)
void shallowCopy (const KdTreeFLANN &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_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_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_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_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_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_distances, int max_nn=-1) const
 Search for all the nearest neighbors of the query point in a given radius (zero-copy).

Detailed Description

template<typename PointT>
class pcl::KdTreeFLANN< PointT >

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.

Note:
libFLANN is not thread safe, so we need mutices in places to make KdTreeFLANN thread safe.
Author:
Radu Bogdan Rusu

Definition at line 65 of file kdtree_flann.h.


Member Typedef Documentation

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

Reimplemented from pcl::KdTree< PointT >.

Definition at line 84 of file kdtree_flann.h.

template<typename PointT>
typedef boost::shared_ptr<KdTreeFLANN<PointT> > pcl::KdTreeFLANN< PointT >::Ptr

Reimplemented from pcl::KdTree< PointT >.

Definition at line 83 of file kdtree_flann.h.


Constructor & Destructor Documentation

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

Constructor for KdTree.

Note:
ATTENTION: This method breaks the 1-1 mapping between the indices returned using getNeighborsIndices and the ones from the cloud message ! When using this method, make sure to get the underlying point data using the getPoint method param cloud the point cloud data array param indices the point cloud indicesDefault Constructor for KdTreeFLANN.

Definition at line 94 of file kdtree_flann.h.

template<typename PointT>
pcl::KdTreeFLANN< PointT >::KdTreeFLANN ( KdTreeFLANN< PointT > &  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

Definition at line 106 of file kdtree_flann.h.

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

Destructor for KdTreeFLANN.

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

Definition at line 137 of file kdtree_flann.h.


Member Function Documentation

template<typename PointT>
Ptr pcl::KdTreeFLANN< PointT >::makeShared (  )  [inline]

Definition at line 111 of file kdtree_flann.h.

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

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

Parameters:
point the given query point
k the number of neighbors to search for
k_indices the resultant indices of the neighboring points (must be resized to k a priori!)
k_distances the 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 78 of file kdtree_flann.hpp.

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

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

Parameters:
cloud the point cloud data
index the index in cloud representing the query point
k the number of neighbors to search for
k_indices the resultant indices of the neighboring points (must be resized to k a priori!)
k_distances the 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 171 of file kdtree_flann.h.

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

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

Parameters:
index the 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
k the number of neighbors to search for
k_indices the resultant indices of the neighboring points (must be resized to k a priori!)
k_distances the 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 189 of file kdtree_flann.h.

template<typename PointT>
KdTreeFLANN& pcl::KdTreeFLANN< PointT >::operator= ( const KdTreeFLANN< PointT > &  tree  )  [inline]

Definition at line 113 of file kdtree_flann.h.

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

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

Parameters:
point the given query point
radius the radius of the sphere bounding all of p_q's neighbors
k_indices the resultant indices of the neighboring points
k_distances the resultant squared distances to the neighboring points
max_nn if given, bounds the maximum returned neighbors to this value
Returns:
number of neighbors found in radius

Implements pcl::KdTree< PointT >.

Definition at line 109 of file kdtree_flann.hpp.

template<typename PointT>
int pcl::KdTreeFLANN< PointT >::radiusSearch ( int  index,
double  radius,
std::vector< int > &  k_indices,
std::vector< float > &  k_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:
index the 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
radius the radius of the sphere bounding all of p_q's neighbors
k_indices the resultant indices of the neighboring points
k_distances the resultant squared distances to the neighboring points
max_nn if given, bounds the maximum returned neighbors to this value
Returns:
number of neighbors found in radius

Implements pcl::KdTree< PointT >.

Definition at line 247 of file kdtree_flann.h.

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

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

Parameters:
cloud the point cloud data
index the index in cloud representing the query point
radius the radius of the sphere bounding all of p_q's neighbors
k_indices the resultant indices of the neighboring points
k_distances the resultant squared distances to the neighboring points
max_nn if given, bounds the maximum returned neighbors to this value
Returns:
number of neighbors found in radius

Implements pcl::KdTree< PointT >.

Definition at line 228 of file kdtree_flann.h.

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

Provide a pointer to the input dataset.

Parameters:
cloud the const boost shared pointer to a PointCloud message
indices the 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 47 of file kdtree_flann.hpp.

template<typename PointT>
void pcl::KdTreeFLANN< PointT >::shallowCopy ( const KdTreeFLANN< PointT > &  tree  )  [inline]

Definition at line 124 of file kdtree_flann.h.


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