每个点计算法向量

给定输入点云,为每个点云中的点估计法向量,估计法向量需要指定每个点搜索周边几个点范围作为计算法向量的单位。

此时计算得到的法向量个数cloud_normals->points.size () 与点云个数cloud->points.size ()相等。

#include

#include

{

pcl::PointCloud<:pointxyz>::Ptr cloud (new pcl::PointCloud<:pointxyz>);

... read, pass in or create a point cloud ...

// Create the normal estimation class, and pass the input dataset to it

pcl::NormalEstimation<:pointxyz pcl::normal> ne;

ne.setInputCloud (cloud);

// Create an empty kdtree representation, and pass it to the normal estimation object.

// Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).

pcl::search::KdTree<:pointxyz>::Ptr tree (new pcl::search::KdTree<:pointxyz> ());

ne.setSearchMethod (tree);

// Output datasets

pcl::PointCloud<:normal>::Ptr cloud_normals (new pcl::PointCloud<:normal>);

// Use all neighbors in a sphere of radius 3cm

ne.setRadiusSearch (0.03);

// Compute the features

ne.compute (*cloud_normals);

// cloud_normals->points.size () should have the same size as the input cloud->points.size ()

}

指定特定点云中的点计算法向量

取其中10%的点进行法向量计算:std::vector indices (std::floor (cloud->points.size () / 10));

#include

#include

{

pcl::PointCloud<:pointxyz>::Ptr cloud (new pcl::PointCloud<:pointxyz>);

... read, pass in or create a point cloud ...

// Create a set of indices to be used. For simplicity, we"re going to be using the first 10% of the points in cloud

std::vector indices (std::floor (cloud->points.size () / 10));

for (std::size_t i = 0; i < indices.size (); ++i) indices[i] = i;

// Create the normal estimation class, and pass the input dataset to it

pcl::NormalEstimation<:pointxyz pcl::normal> ne;

ne.setInputCloud (cloud);

// Pass the indices

boost::shared_ptr<:vector> > indicesptr (new std::vector (indices));

ne.setIndices (indicesptr);

// Create an empty kdtree representation, and pass it to the normal estimation object.

// Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).

pcl::search::KdTree<:pointxyz>::Ptr tree (new pcl::search::KdTree<:pointxyz> ());

ne.setSearchMethod (tree);

// Output datasets

pcl::PointCloud<:normal>::Ptr cloud_normals (new pcl::PointCloud<:normal>);

// Use all neighbors in a sphere of radius 3cm

ne.setRadiusSearch (0.03);

// Compute the features

ne.compute (*cloud_normals);

// cloud_normals->points.size () should have the same size as the input indicesptr->size ()

}

pcl求平面法向量_PCL1.8.1 点的法向量相关推荐

  1. pcl求平面法向量_线性代数6——平面方程与矩阵

    线性方程的几何意义 二元线性方程 该方程是一个二元线性方程组,包含两个方程,每个方程是一条直线,两条直线的交点就是该方程有唯一解,这就是二元线性方程的几何意义. 平面方程 空间内不在同一直线上的三点构 ...

  2. pcl求平面法向量_pcl之MLS算法计算并统一法向量

    利用MLS算法计算法向量,并统一法向.MLS其他说明 该算法比直接基于SVD的算法慢,但是对法向进行了统一. #include #include #include #include #include ...

  3. Eigen 由三点求平面方程及平面法向量

    Eigen 由三点求平面方程及平面法向量 一.原理 二.Eigen实现 一.原理   已知三点 P 1 ( x 1 , y 1 , z 1 ) P1(x_1,y_1,z_1) P1(x1​,y1​,z ...

  4. 根据3点求平面法向量c++

    //根据3点坐标求平面的单位法向量(原点指向平面) void Use3PointsComputeNormalVector(vector<float> p1, vector<float ...

  5. 已知三点求平面方程、平面法向量和点到平面的距离

    已知三点p1(x1,y1,z1),p2(x2,y2,z2),p3(x3,y3,z3),要求确定的平面方程 关键在于求出平面的一个法向量,为此做向量p1p2(x2-x1,y2-y1,z2-z1), p1 ...

  6. 已知三点求平面方程、平面法向量和点到平面的距离(转载)

    已知三点p1(x1,y1,z1),p2(x2,y2,z2),p3(x3,y3,z3),要求确定的平面方程 关键在于求出平面的一个法向量,为此做向量p1p2(x2-x1,y2-y1,z2-z1), p1 ...

  7. 三点求平面方程、平面法向量和点到平面的距离

    已知三点p1(x1,y1,z1),p2(x2,y2,z2),p3(x3,y3,z3), 要求确定的平面方程,关键在于求出平面的一个法向量 为此做向量p1p2(x2-x1,y2-y1,z2-z1), p ...

  8. CF429D Tricky Function(求解公式、经分析转为求平面最近点对、思维)

    整理的算法模板合集: ACM模板 目录 CF429D Tricky Function 题意实际上就是给定长度为 nnn 的一串序列a1,a2,...,ana_1, a_2,...,a_na1​,a2​ ...

  9. python 求平面两点距离_Python求平面内点到直线距离的实现

    近期遇到个问题,需要计算平面内点到直线的距离,发现数学知识都还给老师了,度娘后找到计算方法,特此记录. 点到直线的计算公式: 通过公式推导,得到信息: A:直线斜率 B:固定值-1 C:直线截距b 转 ...

最新文章

  1. 判断dataset是否为空
  2. java中怎样判断余数为3,Java的基础语法(三): 运算符
  3. 舍友清华博士毕业,我建议他留在高校
  4. VMware vSphere Client中启动虚拟机提示No boot filename received/Operating System not found解决方法
  5. 事件处理 java_Java事件处理的4种方法
  6. jsp,div 限制字数,超出部分用省略号代替
  7. Spark streaming细粒度工作原理
  8. OpenStack(1)
  9. LeetCode 63.不同路径II(动态规划)
  10. CSS属性:display详解
  11. Scrapy架构及其组件之间的交互
  12. java中希腊字母表_希腊字母,希腊字母
  13. 华为交换机Console密码重置、设备初始化、默认密码
  14. PHP 实现防抖功能(防重复请求)
  15. 版署通过《魔兽世界.燃烧远征》
  16. 使用fisheye4.8(crucible4.8)添加仓库时出现的问题
  17. 这些程序员搞笑段子,看了真的笑skr人!
  18. delphi xe 10.3 firemonkey stringdrig 插入,删除,添加
  19. Json在线编辑和格式化工具
  20. Android商城排版,android排版布局学习

热门文章

  1. HttpResponse类
  2. INITRANS和MAXTRANS参数的作用
  3. AD域策略启动关机脚本不执行的注意事项
  4. 推翻相对论的专家,就差安排明天几点日出了
  5. 【干货】数字化转型工作手册.pdf(附下载链接)
  6. 2021年1月十大热门报告盘点(5天VIP会员免费送)
  7. 工业富联灯塔工厂白皮书:智能制造里程碑.pdf(附下载链接)
  8. 全球首发!计算机视觉Polygon Mesh Processing总结9——Triangle-Based Remeshing
  9. leetcode力扣94. 二叉树的中序遍历
  10. Ubuntu安装tensorflow报错:tensorflow-xx.whl not a supported wheel on this platform