40 #ifndef PCL_SEGMENTATION_EUCLIDEAN_CLUSTER_COMPARATOR_H_ 41 #define PCL_SEGMENTATION_EUCLIDEAN_CLUSTER_COMPARATOR_H_ 43 #include <pcl/segmentation/boost.h> 44 #include <pcl/segmentation/comparator.h> 49 namespace experimental
51 template<
typename Po
intT,
typename Po
intLT = pcl::Label>
66 typedef boost::shared_ptr<EuclideanClusterComparator<PointT, PointLT> >
Ptr;
67 typedef boost::shared_ptr<const EuclideanClusterComparator<PointT, PointLT> >
ConstPtr;
84 Eigen::Matrix3f rot =
input_->sensor_orientation_.toRotationMatrix ();
115 const ExcludeLabelSetConstPtr&
140 const uint32_t &label1 = (*labels_)[idx1].label;
141 const uint32_t &label2 = (*labels_)[idx2].label;
143 const std::set<uint32_t>::const_iterator it1 =
exclude_labels_->find (label1);
147 const std::set<uint32_t>::const_iterator it2 =
exclude_labels_->find (label2);
155 Eigen::Vector3f vec =
input_->points[idx1].getVector3fMap ();
157 dist_threshold *= z * z;
160 const float dist = ((*input_)[idx1].getVector3fMap ()
161 - (*input_)[idx2].getVector3fMap ()).norm ();
162 return (dist < dist_threshold);
196 template<
typename Po
intT,
typename Po
intNT,
typename Po
intLT = deprecated::T>
209 typedef boost::shared_ptr<EuclideanClusterComparator<PointT, PointNT, PointLT> >
Ptr;
210 typedef boost::shared_ptr<const EuclideanClusterComparator<PointT, PointNT, PointLT> >
ConstPtr;
215 PCL_DEPRECATED (
"Remove PointNT from template parameters.")
218 , angular_threshold_ (0.0f)
225 PCL_DEPRECATED (
"EuclideadClusterComparator never actually used normals and angular threshold, " 226 "this function has no effect on the behavior of the comparator. Therefore it is " 227 "deprecated and will be removed in future releases.")
228 setInputNormals (const PointCloudNConstPtr& normals) { normals_ = normals; }
232 PCL_DEPRECATED (
"EuclideadClusterComparator never actually used normals and angular threshold, " 233 "this function has no effect on the behavior of the comparator. Therefore it is " 234 "deprecated and will be removed in future releases.")
235 getInputNormals ()
const {
return (normals_); }
241 PCL_DEPRECATED (
"EuclideadClusterComparator never actually used normals and angular threshold, " 242 "this function has no effect on the behavior of the comparator. Therefore it is " 243 "deprecated and will be removed in future releases.")
244 setAngularThreshold (
float angular_threshold)
246 angular_threshold_ = std::cos (angular_threshold);
251 PCL_DEPRECATED (
"EuclideadClusterComparator never actually used normals and angular threshold, " 252 "this function has no effect on the behavior of the comparator. Therefore it is " 253 "deprecated and will be removed in future releases.")
254 getAngularThreshold ()
const {
return (std::acos (angular_threshold_) ); }
260 PCL_DEPRECATED (
"Use setExcludeLabels (const ExcludeLabelSetConstPtr &) instead")
264 for (uint32_t i = 0; i < exclude_labels.size (); ++i)
265 if (exclude_labels[i])
276 template<
typename Po
intT,
typename Po
intLT>
281 #endif // PCL_SEGMENTATION_PLANE_COEFFICIENT_COMPARATOR_H_ PointCloud::ConstPtr PointCloudConstPtr
PointCloudNConstPtr normals_
void setExcludeLabels(const ExcludeLabelSetConstPtr &exclude_labels)
Set labels in the label cloud to exclude.
PointCloudL::Ptr PointCloudLPtr
This file defines compatibility wrappers for low level I/O functions.
PointCloudN::Ptr PointCloudNPtr
boost::shared_ptr< EuclideanClusterComparator< PointT, PointLT > > Ptr
Comparator is the base class for comparators that compare two points given some function.
boost::shared_ptr< PointCloud< PointT > > Ptr
void setLabels(const PointCloudLPtr &labels)
Set label cloud.
boost::shared_ptr< const EuclideanClusterComparator< PointT, PointNT, PointLT > > ConstPtr
Defines all the PCL implemented PointT point type structures.
PointCloudN::ConstPtr PointCloudNConstPtr
boost::shared_ptr< const EuclideanClusterComparator< PointT, PointLT > > ConstPtr
pcl::PointCloud< PointNT > PointCloudN
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
void setDistanceThreshold(float distance_threshold, bool depth_dependent)
Set the tolerance in meters for difference in perpendicular distance (d component of plane equation) ...
PointCloud represents the base class in PCL for storing collections of 3D points. ...
float getDistanceThreshold() const
Get the distance threshold in meters (d component of plane equation) between neighboring points...
PointCloudL::ConstPtr PointCloudLConstPtr
boost::shared_ptr< EuclideanClusterComparator< PointT, PointNT, PointLT > > Ptr
pcl::PointCloud< PointLT > PointCloudL
virtual bool compare(int idx1, int idx2) const
Compare points at two indices by their euclidean distance.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud for the comparator.
PointCloudConstPtr input_
A point structure representing Euclidean xyz coordinates, and the RGB color.
const ExcludeLabelSetConstPtr & getExcludeLabels() const
EuclideanClusterComparator is a comparator used for finding clusters based on euclidian distance...
float distance_threshold_
boost::shared_ptr< const ExcludeLabelSet > ExcludeLabelSetConstPtr
PointCloudLPtr labels_
Set of labels with similar size as the input point cloud, aggregating points into groups based on a s...
boost::shared_ptr< ExcludeLabelSet > ExcludeLabelSetPtr
EuclideanClusterComparator()
Default constructor for EuclideanClusterComparator.
std::set< uint32_t > ExcludeLabelSet
ExcludeLabelSetConstPtr exclude_labels_
Specifies which labels should be excluded com being clustered.