pcl

PCL点云滤波

Deadly 提交于 2019-12-05 22:12:45
点云处理中滤波目的。滤波处理作为点云处理的第一步,对后续处理有很重要。只有在滤波处理流程中将噪声点、离群点、空洞、数据压缩等按照后续处理定制,才能更好地进行配准、特征提取、曲面重建、可视化等后续应用处理。点云数据集中每一个点表达一定的信息量,某个区域点越密集有用的信息量越大。孤立的离群点信息量较小,其表达的信息量可以忽略不计。 滤波器介绍 直通滤波器:对于在空间分布有一定空间特征的点云数据,比如使用线结构光扫描的方式采集点云,沿z向分布较广,但x,y向的分布处于有限范围内。此时可使用直通滤波器,确定点云在x或y方向上的范围,可较快剪除离群点,达到第一步粗处理的目的。 体素滤波器:体素的概念类似于像素,使用AABB包围盒将点云数据体素化,一般体素越密集的地方信息越多,噪音点及离群点可通过体素网格去除。另一方面如果使用高分辨率相机等设备对点云进行采集,往往点云会较为密集。过多的点云数量会对后续分割工作带来困难。体素滤波器可以达到向下采样同时不破坏点云本身几何结构的功能。 统计滤波器:考虑到离群点的特征,则可以定义某处点云小于某个密度,既点云无效。计算每个点到其最近的k个点平均距离。则点云中所有点的距离应构成高斯分布。给定均值与方差,可剔除3∑之外的点。 条件滤波:条件滤波器通过设定滤波条件进行滤波,有点分段函数的味道,当点云在一定范围则留下,不在则舍弃。 半径滤波器

PCL1.8.1 质心与协方差矩阵

六月ゝ 毕业季﹏ 提交于 2019-12-05 20:36:55
#include <pcl/point_types.h> #include <pcl/io/ply_io.h> #include <pcl/common/centroid.h> int main() { pcl::PointCloud<pcl::PointXYZ> cloud; pcl::io::loadPLYFile("cube.ply", cloud); // Placeholder for the 3x3 covariance matrix at each surface patch 协方差矩阵 Eigen::Matrix3f covariance_matrix; // 16-bytes aligned placeholder for the XYZ centroid of a surface patch Eigen::Vector4f xyz_centroid; // Estimate the XYZ centroid 质心 pcl::compute3DCentroid(cloud, xyz_centroid); // Compute the 3x3 covariance matrix pcl::computeCovarianceMatrix(cloud, xyz_centroid, covariance_matrix); std::cout << xyz_centroid

PCL1.8.1 法向量

偶尔善良 提交于 2019-12-05 20:24:51
#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

PCL1.8.1 采样一致性算法 RANSAC

你离开我真会死。 提交于 2019-12-05 19:53:26
采样一致性算法主要是拟合点云中的平面、直线、圆等参数模型。 http://pointclouds.org/documentation/tutorials/random_sample_consensus.php#random-sample-consensus 平面拟合 将远离平面0.01米的点剔除掉 #include <pcl/sample_consensus/ransac.h> #include <pcl/sample_consensus/sac_model_plane.h> pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); pcl::PointCloud<pcl::PointXYZ>::Ptr final(new pcl::PointCloud<pcl::PointXYZ>); //创建一个平面模型 pcl::SampleConsensusModelPlane<pcl::PointXYZ>::Ptr model_p(new pcl::SampleConsensusModelPlane<pcl::PointXYZ>(cloud)); //用于保存拟合后的点的索引 std::vector<int> inliers; //创建随机采样一致性算法 pcl:

PCL1.8.1 可视化

倾然丶 夕夏残阳落幕 提交于 2019-12-05 19:18:08
可视化点云 #include <pcl/visualization/cloud_viewer.h> pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); pcl::visualization::CloudViewer viewer("Viewer"); viewer.showCloud(cloud); while (!viewer.wasStopped ()) { } 可视化深度图 来源: https://my.oschina.net/u/4228078/blog/3134245

PCL点云可视化

帅比萌擦擦* 提交于 2019-12-05 18:59:29
#include "pclf.h" #include <pcl/ModelCoefficients.h> #include <pcl/filters/voxel_grid.h> #include <pcl/filters/statistical_outlier_removal.h> #include <string> int main() { PLCSF sface; std::string path = "./sFace/flat/PointCould.txt";//点云路径 PointCloud<PointXYZ>::Ptr cloud(new PointCloud<PointXYZ>()); PointCloud<PointXYZ>::Ptr cloud_filtered(new PointCloud<PointXYZ>()); sface.readCloudFile(path, cloud);//读入点云数据 cout << cloud->size()<< endl; //可视化 pcl::visualization::CloudViewer viewer("Cloud viewer"); viewer.showCloud(cloud); system("pause"); } 来源: https://www.cnblogs.com/hsy1941/p/11939722

PCL1.8.1 滤波

喜欢而已 提交于 2019-12-05 18:57:37
直通滤波器 指定点云中特定字段域的数字范围,保留或剔除操作 http://pointclouds.org/documentation/tutorials/passthrough.php#passthrough #include <iostream> #include <pcl/point_types.h> #include <pcl/filters/passthrough.h> pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>); pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered (new pcl::PointCloud<pcl::PointXYZ>); // Create the filtering object pcl::PassThrough<pcl::PointXYZ> pass; pass.setInputCloud (cloud); //设置pcl::PointXYZ中字段域z pass.setFilterFieldName ("z"); pass.setFilterLimits (0.0, 1.0); //默认是false,表示保留z字段是0.0-1.0的点云数据 true:不保留 pass

windows 下pcl的安装和编译

孤人 提交于 2019-12-05 09:50:13
注意:本章假设读者熟悉 CMake 、 svn 、 make 和 C++ 编译链接等有基础知识的读者。 PCL 为了方便 Windows 用户的安装,提供预编译的安装文件,但是只限于用户使用 Visual Studio 2010 或 Visual Studio 2008 ,如果用户采用其他编译器,或长期采用 PCL 作为开发平台,或者因为编译包不是对应最新的源代码,需要使用最新功能的用户,这些情况下就需要自己从源码安装。笔者建议初学者最好使用安装包安装方式,步骤较简单,简单几步即可体验 PCL 的强大。 准备工作: a) 获取 All in one 安装包, PCL 提供了配置为 Visual Studio 2010 的 32 位和 64 位、 Visual Studio 2008 的 32 位和 64 位下的该安装包,该包包含了 PCL 中所使用全部第三方编译包,除了 Qt 编译包; b) 获取 All in one 包对应的 PDB 文件包,该包用于后期单步调试时使用; c) 获取 PCL 源码包; d) 安装开发工具 Visual Studio 2010 或 Visual Studio 2008 和 cmake 开发工具,需要 cmake 版本大于 2.8.3 ,主要考虑到 PCL 中用到了高版本的一些宏定义,低版本不兼容。 注意: http://pointclouds

C++boost & pcl::PointCloud< PointT >::Ptr

ぃ、小莉子 提交于 2019-12-05 04:39:36
pcl::PointCloud< PointT >::Ptr PCL官网/帮助文档 函数定义 using pcl::PointCloud< PointT >::Ptr = boost::shared_ptr<PointCloud<PointT> > 有关boost库里的智能指针: Boost::shared_ptr,创建一个简单的智能指针是非常容易的。但是创建一个能够在大多数编译器下通过的智能指针就有些难度了。而创建同时又考虑异常安全就更为困难了。Boost::shared_ptr这些全都做到了。 来源: https://www.cnblogs.com/chenlinchong/p/11906539.html

pcl库中滤波器总结

*爱你&永不变心* 提交于 2019-12-05 04:09:31
1 引言 在获取点云时由于设备精度、操作者经验、环境因素等带来的影响,以及电磁波衍射的特性、被测物体表面性质变化和数据拼接配准操作过程的影响,点云数据中将不可避免的出现一些噪声点。在点云处理流程中,滤波处理作为预处理的第一步,往往对后续处理管道影响很大, 只有在滤波预处理中将噪声点、离群点、孔洞、数据压缩等按照后续处理定制,才能够更好地经行配准、特征提取、曲面重建、可视化等后续应用处理 。 2 pcl中相关算法函数 2.1 直通滤波器 对某一维度实行一个简单的滤波,即去掉在用户指定范围内部或外部的点。 #include <pcl/filters/passthrough.h> //所需头文件 pcl::PassThrough< Point Type > passName; //创建滤波对象 passName.setInputCloud(cluod); //setInputCloud; passName.setFilterFileldName("z"); //设置过滤 'z'轴点(x,y 轴都可以,但是其他的譬如一个旋转轴没试过) passName.setFilterLimits(0.0,1.0); //对z轴上(0,1)区间的点进行处理 passName.setFilterLimintsNegative(true or false); //true 为滤掉z轴上(0,1)的点云