现在开始C++巩固加上数据结构刷题加PCL库系统学习开始交替进行。感觉东西越学越多,忘得也越来越多,戒骄戒躁,持之以恒。
本文主要介绍PCL库的点云读入,拼接和保存的用法:
两点说明:
1、 在定义点云变量时,如下代码中有两种方法:
一种是指针型的(pcl::PointCloud<pcl::PointXYZ>::Ptr cloudPtr(new pcl::PointCloud<pcl::PointXYZ>))
一种是常规(pcl::PointCloud<pcl::PointXYZ> cloud)
两种定义方法在使用的时候有如下的转换关系:
cloudPtr = cloud.makeShared();
cloud = *cloudPtr;
但是在什么情况下,用哪一种定义方式更加合适,没有想到一个可实施的规范,欢迎大家补充;
2、 在新建点云时有一个变量:
cloud.is_dense = false;
相信很多人都写过,但是“is_dense”含义不一定明确。查询官网解释如下:
True if no points are invalid (e.g., have NaN or Inf values in any of their floating point fields).
#include<iostream>
#include<pcl/io/pcd_io.h>
#include<pcl/point_types.h>
template<<