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 extract_removed_clusters_ (extract_removed_clusters),
145 condition_function_ = condition_function;
153 condition_function_ = condition_function;
164 cluster_tolerance_ = cluster_tolerance;
171 return (cluster_tolerance_);
180 min_cluster_size_ = min_cluster_size;
187 return (min_cluster_size_);
196 max_cluster_size_ = max_cluster_size;
203 return (max_cluster_size_);
226 if (!extract_removed_clusters_)
228 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");
231 small_clusters = small_clusters_;
232 large_clusters = large_clusters_;
240 std::function<bool (
const PointT&,
const PointT&,
float)> condition_function_;
243 float cluster_tolerance_{0.0f};
246 int min_cluster_size_{1};
249 int max_cluster_size_{std::numeric_limits<int>::max ()};
252 bool extract_removed_clusters_;
265 #ifdef PCL_NO_PRECOMPILE
266 #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.
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.
const SearcherPtr & getSearchMethod() const
Get a pointer to the search method used.
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.
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.