42#include <pcl/console/print.h>
43#include <pcl/pcl_base.h>
45#include <pcl/search/search.h>
46#include <pcl/search/kdtree.h>
61 template <
typename Po
intT>
void
64 float tolerance, std::vector<PointIndices> &clusters,
65 unsigned int min_pts_per_cluster = 1,
unsigned int max_pts_per_cluster = (std::numeric_limits<int>::max) ());
79 template <
typename Po
intT>
void
83 unsigned int min_pts_per_cluster = 1,
unsigned int max_pts_per_cluster = (std::numeric_limits<int>::max) ());
102 template <
typename Po
intT,
typename Normal>
void
110 if (tree->getInputCloud ()->size () != cloud.
size ())
112 PCL_ERROR(
"[pcl::extractEuclideanClusters] Tree built for a different point "
113 "cloud dataset (%zu) than the input cloud (%zu)!\n",
114 static_cast<std::size_t
>(tree->getInputCloud()->size()),
115 static_cast<std::size_t
>(cloud.
size()));
118 if (cloud.
size () != normals.
size ())
120 PCL_ERROR(
"[pcl::extractEuclideanClusters] Number of points in the input point "
121 "cloud (%zu) different than normals (%zu)!\n",
122 static_cast<std::size_t
>(cloud.
size()),
123 static_cast<std::size_t
>(normals.
size()));
134 for (std::size_t i = 0; i < cloud.
size (); ++i)
191 PCL_DEBUG(
"[pcl::extractEuclideanClusters] This cluster has %zu points, which is not between %u and %u points, so it is not a final cluster\n",
216 template <
typename Po
intT,
typename Normal>
226 if (tree->getInputCloud()->size() != cloud.
size()) {
227 PCL_ERROR(
"[pcl::extractEuclideanClusters] Tree built for a different point "
228 "cloud dataset (%zu) than the input cloud (%zu)!\n",
229 static_cast<std::size_t
>(tree->getInputCloud()->size()),
230 static_cast<std::size_t
>(cloud.
size()));
233 if (tree->getIndices()->size() != indices.size()) {
234 PCL_ERROR(
"[pcl::extractEuclideanClusters] Tree built for a different set of "
235 "indices (%zu) than the input set (%zu)!\n",
236 static_cast<std::size_t
>(tree->getIndices()->size()),
240 if (cloud.
size() != normals.
size()) {
241 PCL_ERROR(
"[pcl::extractEuclideanClusters] Number of points in the input point "
242 "cloud (%zu) different than normals (%zu)!\n",
243 static_cast<std::size_t
>(cloud.
size()),
244 static_cast<std::size_t
>(normals.
size()));
311 PCL_DEBUG(
"[pcl::extractEuclideanClusters] This cluster has %zu points, which is not between %u and %u points, so it is not a final cluster\n",
324 template <
typename Po
intT>
440 virtual std::string
getClassName ()
const {
return (
"EuclideanClusterExtraction"); }
454#ifdef PCL_NO_PRECOMPILE
455#include <pcl/segmentation/impl/extract_clusters.hpp>
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
shared_ptr< KdTree< PointT > > Ptr
PointCloudConstPtr input_
The input point cloud dataset.
IndicesPtr indices_
A pointer to the vector of point indices to use.
bool initCompute()
This method should get called before starting the actual computation.
bool deinitCompute()
This method should get called after finishing the actual computation.
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
shared_ptr< pcl::search::Search< PointT > > Ptr
void extractEuclideanClusters(const PointCloud< PointT > &cloud, const typename search::Search< PointT >::Ptr &tree, float tolerance, std::vector< PointIndices > &clusters, unsigned int min_pts_per_cluster=1, unsigned int max_pts_per_cluster=(std::numeric_limits< int >::max)())
Decompose a region of space into clusters based on the Euclidean distance between points.
bool comparePointClusters(const pcl::PointIndices &a, const pcl::PointIndices &b)
Sort clusters method (for std::sort).
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
IndicesAllocator<> Indices
Type used for indices in PCL.
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.
shared_ptr< ::pcl::PointIndices > Ptr
shared_ptr< const ::pcl::PointIndices > ConstPtr