Point Cloud Library (PCL) 1.12.0
|
Generic search class. More...
#include <pcl/search/search.h>
Public Types | |
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 | |
Search (const std::string &name="", bool sorted=false) | |
Constructor. | |
virtual | ~Search () |
Destructor. | |
virtual const std::string & | getName () const |
Returns the search method name. | |
virtual void | setSortedResults (bool sorted) |
sets whether the results should be sorted (ascending in the distance) or not | |
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 void | setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) |
Pass the input dataset that the search will be performed on. | |
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. | |
virtual int | nearestKSearch (const PointT &point, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const =0 |
Search for the k-nearest neighbors for the given query point. | |
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. | |
virtual int | radiusSearch (const PointT &point, double radius, Indices &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const =0 |
Search for all the nearest neighbors of the query point in a given radius. | |
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. | |
Protected Member Functions | |
void | sortResults (Indices &indices, std::vector< float > &distances) const |
Protected Attributes | |
PointCloudConstPtr | input_ |
IndicesConstPtr | indices_ |
bool | sorted_results_ |
std::string | name_ |
Generic search class.
All search wrappers must inherit from this.
Each search method must implement 2 different types of search:
The input to each search method can be given in 3 different ways:
For the latter option, it is assumed that the user specified the input via a setInputCloud () method first.
using pcl::search::Search< PointT >::ConstPtr = shared_ptr<const pcl::search::Search<PointT> > |
using pcl::search::Search< PointT >::IndicesConstPtr = pcl::IndicesConstPtr |
using pcl::search::Search< PointT >::IndicesPtr = pcl::IndicesPtr |
using pcl::search::Search< PointT >::PointCloud = pcl::PointCloud<PointT> |
using pcl::search::Search< PointT >::PointCloudConstPtr = typename PointCloud::ConstPtr |
using pcl::search::Search< PointT >::PointCloudPtr = typename PointCloud::Ptr |
using pcl::search::Search< PointT >::Ptr = shared_ptr<pcl::search::Search<PointT> > |
pcl::search::Search< PointT >::Search | ( | const std::string & | name = "", |
bool | sorted = false ) |
Constructor.
Definition at line 45 of file search.hpp.
|
inlinevirtual |
|
inlinevirtual |
Get a pointer to the vector of indices used.
Definition at line 132 of file search.h.
References pcl::search::Search< PointT >::indices_.
|
inlinevirtual |
Get a pointer to the input point cloud dataset.
Definition at line 125 of file search.h.
References pcl::search::Search< PointT >::input_.
|
virtual |
Returns the search method name.
Definition at line 54 of file search.hpp.
|
virtual |
Gets whether the results should be sorted (ascending in the distance) or not Otherwise the results may be returned in any order.
Definition at line 68 of file search.hpp.
|
virtual |
Search for the k-nearest neighbors for the given query point.
[in] | cloud | the point cloud data |
[in] | indices | a vector of point cloud indices to query for nearest neighbors |
[in] | k | the number of neighbors to search for |
[out] | k_indices | the resultant indices of the neighboring points, k_indices[i] corresponds to the neighbors of the query point i |
[out] | k_sqr_distances | the resultant squared distances to the neighboring points, k_sqr_distances[i] corresponds to the neighbors of the query point i |
Reimplemented in pcl::search::FlannSearch< PointT, FlannDistance >.
Definition at line 113 of file search.hpp.
|
virtual |
Search for k-nearest neighbors for the given query point.
[in] | cloud | the point cloud data |
[in] | index | a valid index in cloud representing a valid (i.e., finite) 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!) |
asserts | in debug mode if the index is not between 0 and the maximum number of points |
Definition at line 85 of file search.hpp.
|
pure virtual |
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!) |
Implemented in pcl::search::OrganizedNeighbor< PointT >, pcl::search::BruteForce< PointT >, pcl::search::FlannSearch< PointT, FlannDistance >, pcl::search::KdTree< PointT, Tree >, pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >, and pcl::search::KdTree< SceneT >.
Referenced by pcl::search::Search< PointT >::nearestKSearchT(), and pcl::search::Search< PointT >::nearestKSearchT().
|
virtual |
Search for k-nearest neighbors for the given query point (zero-copy).
[in] | index | a valid index representing a valid query point in the dataset given by setInputCloud. If indices were given in setInputCloud, index will be the position in the indices vector. |
[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!) |
asserts | in debug mode if the index is not between 0 and the maximum number of points |
Reimplemented in pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >, and pcl::search::Octree< PointInT >.
Definition at line 95 of file search.hpp.
|
inline |
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. PointXYZRGBA instead of PointXYZ).
[in] | cloud | the point cloud data |
[in] | indices | a vector of point cloud indices to query for nearest neighbors |
[in] | k | the number of neighbors to search for |
[out] | k_indices | the resultant indices of the neighboring points, k_indices[i] corresponds to the neighbors of the query point i |
[out] | k_sqr_distances | the resultant squared distances to the neighboring points, k_sqr_distances[i] corresponds to the neighbors of the query point i |
Definition at line 231 of file search.h.
References pcl::search::Search< PointT >::nearestKSearch(), pcl::PointCloud< PointT >::resize(), and pcl::PointCloud< PointT >::size().
|
inline |
Search for k-nearest neighbors for the given query point.
This method accepts a different template parameter for the point type.
[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!) |
Definition at line 159 of file search.h.
References pcl::copyPoint(), and pcl::search::Search< PointT >::nearestKSearch().
|
virtual |
Search for all the nearest neighbors of the query point in a given radius.
[in] | cloud | the point cloud data |
[in] | indices | the indices in cloud. If indices is empty, neighbors will be searched for all points. |
[in] | radius | the radius of the sphere bounding all of p_q's neighbors |
[out] | k_indices | the resultant indices of the neighboring points, k_indices[i] corresponds to the neighbors of the query point i |
[out] | k_sqr_distances | the resultant squared distances to the neighboring points, k_sqr_distances[i] corresponds to the neighbors of the query point i |
[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 in pcl::search::FlannSearch< PointT, FlannDistance >.
Definition at line 162 of file search.hpp.
References pcl::PointCloud< PointT >::size().
|
virtual |
Search for all the nearest neighbors of the query point in a given radius.
[in] | cloud | the point cloud data |
[in] | index | a valid index in cloud representing a valid (i.e., finite) 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. |
asserts | in debug mode if the index is not between 0 and the maximum number of points |
Definition at line 136 of file search.hpp.
References pcl::PointCloud< PointT >::size().
|
pure virtual |
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. |
Implemented in pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >, pcl::search::OrganizedNeighbor< PointT >, pcl::search::BruteForce< PointT >, pcl::search::FlannSearch< PointT, FlannDistance >, pcl::search::KdTree< PointT, Tree >, and pcl::search::KdTree< SceneT >.
Referenced by pcl::search::Search< PointT >::radiusSearchT(), and pcl::search::Search< PointT >::radiusSearchT().
|
virtual |
Search for all the nearest neighbors of the query point in a given radius (zero-copy).
[in] | index | a valid index representing a valid query point in the dataset given by setInputCloud. If indices were given in setInputCloud, index will be the position in the indices vector. |
[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. |
asserts | in debug mode if the index is not between 0 and the maximum number of points |
Reimplemented in pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >, and pcl::search::Octree< PointInT >.
Definition at line 147 of file search.hpp.
|
inline |
Search for all the nearest neighbors of the query points in a given radius.
[in] | cloud | the point cloud data |
[in] | indices | a vector of point cloud indices to query for nearest neighbors |
[in] | radius | the radius of the sphere bounding all of p_q's neighbors |
[out] | k_indices | the resultant indices of the neighboring points, k_indices[i] corresponds to the neighbors of the query point i |
[out] | k_sqr_distances | the resultant squared distances to the neighboring points, k_sqr_distances[i] corresponds to the neighbors of the query point i |
[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. |
Definition at line 370 of file search.h.
References pcl::search::Search< PointT >::radiusSearch(), pcl::PointCloud< PointT >::resize(), and pcl::PointCloud< PointT >::size().
|
inline |
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. |
Definition at line 287 of file search.h.
References pcl::copyPoint(), and pcl::search::Search< PointT >::radiusSearch().
|
virtual |
Pass the input dataset that the search will be performed on.
[in] | cloud | a const pointer to the PointCloud data |
[in] | indices | the point indices subset that is to be used from the cloud |
Reimplemented in pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >, pcl::search::FlannSearch< PointT, FlannDistance >, pcl::search::KdTree< PointT, Tree >, pcl::search::KdTree< SceneT >, and pcl::search::OrganizedNeighbor< PointT >.
Definition at line 75 of file search.hpp.
|
virtual |
sets whether the results should be sorted (ascending in the distance) or not
[in] | sorted | should be true if the results should be sorted by the distance in ascending order. Otherwise the results may be returned in any order. |
Reimplemented in pcl::search::KdTree< PointT, Tree >, and pcl::search::KdTree< SceneT >.
Definition at line 61 of file search.hpp.
|
protected |
Definition at line 188 of file search.hpp.
Referenced by pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >::radiusSearch(), pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >::radiusSearch(), and pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >::radiusSearch().
|
protected |
Definition at line 404 of file search.h.
Referenced by pcl::search::Search< PointT >::getIndices(), pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >::setInputCloud(), pcl::search::OrganizedNeighbor< PointT >::setInputCloud(), and pcl::search::FlannSearch< PointT, FlannDistance >::setPointRepresentation().
|
protected |
Definition at line 403 of file search.h.
Referenced by pcl::search::Search< PointT >::getInputCloud(), pcl::search::OrganizedNeighbor< PointT >::isValid(), pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >::setInputCloud(), pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT >::setInputCloud(), pcl::search::OrganizedNeighbor< PointT >::setInputCloud(), pcl::search::FlannSearch< PointT, FlannDistance >::setPointRepresentation(), and pcl::search::OrganizedNeighbor< PointT >::testPoint().
|
protected |
|
protected |