Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include <cob_3d_segmentation/eval.h>
00009
00010
00011 template <typename Point, typename PointLabel>
00012 bool Segmentation_NURBS<Point, PointLabel>::compute() {
00013 shapes_.clear();
00014
00015 pcl::on_nurbs::SequentialFitter sf;
00016
00017 sf.setInputCloud(input_);
00018 fs.setCamera(Eigen::Matrix3f::Identity());
00019
00020
00021 sf.compute();
00022
00023 SHAPE_S shape;
00024 shape.nurbs_ = sf.getNurbs();
00025
00026 shapes_.push_back( shape );
00027
00028 return true;
00029 }
00030
00031 template <typename Point, typename PointLabel>
00032 boost::shared_ptr<const pcl::PointCloud<PointLabel> > Segmentation_NURBS<Point, PointLabel>::getReconstructedOutputCloud() {
00033 boost::shared_ptr<pcl::PointCloud<PointLabel> > cloud (new pcl::PointCloud<PointLabel>);
00034 cloud->header = input_->header;
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 return cloud;
00056 }
00057
00058 template <typename Point, typename PointLabel>
00059 void Segmentation_NURBS<Point, PointLabel>::compute_accuracy(float &mean, float &var, size_t &used, size_t &mem, size_t &points, float &avg_dist) {
00060 RunningStat rstat;
00061 points = 0;
00062 avg_dist = 0;
00063 mem = 0;
00064
00065 pcl::on_nurbs::SequentialFitter sf;
00066
00067 for(size_t i=0; i<input_.size(); i++) {
00068 Eigen::Vector3d pt, pta;
00069 pt(0) = (*input)[i].x;
00070 pt(1) = (*input)[i].y;
00071 pt(2) = (*input)[i].z;
00072 if(!pcl_isfinite(pt.sum())) continue;
00073
00074 Eigen::Vector2d pt2;
00075 sf.getClosestPointOnNurbs(shapes_[0].nurbs_, pt, pt2);
00076
00077 double p[3];
00078 surf.Evaluate (pt2(0), pt2(1), 0, 3, p);
00079 for(int j=0; j<3; j++) pta(j) = p[j];
00080
00081 mem+=shapes_[i].inliers_.size()*4;
00082 mem+=shapes_[i].coeff_.rows()*shapes_[i].coeff_.cols()*4+8;
00083
00084 const float d = (pt-pta).norm();
00085
00086 if(!pcl_isfinite(d)) continue;
00087
00088 rstat.Push(d);
00089 avg_dist += z;
00090 ++points;
00091 }
00092
00093
00094 used = rstat.NumDataValues();
00095
00096 mean = rstat.Mean();
00097 var = rstat.Variance();
00098 avg_dist /= points;
00099 }