41#include <pcl/pcl_base.h>
43#include <pcl/console/print.h>
44#include <pcl/search/search.h>
84 template<
typename Po
intT>
101 condition_function_ (),
102 cluster_tolerance_ (0.0f),
103 min_cluster_size_ (1),
104 max_cluster_size_ (std::numeric_limits<int>::max ()),
105 extract_removed_clusters_ (extract_removed_clusters),
148 condition_function_ = condition_function;
156 condition_function_ = condition_function;
167 cluster_tolerance_ = cluster_tolerance;
174 return (cluster_tolerance_);
183 min_cluster_size_ = min_cluster_size;
190 return (min_cluster_size_);
199 max_cluster_size_ = max_cluster_size;
206 return (max_cluster_size_);
229 if (!extract_removed_clusters_)
231 PCL_WARN(
"[pcl::ConditionalEuclideanClustering::getRemovedClusters] You need to set extract_removed_clusters to true (in this class' constructor) if you want to use this functionality.\n");
234 small_clusters = small_clusters_;
235 large_clusters = large_clusters_;
243 std::function<bool (
const PointT&,
const PointT&,
float)> condition_function_;
246 float cluster_tolerance_;
249 int min_cluster_size_;
252 int max_cluster_size_;
255 bool extract_removed_clusters_;
268#ifdef PCL_NO_PRECOMPILE
269#include <pcl/segmentation/impl/conditional_euclidean_clustering.hpp>
ConditionalEuclideanClustering performs segmentation based on Euclidean distance and a user-defined c...
int getMaxClusterSize()
Get the maximum number of points that a cluster needs to contain in order to be considered valid.
void setMinClusterSize(int min_cluster_size)
Set the minimum number of points that a cluster needs to contain in order to be considered valid.
void setSearchMethod(const SearcherPtr &tree)
Provide a pointer to the search object.
const SearcherPtr & getSearchMethod() const
Get a pointer to the search method used.
void setConditionFunction(std::function< bool(const PointT &, const PointT &, float)> condition_function)
Set the condition that needs to hold for neighboring points to be considered part of the same cluster...
typename pcl::search::Search< PointT >::Ptr SearcherPtr
float getClusterTolerance()
Get the spatial tolerance for new cluster candidates.
void setConditionFunction(bool(*condition_function)(const PointT &, const PointT &, float))
Set the condition that needs to hold for neighboring points to be considered part of the same cluster...
void segment(IndicesClusters &clusters)
Segment the input into separate clusters.
void setMaxClusterSize(int max_cluster_size)
Set the maximum number of points that a cluster needs to contain in order to be considered valid.
void setClusterTolerance(float cluster_tolerance)
Set the spatial tolerance for new cluster candidates.
int getMinClusterSize()
Get the minimum number of points that a cluster needs to contain in order to be considered valid.
void getRemovedClusters(IndicesClustersPtr &small_clusters, IndicesClustersPtr &large_clusters)
Get the clusters that are invalidated due to size constraints.
ConditionalEuclideanClustering(bool extract_removed_clusters=false)
Constructor.
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.
shared_ptr< pcl::search::Search< PointT > > Ptr
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
shared_ptr< std::vector< pcl::PointIndices > > IndicesClustersPtr
std::vector< pcl::PointIndices > IndicesClusters
Defines all the PCL and non-PCL macros used.
A point structure representing Euclidean xyz coordinates, and the RGB color.