当前位置: 首页 > news >正文

PCL提取平面上的圆形凸台特征

1. 点云转深度图像,提取圆心;找到与圆心匹配的三维点;

2. 三维点以指定半径取邻域点,抽取所有邻域点的最大平面为参考平面;

3. 将平面附近点删去,得到凸台点。剩余凸台抽取最大平面,作为凸台顶面平面;

4. 将凸台点云变换到顶面平面作为xOy平面的坐标系下;

5. 对投影到顶面平面的2D点云识别边缘点,并拟合2D圆;找到圆心对应的原始点;

6. 圆心点到参考平面距离为凸台高度;

部分代码如下:

  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_src(new pcl::PointCloud<pcl::PointXYZ>);pcl::PLYReader reader;//reader.setVerbosity(true);  // 启用详细日志if (reader.read(file_name, *cloud_src) == -1) {pcl::console::print_error("Failed to load PLY file!\n");return -1;}print_time("load data done");#pragma omp parallel forfor (int tt = 0;tt < 100;tt++){pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);*cloud = *cloud_src;          // 逐字段深拷贝,包括点、宽、高、header 等Eigen::Vector4f plane_coeff;Eigen::Vector3f centroid;if (!extractPlane(cloud, plane_coeff, centroid)){printf("Plane extract failed!\n");continue;}erasePtsByDistToPlane(cloud, plane_coeff, 0.015);//pcl::io::savePLYFileBinary(folder + "single" + ".ply", *cloud);Eigen::Vector3f centroid2;auto circle_plane = extractLargestPlane(cloud, centroid2);Eigen::Vector4f plane2;plane2[0] = circle_plane->values[0];plane2[1] = circle_plane->values[1];plane2[2] = circle_plane->values[2];plane2[3] = circle_plane->values[3];Coord2DTransformer transformer;transformer.projectToPlane(cloud, plane2, centroid2);//auprojectToPlane(cloud, circle_plane);//pcl::io::savePLYFileBinary(folder + "circle_plane" + ".ply", *cloud2);auto boundary = extractBoundaryPointsAlphaShape(transformer.points2d_cv, 0.01);auto fitted_circle = fitCircleLeastSquares(boundary);auto center = transformer.calcCoord3D(glm::dvec2(fitted_circle.center.x, fitted_circle.center.y));auto height = pointToPlane(center, plane_coeff);// -(plane_coeff[0] * center.x + plane_coeff[1] * center.y + plane_coeff[3] * center.z) / plane_coeff[2];//exportPointsToTXT(boundary, folder + "boundary.txt", 6);printf("center = %.3f, %.3f, %.3f, radius = %.3f, height = %.3f\n",center.x, center.y, center.z, fitted_circle.radius, height);//auto cloud3 = extractBoundary(cloud2);// pcl::io::savePLYFileBinary(folder + "boundary" + ".ply", *cloud3);//Coord2DTransformer transformer;//auto transformed_cloud = transformer.rectify(cloud, plane_coeff, centroid);}

http://www.lryc.cn/news/612797.html

相关文章:

  • 阿里系bx_et加密分析
  • 构造函数:C++对象初始化的核心机制
  • 天猫商品评论API技术指南
  • uni-app X能成为下一个Flutter吗?
  • Flutter报错...Unsupported class file major version 65
  • C# 异步编程(async_await特性的结构)
  • PyTorch 核心三件套:Tensor、Module、Autograd
  • `/dev/vdb` 是一个新挂载的 4TB 硬盘,但目前尚未对其进行分区和格式化。
  • vscode 打开设置
  • Flutter 三棵树
  • 【物联网】基于树莓派的物联网开发【25】——树莓派安装Grafana与Influxdb无缝集成
  • CentOS 7 下通过 Anaconda3 运行llm大模型、deepseek大模型的完整指南
  • 人工智能的20大应用
  • 从Centos 9 Stream 版本切换到 Rocky Linux 9
  • 360纳米AI、实在Agent、CrewAI与AutoGen……浅析多智能体协作系统
  • 构建在 OpenTelemetry eBPF 基础之上:详解 Grafana Beyla 2.5 新特性
  • 【0基础3ds Max】菜单栏介绍
  • 多模态融合(Multimodal Fusion)
  • PCIe Base Specification解析(九)
  • mapbox进阶,mapbox-gl-draw绘图插件扩展,绘制新增、编辑模式支持点、线、面的捕捉
  • 什么是SpringBoot
  • Shuffle SOAR使用学习经验
  • Q-Learning详解:从理论到实践的全面解析
  • 扎根国际数字影像产业园:共享空间助力企业高效发展
  • 施耐德 Easy Altivar ATV310 变频器:高效电机控制的理想选择(含快速调试步骤及常见故障代码)
  • 【3D图像技术分析与实现】谷歌的AlphaEarth是如何实现的?
  • 告别Cursor!最强AI编程辅助Claude Code安装到使用全流程讲解
  • 常见命令-资源查看-iostat命令实践
  • cuda编程笔记(13)--使用CUB库实现基本功能
  • 基于LLM的大数据分析调研