43 #include <pcl/memory.h>
44 #include <pcl/pcl_macros.h>
45 #include <pcl/point_types.h>
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);
bool compare(int idx1, int idx2) const override
Compare points at two indices by their euclidean distance.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const ExcludeLabelSet > ExcludeLabelSetConstPtr
typename PointCloud::ConstPtr PointCloudConstPtr
const ExcludeLabelSetConstPtr & getExcludeLabels() const
Get exclude labels.
void setDistanceThreshold(float distance_threshold, bool depth_dependent)
Set the tolerance in meters for difference in perpendicular distance (d component of plane equation) ...
typename PointCloudL::Ptr PointCloudLPtr
PointCloudLPtr labels_
Set of labels with similar size as the input point cloud, aggregating points into groups based on a s...
void setExcludeLabels(const ExcludeLabelSetConstPtr &exclude_labels)
Set labels in the label cloud to exclude.
typename PointCloudL::ConstPtr PointCloudLConstPtr
void setLabels(const PointCloudLPtr &labels)
Set label cloud.
Comparator is the base class for comparators that compare two points given some function.
float getDistanceThreshold() const
Get the distance threshold in meters (d component of plane equation) between neighboring points...
ExcludeLabelSetConstPtr exclude_labels_
Specifies which labels should be excluded com being clustered.
shared_ptr< const Comparator< PointT > > ConstPtr
shared_ptr< ExcludeLabelSet > ExcludeLabelSetPtr
bool getDepthDependent() const
Get if depth dependent.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
EuclideanClusterComparator()=default
Default constructor for EuclideanClusterComparator.
shared_ptr< const PointCloud< PointT > > ConstPtr
shared_ptr< Comparator< PointT > > Ptr
PointCloudConstPtr input_
EuclideanClusterComparator is a comparator used for finding clusters based on euclidean distance...
void setInputCloud(const PointCloudConstPtr &cloud) override
Set the input cloud for the comparator.
float distance_threshold_
std::set< std::uint32_t > ExcludeLabelSet
const PointCloudLPtr & getLabels() const
Get labels.