40 #ifndef PCL_RGB_SEGMENTATION_PLANE_COEFFICIENT_COMPARATOR_H_
41 #define PCL_RGB_SEGMENTATION_PLANE_COEFFICIENT_COMPARATOR_H_
44 #include <boost/make_shared.hpp>
54 template<
typename Po
intT,
typename Po
intNT>
65 typedef boost::shared_ptr<RGBPlaneCoefficientComparator<PointT, PointNT> >
Ptr;
66 typedef boost::shared_ptr<const RGBPlaneCoefficientComparator<PointT, PointNT> >
ConstPtr;
75 : color_threshold_ (50.0f)
99 color_threshold_ = color_threshold * color_threshold;
106 return (color_threshold_);
116 float dx = input_->points[idx1].x - input_->points[idx2].x;
117 float dy = input_->points[idx1].y - input_->points[idx2].y;
118 float dz = input_->points[idx1].z - input_->points[idx2].z;
119 float dist = sqrtf (dx*dx + dy*dy + dz*dz);
120 int dr = input_->points[idx1].r - input_->points[idx2].r;
121 int dg = input_->points[idx1].g - input_->points[idx2].g;
122 int db = input_->points[idx1].b - input_->points[idx2].b;
124 float color_dist =
static_cast<float> (dr*dr + dg*dg + db*db);
125 return ( (dist < distance_threshold_)
126 && (normals_->points[idx1].getNormalVector3fMap ().dot (normals_->points[idx2].getNormalVector3fMap () ) > angular_threshold_ )
127 && (color_dist < color_threshold_));
131 float color_threshold_;
135 #endif // PCL_SEGMENTATION_PLANE_COEFFICIENT_COMPARATOR_H_