9#include <pcl/io/pcd_io.h>
23template<
class T1,
class T2 >
26 static_assert(
sizeof(T1) ==
sizeof(T2),
"yarp::pcl::toPcl: T1 and T2 are incompatible");
27 pclCloud.points.resize(yarpCloud.
size());
28 pclCloud.width = yarpCloud.
width();
29 pclCloud.height = yarpCloud.
height();
30 pclCloud.is_dense = yarpCloud.
isDense();
41template<
class T1,
class T2 >
44 static_assert(
sizeof(T1) ==
sizeof(T2),
"yarp::pcl::fromPCL: T1 and T2 are incompatible");
45 yarpCloud.
fromExternalPC((
char*) &pclCloud(0,0), yarpCloud.
getPointType(), pclCloud.width, pclCloud.height, pclCloud.is_dense);
55template<
class T1,
class T2 >
58 static_assert(
sizeof(T1) ==
sizeof(T2),
"yarp::pcl::savePCD: T1 and T2 are incompatible");
59 ::pcl::PointCloud<T2> pclCloud(yarpCloud.
width(), yarpCloud.
height());
60 yarp::pcl::toPCL< T1, T2 >(yarpCloud, pclCloud);
61 return ::pcl::io::savePCDFile(file_name, pclCloud);
70template<
class T1,
class T2 >
73 static_assert(
sizeof(T1) ==
sizeof(T2),
"yarp::pcl::loadPCD: T1 and T2 are incompatible");
74 ::pcl::PointCloud<T1> pclCloud;
75 int ret = ::pcl::io::loadPCDFile(file_name, pclCloud);
76 yarp::pcl::fromPCL< T1, T2 >(pclCloud, yarpCloud);
virtual size_t width() const
virtual bool isDense() const
virtual int getPointType() const
virtual size_t height() const
const char * getRawData() const override
Get the pointer to the data.
virtual void fromExternalPC(const char *source, int type, size_t width, size_t height, bool isDense=true)
Copy the content of an external PointCloud.
size_t dataSizeBytes() const override
Get the size of the data in terms of number of bytes.
size_t size() const override
bool fromPCL(const ::pcl::PointCloud< T1 > &pclCloud, yarp::sig::PointCloud< T2 > &yarpCloud)
Convert a pcl::PointCloud to a yarp::sig::PointCloud object.
int loadPCD(const std::string &file_name, yarp::sig::PointCloud< T2 > &yarpCloud)
Load a yarp::sig::PointCloud from a PCD file, ASCII format.
int savePCD(const std::string &file_name, const yarp::sig::PointCloud< T1 > &yarpCloud)
Save a yarp::sig::PointCloud to PCD file, ASCII format.
bool toPCL(const yarp::sig::PointCloud< T1 > &yarpCloud, ::pcl::PointCloud< T2 > &pclCloud)
Convert a yarp::sig::PointCloud to a pcl::PointCloud object.
The main, catch-all namespace for YARP.