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

Revision history [back]

In general, PCL filters are not meant to be used in-place; if that works, all that's happened is that you've gotten lucky.

And .makeShared() does, in fact, make a copy. In general, the way to use PCL is to do everything as a pointer explicitly; the correct construction is then

pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGB>());

which gets you a smart pointer for passing around (a boost::shared_ptr, behind the scenes).

I strongly recommend a typedef or three to make that less painful to type...