10 #define YARP_PCL_PCL_H
12 #include <pcl/io/pcd_io.h>
26 template<
class T1,
class T2 >
29 static_assert(
sizeof(T1) ==
sizeof(T2),
"yarp::pcl::toPcl: T1 and T2 are incompatible");
30 pclCloud.points.resize(yarpCloud.
size());
31 pclCloud.width = yarpCloud.
width();
32 pclCloud.height = yarpCloud.
height();
33 pclCloud.is_dense = yarpCloud.
isDense();
44 template<
class T1,
class T2 >
47 static_assert(
sizeof(T1) ==
sizeof(T2),
"yarp::pcl::fromPCL: T1 and T2 are incompatible");
48 yarpCloud.
fromExternalPC((
char*) &pclCloud(0,0), yarpCloud.
getPointType(), pclCloud.width, pclCloud.height, pclCloud.is_dense);
58 template<
class T1,
class T2 >
61 static_assert(
sizeof(T1) ==
sizeof(T2),
"yarp::pcl::savePCD: T1 and T2 are incompatible");
62 ::pcl::PointCloud<T2> pclCloud(yarpCloud.
width(), yarpCloud.
height());
63 yarp::pcl::toPCL< T1, T2 >(yarpCloud, pclCloud);
64 return ::pcl::io::savePCDFile(file_name, pclCloud);
73 template<
class T1,
class T2 >
76 static_assert(
sizeof(T1) ==
sizeof(T2),
"yarp::pcl::loadPCD: T1 and T2 are incompatible");
77 ::pcl::PointCloud<T1> pclCloud;
78 int ret = ::pcl::io::loadPCDFile(file_name, pclCloud);
79 yarp::pcl::fromPCL< T1, T2 >(pclCloud, yarpCloud);