凸包凹包的概念详见
凹凸包



凸包

凹包

下面附上代码:

#include <pcl/io/pcd_io.h>
#include <pcl/io/vtk_io.h>
#include <pcl/surface/concave_hull.h>
#include <pcl/surface/convex_hull.h>#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>using namespace std;
using namespace pcl;
using namespace pcl::io;
using namespace pcl::console;float default_alpha = 0.15f;void
printHelp (int, char **argv)
{print_error ("Syntax is: %s input.pcd output.vtk [optional_arguments]\n", argv[0]);print_info ("  where the optional arguments are:\n");print_info ("                     -alpha X = the alpha value for the ConcaveHull (Alpha Shapes) algorithm. If alpha is not specified, the tool will run the ConvexHull method (default: ");print_value ("%f", default_alpha); print_info (")\n");
}void
compute (PointCloud<PointXYZ>::ConstPtr cloud_in,bool convex_concave_hull,float alpha,PolygonMesh &mesh_out)
{if (!convex_concave_hull){print_info ("Computing the convex hull of a cloud with %lu points.\n", cloud_in->size ());ConvexHull<PointXYZ> convex_hull;convex_hull.setInputCloud (cloud_in);convex_hull.reconstruct (mesh_out);}else{print_info ("Computing the concave hull (alpha shapes) with alpha %f of a cloud with %lu points.\n", alpha, cloud_in->size ());ConcaveHull<PointXYZ> concave_hull;concave_hull.setInputCloud (cloud_in);concave_hull.setAlpha (alpha);concave_hull.reconstruct (mesh_out);}
}/* ---[ */
int
main (int argc, char** argv)
{print_info ("Compute the convex or concave hull of a point cloud. For more information, use: %s -h\n", argv[0]);if (argc < 3){printHelp (argc, argv);return (-1);}// Command line parsingbool convex_concave_hull = false;float alpha = default_alpha;if (parse_argument (argc, argv, "-alpha", alpha) != -1)convex_concave_hull = true;vector<int> pcd_file_indices;pcd_file_indices = parse_file_extension_argument (argc, argv, ".pcd");if (pcd_file_indices.size () != 1){print_error ("Need one input PCD file to continue.\n");return (-1);}vector<int> vtk_file_indices;vtk_file_indices = parse_file_extension_argument (argc, argv, ".vtk");if (vtk_file_indices.size () != 1){print_error ("Need one output VTK file to continue.\n");return (-1);}// Load in the point cloudPointCloud<PointXYZ>::Ptr cloud_in (new PointCloud<PointXYZ> ());if (loadPCDFile (argv[pcd_file_indices[0]], *cloud_in) != 0){print_error ("Could not load input file %s\n", argv[pcd_file_indices[0]]);return (-1);}// Compute the hullPolygonMesh mesh_out;compute (cloud_in, convex_concave_hull, alpha, mesh_out);// Save the meshio::saveVTKFile (argv[vtk_file_indices[0]], mesh_out);return (0);
}

来源:PCL官方示例

PCL计算ConvexHull凸包、ConcaveHull凹包相关推荐

  1. 基于点云凸包的凹包获取方法

    文章目录 一.简介 二.实现代码 三.实现效果 参考文献 一.简介 因为受到参考文献[1]的启发,所以尝试着在三维凸包的基础上,通过去除较大面积的三角面片来得到一个凹包(这里我们是通过指定一个面积阈值 ...

  2. 凸包+凹包+凸边凹化算法

    时针法 一.凸包:最大面积边界->外围边界 离散点建立最小外围边界即凸多边形,如下图所示,离散点建立凸包过程 思路: step1:找到最外围的一个初始边界点A(Xa,Ya),存入边界点集合 st ...

  3. 计算点云的二维面积(凹包面积计算、平面旋转)

    计算点云面积时,cloud compare采取的策略是将点云网格化,然后计算网格面积.这样构网的情况往往会影响到后续面积的计算精度.这里采取了一种凹包面积计算的策略.主要步骤包括: 1.将点云旋转至与 ...

  4. 二维点集求外轮廓Java_从二维点集重建平面形状-浅议凹包算法

    问题背景 近期遇到一个计算几何问题,需要从点集中重建一个合理的几何形状.这个问题既有二维的也有三维的,二维的情况相对简单一点,即给出平面区域的一系列散点,求出一定程度上反映这些散点轮廓的平面多边形,给 ...

  5. matlab 凹包,二维点集凹包算法介绍

    最近遇到一个求二维点集凹包的问题,凹包的叫法不知道是否准确,问题可以描述为:(原文下载在文章末尾) 在二维平面上有一系列的点,求能包围所有点集的二维多边形.(好像搜"离散点边界"或 ...

  6. R语言偏相关或者部分相关性系数计算实战:使用psych包计算(Partial Correlation)偏相关系数、拟合回归模型使用两个回归模型的残差计算偏相关性系数

    R语言偏相关或者部分相关性系数计算实战:使用psych包计算(Partial Correlation)偏相关系数.拟合回归模型使用两个回归模型的残差计算偏相关性系数 目录

  7. R语言编写自定义描述统计计算函数、使用doBy包的summaryBy函数计算不同分组(group)的描述性统计值(Descriptive statistics by group、样本个数、均值、标准)

    R语言编写自定义描述统计计算函数.使用doBy包的summaryBy函数计算不同分组(group)的描述性统计值(Descriptive statistics by group using summa ...

  8. R语言偏相关或者部分相关性系数计算实战:使用psych包计算(Partial Correlation)偏相关或者部分相关性系数并用建设检验检验相关性的显著性

    R语言偏相关或者部分相关性系数计算实战:使用psych包计算(Partial Correlation)偏相关或者部分相关性系数并用建设检验检验相关性的显著性 目录

  9. Numpy:高性能科学计算和数据分析的基础包

    Numpy:高性能科学计算和数据分析的基础包 概述 基础数据类型:ndarray数组 为什么引入ndarray数组 案例1:实现a+1的计算 案例2:实现c=a+b的计算 创建ndarray数组 查看 ...

最新文章

  1. 二值网络--Structured Binary Neural Networks for Accurate Image Classification and Semantic Segmentation
  2. ORACLE 11g 使用ROWNUM完美解决ORA-00600:内部错误代码
  3. 9家专利拥有者退出MPEG LA HEVC 华为加入HEVC Advance
  4. 安装Cocoapods详细教程
  5. BZOJ 2957 楼房重建-线段树
  6. Common Knowledge_快速幂
  7. [改善Java代码]若有必要,使用变长数组
  8. 培训机构还能不能信任?
  9. [二分][贪心]JZOJ P3996 Sabotage
  10. Here we want to mention one thing
  11. Play framework 2.0 -应用程序全局设置(转)
  12. Win11怎么把右键刷新调出来?
  13. 2 s锁是什么_使用 python 实现简单的共享锁和排他锁
  14. 流模型 操作 xml
  15. 边玩边学,15个学习Python 的编程游戏网站
  16. 网络流行简笔画图片大全,互联网图标简笔画
  17. SAP接口编程 之 JCo3.0系列:JCoDestination
  18. 国三 unit3 被动语态
  19. hdu 6437 - 最大费用流
  20. Netd 服务的 netd 套接字创建

热门文章

  1. Vue+vant实现移动端记住密码功能
  2. MATLAB代码:基于V2G技术的电动汽车实时调度策略
  3. c语言中应该绝对避免一些的低级错误
  4. Android ListView 使用checkbox 实现 单选、多选操作
  5. android ssid乱码,关于讲解win7无线中文ssid乱码的处理举措
  6. 2021车中国车联网行业发展环境(PEST)分析:政策加持下,车联网市场持续爆发[图]
  7. C++ 8 继承与派生
  8. 大学毕业十年后(转)
  9. magento 开发 -- 深入理解Magento第五章 – Magento资源配置
  10. stata行业变量怎么赋值_邹军:怎么通过宏程序实现刀具寿命管理(二)