38#ifndef PCL_SEGMENTATION_IMPL_EXTRACT_CLUSTERS_H_
39#define PCL_SEGMENTATION_IMPL_EXTRACT_CLUSTERS_H_
41#include <pcl/segmentation/extract_clusters.h>
42#include <pcl/search/organized.h>
45template <
typename Po
intT>
void
52 if (tree->getInputCloud ()->size () != cloud.
size ())
54 PCL_ERROR(
"[pcl::extractEuclideanClusters] Tree built for a different point cloud "
55 "dataset (%zu) than the input cloud (%zu)!\n",
56 static_cast<std::size_t
>(tree->getInputCloud()->size()),
57 static_cast<std::size_t
>(cloud.
size()));
118 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",
126template <
typename Po
intT>
void
136 if (tree->getInputCloud()->size() != cloud.
size()) {
137 PCL_ERROR(
"[pcl::extractEuclideanClusters] Tree built for a different point cloud "
138 "dataset (%zu) than the input cloud (%zu)!\n",
139 static_cast<std::size_t
>(tree->getInputCloud()->size()),
140 static_cast<std::size_t
>(cloud.
size()));
143 if (tree->getIndices()->size() != indices.size()) {
144 PCL_ERROR(
"[pcl::extractEuclideanClusters] Tree built for a different set of "
145 "indices (%zu) than the input set (%zu)!\n",
146 static_cast<std::size_t
>(tree->getIndices()->size()),
159 for (
const auto &index : indices)
176 PCL_ERROR(
"[pcl::extractEuclideanClusters] Received error code -1 from radiusSearch\n");
217 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",
227template <
typename Po
intT>
void
230 if (!initCompute () ||
231 (input_ && input_->points.empty ()) ||
232 (indices_ && indices_->empty ()))
241 if (input_->isOrganized ())
248 tree_->setInputCloud (input_, indices_);
260#define PCL_INSTANTIATE_EuclideanClusterExtraction(T) template class PCL_EXPORTS pcl::EuclideanClusterExtraction<T>;
261#define PCL_INSTANTIATE_extractEuclideanClusters(T) template void PCL_EXPORTS pcl::extractEuclideanClusters<T>(const pcl::PointCloud<T> &, const typename pcl::search::Search<T>::Ptr &, float , std::vector<pcl::PointIndices> &, unsigned int, unsigned int);
262#define PCL_INSTANTIATE_extractEuclideanClusters_indices(T) template void PCL_EXPORTS pcl::extractEuclideanClusters<T>(const pcl::PointCloud<T> &, const pcl::Indices &, const typename pcl::search::Search<T>::Ptr &, float , std::vector<pcl::PointIndices> &, unsigned int, unsigned int);
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...
OrganizedNeighbor is a class for optimized nearest neigbhor search in organized point clouds.
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).
IndicesAllocator<> Indices
Type used for indices in PCL.