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> 53 template<
typename Po
intT,
typename Po
intNT,
typename Po
intLT>
68 typedef boost::shared_ptr<EuclideanClusterComparator<PointT, PointNT, PointLT> >
Ptr;
69 typedef boost::shared_ptr<const EuclideanClusterComparator<PointT, PointNT, PointLT> >
ConstPtr;
93 Eigen::Matrix3f rot =
input_->sensor_orientation_.toRotationMatrix ();
107 inline PointCloudNConstPtr
162 exclude_labels_ = boost::make_shared<std::vector<bool> >(exclude_labels);
173 int label1 =
labels_->points[idx1].label;
174 int label2 =
labels_->points[idx2].label;
176 if (label1 == -1 || label2 == -1)
185 Eigen::Vector3f vec =
input_->points[idx1].getVector3fMap ();
187 dist_threshold *= z * z;
190 float dx =
input_->points[idx1].x -
input_->points[idx2].x;
191 float dy =
input_->points[idx1].y -
input_->points[idx2].y;
192 float dz =
input_->points[idx1].z -
input_->points[idx2].z;
193 float dist = sqrtf (dx*dx + dy*dy + dz*dz);
195 return (dist < dist_threshold);
210 #endif // PCL_SEGMENTATION_PLANE_COEFFICIENT_COMPARATOR_H_ PointCloud::ConstPtr PointCloudConstPtr
PointCloudNConstPtr normals_
float getAngularThreshold() const
Get the angular threshold in radians for difference in normal direction between neighboring points...
Comparator< PointT >::PointCloudConstPtr PointCloudConstPtr
pcl::PointCloud< PointLT > PointCloudL
virtual bool compare(int idx1, int idx2) const
Compare points at two indices by their plane equations.
void setExcludeLabels(std::vector< bool > &exclude_labels)
Set labels in the label cloud to exclude.
PointCloudN::Ptr PointCloudNPtr
PointCloudNConstPtr getInputNormals() const
Get the input normals.
Comparator is the base class for comparators that compare two points given some function.
boost::shared_ptr< PointCloud< PointNT > > Ptr
boost::shared_ptr< const EuclideanClusterComparator< PointT, PointNT, PointLT > > ConstPtr
void setDistanceThreshold(float distance_threshold, bool depth_dependent)
Set the tolerance in meters for difference in perpendicular distance (d component of plane equation) ...
PointCloudN::ConstPtr PointCloudNConstPtr
float distance_threshold_
virtual ~EuclideanClusterComparator()
Destructor for EuclideanClusterComparator.
virtual void setAngularThreshold(float angular_threshold)
Set the tolerance in radians for difference in normal direction between neighboring points...
EuclideanClusterComparator()
Empty constructor for EuclideanClusterComparator.
virtual void setInputCloud(const PointCloudConstPtr &cloud)
Set the input cloud for the comparator.
boost::shared_ptr< std::vector< bool > > exclude_labels_
PointCloudL::Ptr PointCloudLPtr
pcl::PointCloud< PointNT > PointCloudN
boost::shared_ptr< const PointCloud< PointNT > > ConstPtr
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...
boost::shared_ptr< EuclideanClusterComparator< PointT, PointNT, PointLT > > Ptr
PointCloudConstPtr input_
EuclideanClusterComparator is a comparator used for finding clusters supported by planar surfaces...
void setLabels(PointCloudLPtr &labels)
Set label cloud.
PointCloudL::ConstPtr PointCloudLConstPtr
Comparator< PointT >::PointCloud PointCloud
void setInputNormals(const PointCloudNConstPtr &normals)
Provide a pointer to the input normals.