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

Can someone please explain this?

ρss
  • 5,115
  • 8
  • 43
  • 73

2 Answers2

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

cloud is a variable - the name Ptr implies it's a (possibly "smart") pointer, to a PointCloud<PointXYZ> which sounds like some kind of container of 3D points, initialised with a raw pointer (from new) to a default-constructed PointCloud<PointXYZ>. That probably means there won't be any points in the "cloud" yet.

The pcl:: prefixes imply your "point cloud library" is in a namespace called pcl (if you look in the library's header file, likely most of the file will be surrounded by namespace pcl { ... }).

Afterwards, you could use "cloud-> function_name ( args... )" to perform an operation on the cloud - check the cloud type or docs for available functions, data members etc..

Tony Delroy
  • 102,968
  • 15
  • 177
  • 252
0

In summary you need more experience with C++ to use this library but:

1- probably pcl' is an name space for your library that you included.

2- <pcl::PointXYZ> is the template type.

3- cloud is a sample of your object!

4- new allocate memory for pcl::PointCloud<pcl::PointXYZ> and send the pointer to the cloud constructor argumen!

user1436187
  • 3,252
  • 3
  • 26
  • 59