39 #ifndef PCL_SEARCH_OCTREE_H
40 #define PCL_SEARCH_OCTREE_H
42 #include <pcl/search/search.h>
43 #include <pcl/octree/octree_search.h>
73 typedef boost::shared_ptr<pcl::search::Octree<PointT,LeafTWrap,BranchTWrap,OctreeT> >
Ptr;
74 typedef boost::shared_ptr<const pcl::search::Octree<PointT,LeafTWrap,BranchTWrap,OctreeT> >
ConstPtr;
97 ,
tree_ (new pcl::octree::OctreePointCloudSearch<
PointT, LeafTWrap, BranchTWrap> (resolution))
113 tree_->deleteTree ();
114 tree_->setInputCloud (cloud);
115 tree_->addPointsFromInputCloud ();
126 tree_->deleteTree ();
127 tree_->setInputCloud (cloud, indices);
128 tree_->addPointsFromInputCloud ();
144 std::vector<float> &k_sqr_distances)
const
146 return (
tree_->nearestKSearch (cloud, index, k, k_indices, k_sqr_distances));
159 std::vector<float> &k_sqr_distances)
const
161 return (
tree_->nearestKSearch (point, k, k_indices, k_sqr_distances));
176 nearestKSearch (
int index,
int k, std::vector<int> &k_indices, std::vector<float> &k_sqr_distances)
const
178 return (
tree_->nearestKSearch (index, k, k_indices, k_sqr_distances));
194 std::vector<int> &k_indices,
195 std::vector<float> &k_sqr_distances,
196 unsigned int max_nn = 0)
const
198 tree_->radiusSearch (cloud, index, radius, k_indices, k_sqr_distances, max_nn);
201 return (static_cast<int> (k_indices.size ()));
215 std::vector<int> &k_indices,
216 std::vector<float> &k_sqr_distances,
217 unsigned int max_nn = 0)
const
219 tree_->radiusSearch (p_q, radius, k_indices, k_sqr_distances, max_nn);
222 return (static_cast<int> (k_indices.size ()));
236 std::vector<float> &k_sqr_distances,
unsigned int max_nn = 0)
const
238 tree_->radiusSearch (index, radius, k_indices, k_sqr_distances, max_nn);
241 return (static_cast<int> (k_indices.size ()));
256 return (
tree_->approxNearestSearch (cloud->points[query_index], result_index, sqr_distance));
267 return (
tree_->approxNearestSearch (p_q, result_index, sqr_distance));
280 return (
tree_->approxNearestSearch (query_index, result_index, sqr_distance));
287 #ifdef PCL_NO_PRECOMPILE
288 #include <pcl/octree/impl/octree_search.hpp>
290 #define PCL_INSTANTIATE_Octree(T) template class PCL_EXPORTS pcl::search::Octree<T>;
293 #endif // PCL_SEARCH_OCTREE_H
boost::shared_ptr< pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT > > Ptr
boost::shared_ptr< const std::vector< int > > IndicesConstPtr
PointCloudConstPtr input_
search::Octree is a wrapper class which implements nearest neighbor search operations based on the pc...
void setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices)
Provide a pointer to the input dataset.
void sortResults(std::vector< int > &indices, std::vector< float > &distances) const
boost::shared_ptr< std::vector< int > > IndicesPtr
Octree container class that does store a vector of point indices.
void approxNearestSearch(const PointT &p_q, int &result_index, float &sqr_distance)
Search for approximate nearest neighbor at the query point.
void approxNearestSearch(int query_index, int &result_index, float &sqr_distance)
Search for approximate nearest neighbor at the query point.
pcl::PointCloud< PointT > PointCloud
boost::shared_ptr< pcl::octree::OctreePointCloudSearch< PointT, LeafTWrap, BranchTWrap > > OctreePointCloudSearchPtr
int radiusSearch(int index, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const
search for all neighbors of query point that are within a given radius.
int radiusSearch(const PointCloud &cloud, int index, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const
search for all neighbors of query point that are within a given radius.
boost::shared_ptr< const pcl::octree::OctreePointCloudSearch< PointT, LeafTWrap, BranchTWrap > > OctreePointCloudSearchConstPtr
int nearestKSearch(const PointCloud &cloud, int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
Search for the k-nearest neighbors for the given query point.
boost::shared_ptr< const PointCloud > PointCloudConstPtr
int nearestKSearch(int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
Search for the k-nearest neighbors for the given query point (zero-copy).
OctreePointCloudSearchPtr tree_
int nearestKSearch(const PointT &point, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances) const
Search for the k-nearest neighbors for the given query point.
virtual ~Octree()
Empty Destructor.
void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
Octree(const double resolution)
Octree constructor.
int radiusSearch(const PointT &p_q, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const
search for all neighbors of query point that are within a given radius.
boost::shared_ptr< const pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT > > ConstPtr
boost::shared_ptr< PointCloud > PointCloudPtr
Octree container class that does not store any information.
A point structure representing Euclidean xyz coordinates, and the RGB color.
void approxNearestSearch(const PointCloudConstPtr &cloud, int query_index, int &result_index, float &sqr_distance)
Search for approximate nearest neighbor at the query point.