【PCL】pcl中是怎么计算特征的

2024-02-28 15:48
文章标签 计算 怎么 pcl 特征 中是

本文主要是介绍【PCL】pcl中是怎么计算特征的,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

  • 写在前面
  • 四种计算特征的方法
    • 1. !indices & !isurface
    • 2. indices & !isurface
    • 3. !indices & isurface
    • 4. indices & isurface
  • 三个接口辨析
    • 1. setInputCloud(PointCloudConstPtr &)
    • 2. setIndices(IndicesConstPtr &)
    • 3. setSearchSurface(PointCloudConstPtr &)
  • 例子
    • 1. 直接计算全部的点云的法向量,每一个点邻域考虑本身的邻域。
    • 2. 不计算每一个点的法向量,仅仅计算给的的索引的,考虑邻域为本身的邻域
    • 3. 计算给定点云(下采样后)的每一个点的法向量,对每一个点考虑SearchSurface中的对应点的邻域
  • 总结
  • 参考

写在前面

在计算特征向量descriptors的时候,需要只对关键点keypoints计算关键点在其原始点云处的邻域特征,那么就会用到setSearchSurface这个函数。


四种计算特征的方法

在这里插入图片描述

1. !indices & !isurface

无索引,搜索原点云上的每一个点的邻域。

2. indices & !isurface

有索引,搜索原点云上的每一个点的邻域。

3. !indices & isurface

无索引,搜索指定的点云上的每一个点的邻域。

4. indices & isurface

有索引,搜索指定的点云上的每一个点的邻域。

三个接口辨析

1. setInputCloud(PointCloudConstPtr &)

设置搜索的点云

2. setIndices(IndicesConstPtr &)

设置cloud的索引,类似于下采样

3. setSearchSurface(PointCloudConstPtr &)

具体计算某一个点处的特征时,设置需要考虑的哪个点云上对应于该点的邻域特征。

例子

下面例子中具体考虑哪个点云集合的邻域,是取决于tree的,看程序注释可以发现是优先考虑 search surface。

1. 直接计算全部的点云的法向量,每一个点邻域考虑本身的邻域。

#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 itpcl::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 datasetspcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);// Use all neighbors in a sphere of radius 3cmne.setRadiusSearch (0.03);// Compute the featuresne.compute (*cloud_normals);// cloud_normals->points.size () should have the same size as the input cloud->points.size ()
}

2. 不计算每一个点的法向量,仅仅计算给的的索引的,考虑邻域为本身的邻域

The following code snippet will estimate a set of surface normals for a subset of the points in the input dataset.


#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 cloudstd::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 itpcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;ne.setInputCloud (cloud);// Pass the indicespcl::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 datasetspcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);// Use all neighbors in a sphere of radius 3cmne.setRadiusSearch (0.03);// Compute the featuresne.compute (*cloud_normals);// cloud_normals->points.size () should have the same size as the input indicesptr->size ()
}

3. 计算给定点云(下采样后)的每一个点的法向量,对每一个点考虑SearchSurface中的对应点的邻域

Finally, the following code snippet will estimate a set of surface normals for all the points in the input dataset, but will estimate their nearest neighbors using another dataset. As previously mentioned, a good usecase for this is when the input is a downsampled version of the surface.

#include <pcl/point_types.h>
#include <pcl/features/normal_3d.h>{pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_downsampled (new pcl::PointCloud<pcl::PointXYZ>);... read, pass in or create a point cloud ...... create a downsampled version of it ...// Create the normal estimation class, and pass the input dataset to itpcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;ne.setInputCloud (cloud_downsampled);// Pass the original data (before downsampling) as the search surfacene.setSearchSurface (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 surface dataset.pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ> ());ne.setSearchMethod (tree);// Output datasetspcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);// Use all neighbors in a sphere of radius 3cmne.setRadiusSearch (0.03);// Compute the featuresne.compute (*cloud_normals);// cloud_normals->points.size () should have the same size as the input cloud_downsampled->points.size ()
}

总结

上述四种情况,!indices&SearchSurface最常用
在计算关键点的特征向量的时会用到。
如下:

  descr_est.setInputCloud (model_keypoints);  //模型点云的关键点descr_est.setInputNormals (model_normals);  //模型点云的法线 descr_est.setSearchSurface (model);         //模型点云       descr_est.compute (*model_descriptors);     //计算描述子descr_est.setInputCloud (scene_keypoints);descr_est.setInputNormals (scene_normals);descr_est.setSearchSurface (scene);descr_est.compute (*scene_descriptors);————————————————
版权声明:本文为CSDN博主「JoannaJuanCV」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zfjBIT/article/details/93046902

参考

PCL学习:基于点云分类的目标识别
How 3D Features work in PCL
PCL/OpenNI tutorial 5: 3D object recognition (pipeline)
PCL/OpenNI tutorial 4: 3D object recognition (descriptors)

这篇关于【PCL】pcl中是怎么计算特征的的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/755935

相关文章

qt5cored.dll报错怎么解决? 电脑qt5cored.dll文件丢失修复技巧

《qt5cored.dll报错怎么解决?电脑qt5cored.dll文件丢失修复技巧》在进行软件安装或运行程序时,有时会遇到由于找不到qt5core.dll,无法继续执行代码,这个问题可能是由于该文... 遇到qt5cored.dll文件错误时,可能会导致基于 Qt 开发的应用程序无法正常运行或启动。这种错

电脑提示xlstat4.dll丢失怎么修复? xlstat4.dll文件丢失处理办法

《电脑提示xlstat4.dll丢失怎么修复?xlstat4.dll文件丢失处理办法》长时间使用电脑,大家多少都会遇到类似dll文件丢失的情况,不过,解决这一问题其实并不复杂,下面我们就来看看xls... 在Windows操作系统中,xlstat4.dll是一个重要的动态链接库文件,通常用于支持各种应用程序

Python并行处理实战之如何使用ProcessPoolExecutor加速计算

《Python并行处理实战之如何使用ProcessPoolExecutor加速计算》Python提供了多种并行处理的方式,其中concurrent.futures模块的ProcessPoolExecu... 目录简介完整代码示例代码解释1. 导入必要的模块2. 定义处理函数3. 主函数4. 生成数字列表5.

Mac备忘录怎么导出/备份和云同步? Mac备忘录使用技巧

《Mac备忘录怎么导出/备份和云同步?Mac备忘录使用技巧》备忘录作为iOS里简单而又不可或缺的一个系统应用,上手容易,可以满足我们日常生活中各种记录的需求,今天我们就来看看Mac备忘录的导出、... 「备忘录」是 MAC 上的一款常用应用,它可以帮助我们捕捉灵感、记录待办事项或保存重要信息。为了便于在不同

springboot+vue项目怎么解决跨域问题详解

《springboot+vue项目怎么解决跨域问题详解》:本文主要介绍springboot+vue项目怎么解决跨域问题的相关资料,包括前端代理、后端全局配置CORS、注解配置和Nginx反向代理,... 目录1. 前端代理(开发环境推荐)2. 后端全局配置 CORS(生产环境推荐)3. 后端注解配置(按接口

Java计算经纬度距离的示例代码

《Java计算经纬度距离的示例代码》在Java中计算两个经纬度之间的距离,可以使用多种方法(代码示例均返回米为单位),文中整理了常用的5种方法,感兴趣的小伙伴可以了解一下... 目录1. Haversine公式(中等精度,推荐通用场景)2. 球面余弦定理(简单但精度较低)3. Vincenty公式(高精度,

windows和Linux使用命令行计算文件的MD5值

《windows和Linux使用命令行计算文件的MD5值》在Windows和Linux系统中,您可以使用命令行(终端或命令提示符)来计算文件的MD5值,文章介绍了在Windows和Linux/macO... 目录在Windows上:在linux或MACOS上:总结在Windows上:可以使用certuti

电脑死机无反应怎么强制重启? 一文读懂方法及注意事项

《电脑死机无反应怎么强制重启?一文读懂方法及注意事项》在日常使用电脑的过程中,我们难免会遇到电脑无法正常启动的情况,本文将详细介绍几种常见的电脑强制开机方法,并探讨在强制开机后应注意的事项,以及如何... 在日常生活和工作中,我们经常会遇到电脑突然无反应的情况,这时候强制重启就成了解决问题的“救命稻草”。那

电脑开机提示krpt.dll丢失怎么解决? krpt.dll文件缺失的多种解决办法

《电脑开机提示krpt.dll丢失怎么解决?krpt.dll文件缺失的多种解决办法》krpt.dll是Windows操作系统中的一个动态链接库文件,它对于系统的正常运行起着重要的作用,本文将详细介绍... 在使用 Windows 操作系统的过程中,用户有时会遇到各种错误提示,其中“找不到 krpt.dll”

Python如何计算两个不同类型列表的相似度

《Python如何计算两个不同类型列表的相似度》在编程中,经常需要比较两个列表的相似度,尤其是当这两个列表包含不同类型的元素时,下面小编就来讲讲如何使用Python计算两个不同类型列表的相似度吧... 目录摘要引言数字类型相似度欧几里得距离曼哈顿距离字符串类型相似度Levenshtein距离Jaccard相