38 #ifndef PCL_SEGMENTATION_CONDITIONAL_EUCLIDEAN_CLUSTERING_H_ 39 #define PCL_SEGMENTATION_CONDITIONAL_EUCLIDEAN_CLUSTERING_H_ 41 #include <boost/function.hpp> 43 #include <pcl/pcl_base.h> 44 #include <pcl/search/pcl_search.h> 82 template<
typename Po
intT>
99 condition_function_ (),
100 cluster_tolerance_ (0.0f),
101 min_cluster_size_ (1),
102 max_cluster_size_ (
std::numeric_limits<int>::max ()),
103 extract_removed_clusters_ (extract_removed_clusters),
104 small_clusters_ (new
pcl::IndicesClusters),
105 large_clusters_ (new
pcl::IndicesClusters)
120 inline const SearcherPtr&
146 condition_function_ = condition_function;
154 condition_function_ = condition_function;
165 cluster_tolerance_ = cluster_tolerance;
172 return (cluster_tolerance_);
181 min_cluster_size_ = min_cluster_size;
188 return (min_cluster_size_);
197 max_cluster_size_ = max_cluster_size;
204 return (max_cluster_size_);
217 segment (IndicesClusters &clusters);
227 if (!extract_removed_clusters_)
229 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");
232 small_clusters = small_clusters_;
233 large_clusters = large_clusters_;
238 SearcherPtr searcher_;
241 boost::function<bool (const PointT&, const PointT&, float)> condition_function_;
244 float cluster_tolerance_;
247 int min_cluster_size_;
250 int max_cluster_size_;
253 bool extract_removed_clusters_;
262 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
266 #ifdef PCL_NO_PRECOMPILE 267 #include <pcl/segmentation/impl/conditional_euclidean_clustering.hpp> 270 #endif // PCL_SEGMENTATION_CONDITIONAL_EUCLIDEAN_CLUSTERING_H_ void setSearchMethod(const SearcherPtr &tree)
Provide a pointer to the search object.
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 segment(IndicesClusters &clusters)
Segment the input into separate clusters.
This file defines compatibility wrappers for low level I/O functions.
int getMaxClusterSize()
Get the maximum number of points that a cluster needs to contain in order to be considered valid...
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.
void getRemovedClusters(IndicesClustersPtr &small_clusters, IndicesClustersPtr &large_clusters)
Get the clusters that are invalidated due to size constraints.
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...
boost::shared_ptr< pcl::search::Search< PointT > > Ptr
ConditionalEuclideanClustering performs segmentation based on Euclidean distance and a user-defined c...
void setConditionFunction(boost::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...
pcl::search::Search< PointT >::Ptr SearcherPtr
int getMinClusterSize()
Get the minimum number of points that a cluster needs to contain in order to be considered valid...
float getClusterTolerance()
Get the spatial tolerance for new cluster candidates.
ConditionalEuclideanClustering(bool extract_removed_clusters=false)
Constructor.
boost::shared_ptr< std::vector< pcl::PointIndices > > IndicesClustersPtr
A point structure representing Euclidean xyz coordinates, and the RGB color.
const SearcherPtr & getSearchMethod() const
Get a pointer to the search method used.
std::vector< pcl::PointIndices > IndicesClusters