How to convert between different point cloud types using PCL?
I wonder whether there is an elegant way to convert instances of pcl::PointCloud<pcl::PointXYZ>
to pcl::PointCloud<pcl::PointXYZRGB>
and vice-versa?
I am trying to load point cloud data from a .pcd-file that only includes XYZ data. Finally, I want to feed this point cloud into a module that requires PointXYZRGB data (but actually does not use the RGB data).
My current solution is to call pcd::io::loadPCDFile
in order to populate pcl::PointCloud<pcl::PointXYZ>
and then just copy points over one-by-one to a XYZRGB point cloud. Note that I am relatively new to C++ programming and might have overseen an obvious solution.
(I am using diamondback)