线性等分向量_点的法向量怎么求

线性等分向量_点的法向量怎么求每个点计算法向量 http://pointclouds.org/documentation/tutorials/how_features_work.php#how-3d-features-work …

每个点计算法向量 

http://pointclouds.org/documentation/tutorials/how_features_work.php#how-3d-features-work

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

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

#include <pcl/point_types.h>
#include <pcl/features/normal_3d.h>

{
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

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

  // Create the normal estimation class, and pass the input dataset to it
  pcl::NormalEstimation<pcl::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<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ());
  ne.setSearchMethod (tree);

  // Output datasets
  pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::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 ()
}

代码100分

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

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

代码100分#include <pcl/point_types.h>
#include <pcl/features/normal_3d.h>

{
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::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<int> 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<pcl::PointXYZ, pcl::Normal> ne;
  ne.setInputCloud (cloud);

  // Pass the indices
  boost::shared_ptr<std::vector<int> > indicesptr (new std::vector<int> (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<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ());
  ne.setSearchMethod (tree);

  // Output datasets
  pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::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 ()
}

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/10718.html

(0)
上一篇 2022-12-22
下一篇 2022-12-23

相关推荐

  • mysql简单语法_sql高级语法

    mysql简单语法_sql高级语法从一个表中复制列插入到指定的表中: # 字段的值必须一样 INSERT INTO table2 SELECT * FROM table1; select 子查询 where子查询 # 必须针对一个字…

    2023-03-18
    143
  • 数据库作业在哪里存着_mysql数据库大作业

    数据库作业在哪里存着_mysql数据库大作业题目如下: 1.查询sC表中的全部数据。2. 查询计算机系学生的姓名和年龄3.查询成绩在70~80分的学生的学号、课程号和成绩4.查询计算机系年龄在18~20岁的男生姓名和年龄s.查询C001课程的最

    2023-02-15
    135
  • 使用Python编写爬虫

    使用Python编写爬虫在互联网时代,信息爆炸已经成为常态,人们需要从海量的数据中获取指定的信息,而爬虫技术就是一项强大的工具。Python作为一种简洁有效的编程语言,其出色的网络数据抓取功能备受开发人员的青睐,越来越多的人开始使用Python编写爬虫。

    2024-06-30
    27
  • python删除读取错误的图片(python报错图片)

    python删除读取错误的图片(python报错图片)估计是你没有关闭打开的图片,文件被占用,所以无法删除。

    2023-11-28
    100
  • 使用Python的vstack实现数组的垂直堆叠

    使用Python的vstack实现数组的垂直堆叠a href=”https://beian.miit.gov.cn/”苏ICP备2023018380号-1/a Copyright www.python100.com .Some Rights Reserved.

    2024-05-26
    32
  • 深入学习Python的Series教程

    深入学习Python的Series教程Python是现今世界上最流行的编程语言之一,其灵活性和易学性使得Python成为新手入门学习的理想语言。但是,对于高级开发人员来说,想要深入理解Python并运用其高级特性进行开发,便需要更加深入地学习Python。本系列教程将会深入探讨Python的高级特性,并提供一些实用的技巧,帮助读者解决开发过程中所遇到的问题。

    2024-06-13
    29
  • elasticsearch倒排索引原理_elasticsearch scroll

    elasticsearch倒排索引原理_elasticsearch scroll上一篇,我们介绍了 ES 文档的基本 CURE 和批量操作。我们都知道倒排索引是搜索引擎非常重要的一种数据结构,什么是倒排索引,倒排索引的原理是什么。 1 索引过程 在讲解倒排索引前,我们先了解索引创

    2022-12-20
    136
  • 自然语言处理:让Python自动化文本处理更加精准高效

    自然语言处理:让Python自动化文本处理更加精准高效自然语言处理(Natural Language Processing,NLP)是计算机科学、人工智能、语言学等交叉领域的一项技术,其目的是让计算机能够识别、理解、分析和生成人类自然语言的信息。Python作为当前较为流行的编程语言之一,提供了丰富的用于自然语言处理的库和工具。本文将介绍Python在自然语言处理方面的应用,包括文本处理、情感分析、主题建模等内容。

    2024-02-14
    73

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注