|
Point Cloud Library (PCL) 1.15.1
|
pcl::search::KdTreeNanoflann is a faster and flexible alternative to pcl::search::KdTree. More...
#include <pcl/search/kdtree_nanoflann.h>
Public Types | |
| using | PointCloud = typename Search<PointT>::PointCloud |
| using | PointCloudConstPtr = typename pcl::PointCloud<PointT>::ConstPtr |
| using | Ptr = shared_ptr<KdTreeNanoflann<PointT, Dim, Distance, Tree>> |
| using | ConstPtr = shared_ptr<const KdTreeNanoflann<PointT, Dim, Distance, Tree>> |
| using | KdTreePtr = shared_ptr<Tree> |
| using | KdTreeConstPtr = shared_ptr<const Tree> |
| using | PointRepresentationConstPtr = shared_ptr<const PointRepresentation<PointT>> |
| Public Types inherited from pcl::search::KdTree< PointT, Tree > | |
| 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 Types inherited from pcl::search::Search< PointT > | |
| using | PointCloud = pcl::PointCloud<PointT> |
| using | PointCloudPtr = typename PointCloud::Ptr |
| using | PointCloudConstPtr = typename PointCloud::ConstPtr |
| using | Ptr = shared_ptr<pcl::search::Search<PointT> > |
| using | ConstPtr = shared_ptr<const pcl::search::Search<PointT> > |
| using | IndicesPtr = pcl::IndicesPtr |
| using | IndicesConstPtr = pcl::IndicesConstPtr |
Public Member Functions | |
| KdTreeNanoflann (bool sorted, std::size_t leaf_max_size, unsigned int n_thread_build=1) | |
| Constructor for KdTreeNanoflann. | |
| KdTreeNanoflann (bool sorted=false) | |
| Constructor for KdTreeNanoflann. | |
| ~KdTreeNanoflann () override=default | |
| Destructor for KdTreeNanoflann. | |
| void | setPointRepresentation (const PointRepresentationConstPtr &point_representation) |
| Provide a pointer to the point representation to use to convert points into k-D vectors. | |
| PointRepresentationConstPtr | getPointRepresentation () const |
| Get a pointer to the point representation used when converting points into k-D vectors. | |
| void | setSortedResults (bool sorted_results) override |
| Sets whether the results have to be sorted or not. | |
| void | setEpsilon (float eps) |
| Set the search epsilon precision (error bound) for nearest neighbors searches. | |
| float | getEpsilon () const |
| Get the search epsilon precision (error bound) for nearest neighbors searches. | |
| void | setUseRKNN (bool use_rknn) |
| Influences the results of radiusSearch when max_nn is not set to zero. | |
| bool | setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) override |
| Provide a pointer to the input dataset, this will build the kd-tree. | |
| KdTreePtr | getNanoflannTree () |
| Get pointer to internal nanoflann tree. | |
| 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. | |
| 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. | |
| Public Member Functions inherited from pcl::search::KdTree< PointT, Tree > | |
| KdTree (bool sorted=true) | |
| Constructor for KdTree. | |
| ~KdTree () override=default | |
| Destructor for KdTree. | |
| void | setPointRepresentation (const PointRepresentationConstPtr &point_representation) |
| Provide a pointer to the point representation to use to convert points into k-D vectors. | |
| PointRepresentationConstPtr | getPointRepresentation () const |
| Get a pointer to the point representation used when converting points into k-D vectors. | |
| void | setEpsilon (float eps) |
| Set the search epsilon precision (error bound) for nearest neighbors searches. | |
| float | getEpsilon () const |
| Get the search epsilon precision (error bound) for nearest neighbors searches. | |
| Public Member Functions inherited from pcl::search::Search< PointT > | |
| Search (const std::string &name="", bool sorted=false) | |
| Constructor. | |
| virtual | ~Search ()=default |
| Destructor. | |
| virtual const std::string & | getName () const |
| Returns the search method name. | |
| 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. | |
| virtual PointCloudConstPtr | getInputCloud () const |
| Get a pointer to the input point cloud dataset. | |
| virtual IndicesConstPtr | getIndices () const |
| Get a pointer to the vector of indices used. | |
| template<typename PointTDiff> | |
| int | nearestKSearchT (const PointTDiff &point, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const |
| Search for k-nearest neighbors for the given query point. | |
| virtual int | nearestKSearch (const PointCloud &cloud, index_t index, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const |
| Search for k-nearest neighbors for the given query point. | |
| virtual int | nearestKSearch (index_t index, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const |
| Search for k-nearest neighbors for the given query point (zero-copy). | |
| virtual void | nearestKSearch (const PointCloud &cloud, const Indices &indices, int k, std::vector< Indices > &k_indices, std::vector< std::vector< float > > &k_sqr_distances) const |
| Search for the k-nearest neighbors for the given query point. | |
| template<typename PointTDiff> | |
| void | nearestKSearchT (const pcl::PointCloud< PointTDiff > &cloud, const Indices &indices, int k, std::vector< Indices > &k_indices, std::vector< std::vector< float > > &k_sqr_distances) const |
| Search for the k-nearest neighbors for the given query point. | |
| template<typename PointTDiff> | |
| int | radiusSearchT (const PointTDiff &point, double radius, Indices &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. | |
| virtual int | radiusSearch (const PointCloud &cloud, index_t index, double radius, Indices &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. | |
| virtual int | radiusSearch (index_t index, double radius, Indices &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). | |
| virtual void | radiusSearch (const PointCloud &cloud, const Indices &indices, double radius, std::vector< Indices > &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. | |
| template<typename PointTDiff> | |
| void | radiusSearchT (const pcl::PointCloud< PointTDiff > &cloud, const Indices &indices, double radius, std::vector< Indices > &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. | |
Additional Inherited Members | |
| Protected Member Functions inherited from pcl::search::KdTree< PointT, Tree > | |
| KdTree (const std::string &name, bool sorted) | |
| This leaves the internal tree_ object uninitialized! | |
| Protected Member Functions inherited from pcl::search::Search< PointT > | |
| void | sortResults (Indices &indices, std::vector< float > &distances) const |
| Protected Attributes inherited from pcl::search::KdTree< PointT, Tree > | |
| KdTreePtr | tree_ |
| A pointer to the internal KdTree object. | |
| Protected Attributes inherited from pcl::search::Search< PointT > | |
| PointCloudConstPtr | input_ |
| IndicesConstPtr | indices_ |
| bool | sorted_results_ |
| std::string | name_ |
pcl::search::KdTreeNanoflann is a faster and flexible alternative to pcl::search::KdTree.
It is based on the nanoflann library by Jose Luis Blanco-Claraco ( https://github.com/jlblancoc/nanoflann ). Since nanoflann is treated as an optional dependency to PCL, you must test the preprocessor symbol PCL_HAS_NANOFLANN after including pcl/search/kdtree_nanoflann.h.
| PointT | Can be a point like pcl::PointXYZ or a feature like pcl::SHOT352 |
| Dim | Dimension of the KdTree to build. If set to -1, it will infer the dimension at runtime from the given point representation, but with a performance penalty. Default is 3, appropriate for all xyz point types. |
| Distance | The distance to use. Possible values include pcl::L1_Adaptor (taxicab/manhattan distance), pcl::L2_Simple_Adaptor (euclidean distance, optimized for few dimensions), pcl::L2_Adaptor (euclidean distance, optimized for many dimensions), pcl::SO2_Adaptor, pcl::SO3_Adaptor. Default is pcl::L2_Simple_Adaptor |
Definition at line 186 of file kdtree_nanoflann.h.
| using pcl::search::KdTreeNanoflann< PointT, Dim, Distance, L2_Adaptor, L2_Simple_Adaptor, Tree >::ConstPtr = shared_ptr<const KdTreeNanoflann<PointT, Dim, Distance, Tree>> |
Definition at line 292 of file kdtree_nanoflann.h.
| using pcl::search::KdTreeNanoflann< PointT, Dim, Distance, L2_Adaptor, L2_Simple_Adaptor, Tree >::KdTreeConstPtr = shared_ptr<const Tree> |
Definition at line 295 of file kdtree_nanoflann.h.
| using pcl::search::KdTreeNanoflann< PointT, Dim, Distance, L2_Adaptor, L2_Simple_Adaptor, Tree >::KdTreePtr = shared_ptr<Tree> |
Definition at line 294 of file kdtree_nanoflann.h.
| using pcl::search::KdTreeNanoflann< PointT, Dim, Distance, L2_Adaptor, L2_Simple_Adaptor, Tree >::PointCloud = typename Search<PointT>::PointCloud |
Definition at line 279 of file kdtree_nanoflann.h.
| using pcl::search::KdTreeNanoflann< PointT, Dim, Distance, L2_Adaptor, L2_Simple_Adaptor, Tree >::PointCloudConstPtr = typename pcl::PointCloud<PointT>::ConstPtr |
Definition at line 280 of file kdtree_nanoflann.h.
| using pcl::search::KdTreeNanoflann< PointT, Dim, Distance, L2_Adaptor, L2_Simple_Adaptor, Tree >::PointRepresentationConstPtr = shared_ptr<const PointRepresentation<PointT>> |
Definition at line 296 of file kdtree_nanoflann.h.
| using pcl::search::KdTreeNanoflann< PointT, Dim, Distance, L2_Adaptor, L2_Simple_Adaptor, Tree >::Ptr = shared_ptr<KdTreeNanoflann<PointT, Dim, Distance, Tree>> |
Definition at line 291 of file kdtree_nanoflann.h.
|
inline |
Constructor for KdTreeNanoflann.
| [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 (default is false, which is faster) |
| [in] | leaf_max_size | Max number of points/samples in a leaf, can be tuned to achieve best performance. When using this for 1nn search (e.g. correspondence estimation in icp/registration), then leaf_max_size=10 is usually fastest. Otherwise, leaf_max_size=20 is a good choice. |
| [in] | n_thread_build | Number of threads for concurrent tree build (default is 1, meaning no concurrent build) |
Definition at line 310 of file kdtree_nanoflann.h.
References pcl::search::KdTree< PointT, Tree >::KdTree().
Referenced by KdTreeNanoflann().
|
inline |
Constructor for KdTreeNanoflann.
| [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 325 of file kdtree_nanoflann.h.
References KdTreeNanoflann().
|
overridedefault |
Destructor for KdTreeNanoflann.
|
inline |
Get the search epsilon precision (error bound) for nearest neighbors searches.
Definition at line 386 of file kdtree_nanoflann.h.
|
inline |
Get pointer to internal nanoflann tree.
Use with caution.
Definition at line 420 of file kdtree_nanoflann.h.
|
inline |
Get a pointer to the point representation used when converting points into k-D vectors.
Definition at line 359 of file kdtree_nanoflann.h.
|
inlineoverridevirtual |
Search for the k-nearest neighbors for the given query point.
| [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!) |
Reimplemented from pcl::search::KdTree< PointT, Tree >.
Definition at line 435 of file kdtree_nanoflann.h.
|
inlineoverridevirtual |
Search for all the nearest neighbors of the query point in a given radius.
| [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. |
Reimplemented from pcl::search::KdTree< PointT, Tree >.
Definition at line 486 of file kdtree_nanoflann.h.
References pcl::search::Search< PointT >::sorted_results_, pcl::search::Search< PointT >::sortResults(), and pcl::search::internal::square_if_l2().
|
inline |
Set the search epsilon precision (error bound) for nearest neighbors searches.
| [in] | eps | precision (error bound) for nearest neighbors searches |
Definition at line 378 of file kdtree_nanoflann.h.
|
inlineoverridevirtual |
Provide a pointer to the input dataset, this will build the kd-tree.
| [in] | cloud | the const shared pointer to a PointCloud |
| [in] | indices | the point indices subset that is to be used from cloud |
Reimplemented from pcl::search::KdTree< PointT, Tree >.
Definition at line 408 of file kdtree_nanoflann.h.
References pcl::search::Search< PointT >::indices_, and pcl::search::Search< PointT >::input_.
|
inline |
Provide a pointer to the point representation to use to convert points into k-D vectors.
If you want to use this function, it is recommended to do so before calling setInputCloud, to avoid setting up the kd-tree twice.
| [in] | point_representation | the const shared pointer to a PointRepresentation |
Definition at line 336 of file kdtree_nanoflann.h.
|
inlineoverridevirtual |
Sets whether the results have to be sorted or not.
| [in] | sorted_results | set to true if the radius search results should be sorted |
Reimplemented from pcl::search::KdTree< PointT, Tree >.
Definition at line 368 of file kdtree_nanoflann.h.
References pcl::search::Search< PointT >::sorted_results_.
|
inline |
Influences the results of radiusSearch when max_nn is not set to zero.
If the parameter max_nn of radiusSearch is set to a value greater than zero, it will return at most that many points. If you set use_rknn=true, it will always return the points closest to the query point. If you set use_rknn=false, it may return any points within the radius, which can be faster.
Definition at line 398 of file kdtree_nanoflann.h.