46#include <pcl/segmentation/comparator.h>
55 template<
typename Po
intT,
typename Po
intLT = pcl::Label>
70 using Ptr = shared_ptr<EuclideanClusterComparator<PointT, PointLT> >;
71 using ConstPtr = shared_ptr<const EuclideanClusterComparator<PointT, PointLT> >;
84 Eigen::Matrix3f rot =
input_->sensor_orientation_.toRotationMatrix ();
155 const std::uint32_t &label1 = (*labels_)[idx1].label;
156 const std::uint32_t &label2 = (*labels_)[idx2].label;
158 const std::set<std::uint32_t>::const_iterator it1 =
exclude_labels_->find (label1);
162 const std::set<std::uint32_t>::const_iterator it2 =
exclude_labels_->find (label2);
170 Eigen::Vector3f vec = (*input_)[idx1].getVector3fMap ();
172 dist_threshold *= z * z;
175 const float dist = ((*input_)[idx1].getVector3fMap ()
176 - (*input_)[idx2].getVector3fMap ()).norm ();
177 return (dist < dist_threshold);
Comparator is the base class for comparators that compare two points given some function.
PointCloudConstPtr input_
typename PointCloud::ConstPtr PointCloudConstPtr
EuclideanClusterComparator is a comparator used for finding clusters based on euclidean distance.
std::set< std::uint32_t > ExcludeLabelSet
ExcludeLabelSetConstPtr exclude_labels_
Specifies which labels should be excluded com being clustered.
float getDistanceThreshold() const
Get the distance threshold in meters (d component of plane equation) between neighboring points,...
bool compare(int idx1, int idx2) const override
Compare points at two indices by their euclidean distance.
bool getDepthDependent() const
Get if depth dependent.
const ExcludeLabelSetConstPtr & getExcludeLabels() const
Get exclude labels.
void setExcludeLabels(const ExcludeLabelSetConstPtr &exclude_labels)
Set labels in the label cloud to exclude.
const PointCloudLPtr & getLabels() const
Get labels.
void setInputCloud(const PointCloudConstPtr &cloud) override
Set the input cloud for the comparator.
shared_ptr< const EuclideanClusterComparator< PointT, PointLT > > ConstPtr
PointCloudLPtr labels_
Set of labels with similar size as the input point cloud, aggregating points into groups based on a s...
typename PointCloudL::ConstPtr PointCloudLConstPtr
shared_ptr< ExcludeLabelSet > ExcludeLabelSetPtr
shared_ptr< EuclideanClusterComparator< PointT, PointLT > > Ptr
shared_ptr< const ExcludeLabelSet > ExcludeLabelSetConstPtr
void setDistanceThreshold(float distance_threshold, bool depth_dependent)
Set the tolerance in meters for difference in perpendicular distance (d component of plane equation) ...
pcl::PointCloud< PointLT > PointCloudL
float distance_threshold_
typename PointCloudL::Ptr PointCloudLPtr
EuclideanClusterComparator()=default
Default constructor for EuclideanClusterComparator.
void setLabels(const PointCloudLPtr &labels)
Set label cloud.
PointCloud represents the base class in PCL for storing collections of 3D points.
Defines all the PCL implemented PointT point type structures.
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.
A point structure representing Euclidean xyz coordinates, and the RGB color.