我现在需要对点云数据提取特征线,比如边缘线之类的。
pcl库对于点云数据的点特征提取有很多对应的方法,但是没查到关于线特征提取的。
想问一下大佬们,pcl支持特征线提取吗,是不是我找资料的时候找错了关键词。
忘了把找到的方法写出来了
int arg_kNearest = 30;//一般这里的数值越高,最终边界识别的精度越好
int arg_Angle = 144;//角度值,0-360
pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
pcl::PointCloud<pcl::Boundary> boundaries;//Boundary,表示点是否位于表面边界的描述的点结构
pcl::BoundaryEstimation<pcl::PointXYZRGBA, pcl::Normal, pcl::Boundary> est; //BoundaryEstimation使用角度标准估计一组点是否位于表面边界上
pcl::search::KdTree<pcl::PointXYZRGBA>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZRGBA>());
//其中pcl::PointXYZ表示输入类型数据,pcl::Normal表示输出类型,且pcl::Normal前三项是法向,最后一项是曲率
pcl::NormalEstimation<pcl::PointXYZRGBA, pcl::Normal> normEst;//NormalEstimation类,用于估计每个3D点的局部表面属性(表面法线和曲率)
normEst.setInputCloud(input_cloud);
normEst.setSearchMethod(tree);
// normEst.setRadiusSearch(2); //法向估计的半径
normEst.setKSearch(9); //法向估计的点数
normEst.compute(*normals);
cout << "normal size is " << normals->size() << endl;
//normal_est.setViewPoint(0,0,0); //这个应该会使法向一致
est.setInputCloud(input_cloud);
est.setInputNormals(normals);
//est.setAngleThreshold(M_PI *4/5);//默认是M_PI/2, M_PI是180度
est.setAngleThreshold(M_PI*(arg_Angle % 360) / 180);
//est.setSearchMethod (pcl::search::KdTree<pcl::PointXYZ>::Ptr (new pcl::search::KdTree<pcl::PointXYZ>));
est.setSearchMethod(tree);
est.setKSearch(arg_kNearest);
//est.setRadiusSearch(everagedistance); //搜索半径
est.compute(boundaries);
//pcl::PointCloud<pcl::PointXYZ> boundPoints;
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr boundPoints(new pcl::PointCloud<pcl::PointXYZRGBA>);
pcl::PointCloud<pcl::PointXYZRGBA> noBoundPoints;
int countBoundaries = 0;
for (int i = 0; i<input_cloud->size(); i++)
{
uint8_t x = (boundaries.points[i].boundary_point);
int a = static_cast<int>(x); //该函数的功能是强制类型转换
if (a == 1)
{
// boundPoints.push_back(cloud->points[i]);
(*boundPoints).push_back(input_cloud->points[i]);
countBoundaries++;
}
else
noBoundPoints.push_back(input_cloud->points[i]);
}
//boundPoints就是最后要的结果
https://blog.csdn.net/qq_34719188/article/details/79183199
边缘检测有很多算法