Go to the documentation of this file.00001
00063 #ifndef __IMPL_CURVATURE_CLASSIFIER_H__
00064 #define __IMPL_CURVATURE_CLASSIFIER_H__
00065
00066 #include "cob_3d_features/curvature_classifier.h"
00067
00068
00069 template <typename PointInT, typename PointOutT> void
00070 cob_3d_features::CurvatureClassifier<PointInT,PointOutT>::classify(PointCloudOut &output)
00071 {
00072
00073 if(!initCompute())
00074 {
00075 output.width = output.height = 0;
00076 output.points.clear ();
00077 std::cout << "error" << std::endl;
00078 return;
00079 }
00080 if (output.points.size() != input_->size())
00081 {
00082 output.points.resize(input_->size());
00083 output.height = input_->height;
00084 output.width = input_->width;
00085 }
00086 for (size_t i=0; i < indices_->size(); ++i)
00087 {
00088 float pc1 = std::fabs(input_->points[(*indices_)[i]].pc1);
00089 float pc2 = std::fabs(input_->points[(*indices_)[i]].pc2);
00090 if (output.points[i].label == I_BORDER) {continue;}
00091 if (pc1 < c_lower_)
00092 {
00093 output.points[i].label = I_PLANE;
00094 }
00095 else if (pc1 > c_upper_)
00096 {
00097 output.points[i].label = I_EDGE;
00098
00099
00100
00101
00102
00103
00104 }
00105 else if (pc1 < c_ratio_cylinder_sphere_ * pc2)
00106 {
00107 output.points[i].label = I_SPHERE;
00108 }
00109 else
00110 {
00111 output.points[i].label = I_CYL;
00112 }
00113 }
00114 }
00115
00116 template <typename PointInT, typename PointOutT> void
00117 cob_3d_features::CurvatureClassifier<PointInT,PointOutT>::classifyForSegmentation(PointCloudOut &output)
00118 {
00119
00120 if(!initCompute())
00121 {
00122 output.width = output.height = 0;
00123 output.points.clear ();
00124 std::cout << "error" << std::endl;
00125 return;
00126 }
00127 if (output.points.size() != input_->size())
00128 {
00129 output.points.resize(input_->size());
00130 output.height = input_->height;
00131 output.width = input_->width;
00132 }
00133 for (size_t i=0; i < indices_->size(); ++i)
00134 {
00135 if (output.points[i].label == I_NAN) {continue;}
00136 if (output.points[i].label == I_BORDER) {output.points[i].label = I_EDGE; continue;}
00137 if (input_->points[(*indices_)[i]].pc1 > c_upper_)
00138 {
00139 output.points[i].label = I_EDGE;
00140 }
00141 else
00142 {
00143 output.points[i].label = I_UNDEF;
00144 }
00145 }
00146 }
00147
00148 #define PCL_INSTANTIATE_CurvatureClassifier(T,OutT) template class PCL_EXPORTS cob_3d_features::CurvatureClassifier<T,OutT>;
00149
00150 #endif