ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

My best guess is that when transforming from PCL2 to PCL you need to get rid of the RGB field.

If I am not mistaken, the representation in memory of the point cloud for PCL2 is something like:

[X0, Y0, Z0, RGB0, X1, Y1, Z1, RGB1, ... Xn, Yn, Zn, RGBn]

and for PCL is:

[X0, Y0, Z0, X1, Y1, Z1, ... Xn, Yn, Zn]

So the only way to transform from PCL2 to PCL is by iterating over the data on PCL2 and ignoring each 4th component (the RGB component) and this takes time, because you can not do a simple memcpy.

Inside the implementation of fromPCLPointCloud2 between lines 202 and 217 you will see what I mean.