42 #include <pcl/memory.h>
43 #include <pcl/pcl_macros.h>
44 #include <pcl/point_types.h>
45 #include <pcl/segmentation/boost.h>
46 #include <pcl/segmentation/comparator.h>
51 namespace experimental
53 template<
typename Po
intT,
typename Po
intLT = pcl::Label>
68 using Ptr = shared_ptr<EuclideanClusterComparator<PointT, PointLT> >;
69 using ConstPtr = shared_ptr<const EuclideanClusterComparator<PointT, PointLT> >;
85 Eigen::Matrix3f rot =
input_->sensor_orientation_.toRotationMatrix ();
141 const std::uint32_t &label1 = (*labels_)[idx1].label;
142 const std::uint32_t &label2 = (*labels_)[idx2].label;
144 const std::set<std::uint32_t>::const_iterator it1 =
exclude_labels_->find (label1);
148 const std::set<std::uint32_t>::const_iterator it2 =
exclude_labels_->find (label2);
156 Eigen::Vector3f vec =
input_->points[idx1].getVector3fMap ();
158 dist_threshold *= z * z;
161 const float dist = ((*input_)[idx1].getVector3fMap ()
162 - (*input_)[idx2].getVector3fMap ()).norm ();
163 return (dist < dist_threshold);
197 template<
typename Po
intT,
typename Po
intNT,
typename Po
intLT = deprecated::T>
210 using Ptr = shared_ptr<EuclideanClusterComparator<PointT, PointNT, PointLT> >;
211 using ConstPtr = shared_ptr<const EuclideanClusterComparator<PointT, PointNT, PointLT> >;
216 PCL_DEPRECATED(1, 12,
"remove PointNT from template parameters")
225 PCL_DEPRECATED(1, 12,
"EuclideadClusterComparator never actually used normals and angular threshold, this function has no effect on the behavior of the comparator. It is deprecated and will be removed in future releases.")
230 PCL_DEPRECATED(1, 12,
"EuclideadClusterComparator never actually used normals and angular threshold, this function has no effect on the behavior of the comparator. It is deprecated and will be removed in future releases.")
237 PCL_DEPRECATED(1, 12,
"EuclideadClusterComparator never actually used normals and angular threshold, this function has no effect on the behavior of the comparator. It is deprecated and will be removed in future releases.")
245 PCL_DEPRECATED(1, 12,
"EuclideadClusterComparator never actually used normals and angular threshold, this function has no effect on the behavior of the comparator. It is deprecated and will be removed in future releases.")
252 PCL_DEPRECATED(1, 12,
"use setExcludeLabels(const ExcludeLabelSetConstPtr &) instead")
257 for (std::size_t i = 0; i < exclude_labels.size (); ++i)
258 if (exclude_labels[i])
269 template<
typename Po
intT,
typename Po
intLT>
PointCloudNConstPtr normals_
void setExcludeLabels(const ExcludeLabelSetConstPtr &exclude_labels)
Set labels in the label cloud to exclude.
shared_ptr< PointCloud< PointT > > Ptr
float getAngularThreshold() const
Get the angular threshold in radians for difference in normal direction between neighboring points...
typename PointCloud::ConstPtr PointCloudConstPtr
void setInputCloud(const PointCloudConstPtr &cloud) override
Set the input cloud for the comparator.
shared_ptr< ExcludeLabelSet > ExcludeLabelSetPtr
PointCloudNConstPtr getInputNormals() const
Get the input normals.
Comparator is the base class for comparators that compare two points given some function.
void setLabels(const PointCloudLPtr &labels)
Set label cloud.
shared_ptr< const Comparator< PointT > > ConstPtr
typename PointCloudN::Ptr PointCloudNPtr
void setDistanceThreshold(float distance_threshold, bool depth_dependent)
Set the tolerance in meters for difference in perpendicular distance (d component of plane equation) ...
std::set< std::uint32_t > ExcludeLabelSet
const ExcludeLabelSetConstPtr & getExcludeLabels() const
typename PointCloudL::Ptr PointCloudLPtr
PointCloud represents the base class in PCL for storing collections of 3D points. ...
typename PointCloudL::ConstPtr PointCloudLConstPtr
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.
shared_ptr< const PointCloud< PointT > > ConstPtr
shared_ptr< Comparator< PointT > > Ptr
PointCloudConstPtr input_
A point structure representing Euclidean xyz coordinates, and the RGB color.
EuclideanClusterComparator is a comparator used for finding clusters based on euclidian distance...
typename PointCloudN::ConstPtr PointCloudNConstPtr
void setExcludeLabels(const std::vector< bool > &exclude_labels)
Set labels in the label cloud to exclude.
float distance_threshold_
void setAngularThreshold(float angular_threshold)
Set the tolerance in radians for difference in normal direction between neighboring points...
PointCloudLPtr labels_
Set of labels with similar size as the input point cloud, aggregating points into groups based on a s...
void setInputNormals(const PointCloudNConstPtr &normals)
Provide a pointer to the input normals.
shared_ptr< const ExcludeLabelSet > ExcludeLabelSetConstPtr
EuclideanClusterComparator()
Default constructor for EuclideanClusterComparator.
ExcludeLabelSetConstPtr exclude_labels_
Specifies which labels should be excluded com being clustered.