void do_ransac(pcl::PointCloud<PointT>::Ptr cloud)
{
pcl::PointIndices::Ptr inliers;
pcl::ModelCoefficients::Ptr coefficients
pcl::SACSegmentation<PointT> seg;
//pcl::SACSegmentationFromNormals<PointT, pcl::Normal> seg;
seg.setOptimizeCoefficients(true);
//seg.setModelType (pcl::SACMODEL_NORMAL_PLANE);
seg.setModelType(pcl::SACMODEL_PLANE);
seg.setMethodType(pcl::SAC_RANSAC);
seg.setDistanceThreshold(distance_threshold);
seg.setMaxIterations(max_iterations);
seg.setInputCloud(cloud);
seg.segment(*inliers, *coefficients);
}
求平面方程:ax+by+cz+d=0;
cout<<"平面方程参数"<<coefficients->values[0]<<coefficients->values[1]<<coefficients->values[2]<<coefficients->values[3]<<endl;
就是所求得的a,b,c,d
来源:CSDN
作者:简单说鸭
链接:https://blog.csdn.net/eurus_/article/details/104032616