41 #ifndef PCL_COMMON_IO_H_
42 #define PCL_COMMON_IO_H_
45 #include <pcl/pcl_base.h>
46 #include <pcl/PointIndices.h>
47 #include <pcl/conversions.h>
48 #include <pcl/exceptions.h>
62 for (
size_t d = 0; d < cloud.
fields.size (); ++d)
63 if (cloud.
fields[d].name == field_name)
64 return (static_cast<int>(d));
74 template <
typename Po
intT>
inline int
76 std::vector<pcl::PCLPointField> &fields);
83 template <
typename Po
intT>
inline int
85 std::vector<pcl::PCLPointField> &fields);
92 template <
typename Po
intT>
inline void
99 template <
typename Po
intT>
inline void
100 getFields (std::vector<pcl::PCLPointField> &fields);
106 template <
typename Po
intT>
inline std::string
117 for (
size_t i = 0; i < cloud.
fields.size () - 1; ++i)
118 result += cloud.
fields[i].name +
" ";
159 std::vector<int> &field_sizes);
169 type = std::toupper (type, std::locale::classic ());
266 const std::vector<int> &indices,
278 const std::vector<
int, Eigen::aligned_allocator<int> > &indices,
291 template <
typename Po
int1T,
typename Po
int2T>
inline bool
294 return (
typeid (Point1T) ==
typeid (Point2T));
304 template <
typename Po
intT>
void
306 const std::vector<int> &indices,
316 template <
typename Po
intT>
void
318 const std::vector<
int, Eigen::aligned_allocator<int> > &indices,
328 template <
typename Po
intT>
void
330 const PointIndices &indices,
340 template <
typename Po
intT>
void
342 const std::vector<pcl::PointIndices> &indices,
350 template <
typename Po
intInT,
typename Po
intOutT>
void
361 template <
typename Po
intInT,
typename Po
intOutT>
void
363 const std::vector<int> &indices,
373 template <
typename Po
intInT,
typename Po
intOutT>
void
375 const std::vector<
int, Eigen::aligned_allocator<int> > &indices,
385 template <
typename Po
intInT,
typename Po
intOutT>
void
387 const PointIndices &indices,
397 template <
typename Po
intInT,
typename Po
intOutT>
void
399 const std::vector<pcl::PointIndices> &indices,
421 template <
typename Po
intT>
void
424 int top,
int bottom,
int left,
int right,
438 template <
typename Po
intIn1T,
typename Po
intIn2T,
typename Po
intOutT>
void
482 template <std::
size_t N>
void
488 template <>
inline void
495 template <>
inline void
501 template <>
inline void
504 std::swap (bytes[0], bytes[3]);
505 std::swap (bytes[1], bytes[2]);
511 template <>
inline void
514 std::swap (bytes[0], bytes[7]);
515 std::swap (bytes[1], bytes[6]);
516 std::swap (bytes[2], bytes[5]);
517 std::swap (bytes[3], bytes[4]);
523 template <
typename T>
void
526 pcl::io::swapByte<sizeof(T)> (
reinterpret_cast<char*
> (&value));
531 #include <pcl/common/impl/io.hpp>
533 #endif //#ifndef PCL_COMMON_IO_H_
int getFieldIndex(const pcl::PCLPointCloud2 &cloud, const std::string &field_name)
Get the index of a specified field (i.e., dimension/channel)
std::string getFieldsList(const pcl::PointCloud< PointT > &cloud)
Get the list of all fields available in a given cloud.
void swapByte< 8 >(char *bytes)
specialization of swapByte for dimension 8
bool isSamePointType()
Check if two given point types are the same or not.
void swapByte(char *bytes)
swap bytes order of a char array of length N
PCL_EXPORTS void copyPointCloud(const pcl::PCLPointCloud2 &cloud_in, const std::vector< int > &indices, pcl::PCLPointCloud2 &cloud_out)
Extract the indices of a given point cloud as a new point cloud.
int getFieldType(const int size, char type)
Obtains the type of the PCLPointField from a specific size and type.
PCL_EXPORTS bool getPointCloudAsEigen(const pcl::PCLPointCloud2 &in, Eigen::MatrixXf &out)
Copy the XYZ dimensions of a pcl::PCLPointCloud2 into Eigen format.
PCL_EXPORTS void getFieldsSizes(const std::vector< pcl::PCLPointField > &fields, std::vector< int > &field_sizes)
Obtain a vector with the sizes of all valid fields (e.g., not "_")
void swapByte< 1 >(char *bytes)
specialization of swapByte for dimension 1
int getFieldSize(const int datatype)
Obtains the size of a specific field data type in bytes.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
std::vector< ::pcl::PCLPointField > fields
PCL_EXPORTS bool getEigenAsPointCloud(Eigen::MatrixXf &in, pcl::PCLPointCloud2 &out)
Copy the XYZ dimensions from an Eigen MatrixXf into a pcl::PCLPointCloud2 message.
PCL_EXPORTS int interpolatePointIndex(int p, int length, InterpolationType type)
void swapByte< 2 >(char *bytes)
specialization of swapByte for dimension 2
PCL_EXPORTS bool concatenatePointCloud(const pcl::PCLPointCloud2 &cloud1, const pcl::PCLPointCloud2 &cloud2, pcl::PCLPointCloud2 &cloud_out)
Concatenate two pcl::PCLPointCloud2.
A point structure representing Euclidean xyz coordinates, and the RGB color.
void swapByte< 4 >(char *bytes)
specialization of swapByte for dimension 4
void concatenateFields(const pcl::PointCloud< PointIn1T > &cloud1_in, const pcl::PointCloud< PointIn2T > &cloud2_in, pcl::PointCloud< PointOutT > &cloud_out)
Concatenate two datasets representing different fields.
void getFields(const pcl::PointCloud< PointT > &cloud, std::vector< pcl::PCLPointField > &fields)
Get the list of available fields (i.e., dimension/channel)