PCL点云库学习笔记(基本结构)

PCL点云库学习笔记(基本结构)

  • 基本用法
    • 入门\基本结构
    • 点的类型

基本用法

不知道怎么入门,就先从阅读官方文档开始了,记录下学习的过程和出现的错误。官方文档的walkthrough介绍了各个部分,学到的时候再细看

入门\基本结构

pcl::PointCloud是基本的数据类型,PointCloud是一个c++的类,包含以下的数据:
1.pcl::PointCloudwidth在无序数据集表示点的总数;在有序的点云数据集表示一行中的总点数。
2.pcl::PointCloud在有序的点云数据集中表示总行数;无序的数据集中为1

cloud.width = 640; // there are 640 points per line
cloud.height = 480; // thus 640*480=307200 points total in the dataset

cloud.width = 307200;
cloud.height = 1; // unorganized point cloud dataset with 307200 points

要判断点云是否有序,不用判断height,用函数if (!cloud.isOrganized ())
3.pcl::pointspoints用于储存PointT类型点的向量,例如PointXYZ类型的点

pcl::PointCloud cloud;//PointXYZ类型的点储存到点云cloud
std::vector data = cloud.points;//cloud里的数据是储存在points里面的

4.pcl::is_densebool类型,为真时表示所有点有限,为假时表示有些点可能无限或者为空

点的类型

1.PointXYZ 成员变量: float x, y, z;
定义一个点云

pcl::PointCloud cloud;
pcl::PointCloud::Ptr cloud_ptr(new pcl::PointCloud);//指针类型的

用points[i].data[0],或者points[i].x访问点的x坐标值,points是个vector变量,points[i]是单个的点

cloud->points[i].x
pcl::PointXYZ point;//创建一个点放到点云里去
point.x = 2.0f - y;
point.y = y;
point.z = z;
cloud.points.push_back(point);

你可能感兴趣的:(PCL,c++)