40 #ifndef PCL_SEGMENTATION_EDGE_AWARE_PLANE_COMPARATOR_H_
41 #define PCL_SEGMENTATION_EDGE_AWARE_PLANE_COMPARATOR_H_
44 #include <boost/make_shared.hpp>
54 template<
typename Po
intT,
typename Po
intNT>
65 typedef boost::shared_ptr<EdgeAwarePlaneComparator<PointT, PointNT> >
Ptr;
66 typedef boost::shared_ptr<const EdgeAwarePlaneComparator<PointT, PointNT> >
ConstPtr;
83 distance_map_ (distance_map)
100 distance_map_ = distance_map;
107 return (distance_map_);
116 compare (
int idx1,
int idx2)
const
118 float dx = input_->points[idx1].x - input_->points[idx2].x;
119 float dy = input_->points[idx1].y - input_->points[idx2].y;
120 float dz = input_->points[idx1].z - input_->points[idx2].z;
121 float dist = sqrtf (dx*dx + dy*dy + dz*dz);
123 bool normal_ok = (normals_->points[idx1].getNormalVector3fMap ().dot (normals_->points[idx2].getNormalVector3fMap () ) > angular_threshold_ );
124 bool dist_ok = (dist < distance_threshold_);
126 bool curvature_ok = normals_->points[idx1].curvature < 0.04;
127 bool plane_d_ok = fabs ((*plane_coeff_d_)[idx1] - (*plane_coeff_d_)[idx2]) < 0.04;
129 if (distance_map_[idx1] < 5)
130 curvature_ok =
false;
132 return (dist_ok && normal_ok && curvature_ok && plane_d_ok);
136 const float* distance_map_;
140 #endif // PCL_SEGMENTATION_PLANE_COEFFICIENT_COMPARATOR_H_