Point Cloud Library (PCL)  1.9.1-dev
io.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2011, Willow Garage, Inc.
6  * Copyright (c) 2012-, Open Perception, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * * Neither the name of the copyright holder(s) nor the names of its
21  * contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  * $Id$
38  *
39  */
40 
41 #pragma once
42 
43 #include <numeric>
44 #include <string>
45 
46 #include <pcl/pcl_base.h>
47 #include <pcl/PointIndices.h>
48 #include <pcl/conversions.h>
49 #include <pcl/exceptions.h>
50 #include <pcl/PolygonMesh.h>
51 #include <locale>
52 
53 namespace pcl
54 {
55  /** \brief Get the index of a specified field (i.e., dimension/channel)
56  * \param[in] cloud the point cloud message
57  * \param[in] field_name the string defining the field name
58  * \ingroup common
59  */
60  inline int
61  getFieldIndex (const pcl::PCLPointCloud2 &cloud, const std::string &field_name)
62  {
63  // Get the index we need
64  const auto result = std::find_if(cloud.fields.begin (), cloud.fields.end (),
65  [&field_name](const auto field) { return field.name == field_name; });
66  if (result == cloud.fields.end ())
67  return -1;
68  return std::distance(cloud.fields.begin (), result);
69  }
70 
71  /** \brief Get the index of a specified field (i.e., dimension/channel)
72  * \param[in] cloud the point cloud message
73  * \param[in] field_name the string defining the field name
74  * \param[out] fields a vector to the original \a PCLPointField vector that the raw PointCloud message contains
75  * \ingroup common
76  */
77  template <typename PointT>
78  [[deprecated("use getFieldIndex<PointT> (field_name, fields) instead")]]
79  inline int
80  getFieldIndex (const pcl::PointCloud<PointT> &cloud, const std::string &field_name,
81  std::vector<pcl::PCLPointField> &fields);
82 
83  /** \brief Get the index of a specified field (i.e., dimension/channel)
84  * \tparam PointT datatype for which fields is being queries
85  * \param[in] field_name the string defining the field name
86  * \param[out] fields a vector to the original \a PCLPointField vector that the raw PointCloud message contains
87  * \ingroup common
88  */
89  template <typename PointT> inline int
90  getFieldIndex (const std::string &field_name,
91  std::vector<pcl::PCLPointField> &fields);
92  /** \brief Get the index of a specified field (i.e., dimension/channel)
93  * \tparam PointT datatype for which fields is being queries
94  * \param[in] field_name the string defining the field name
95  * \param[in] fields a vector to the original \a PCLPointField vector that the raw PointCloud message contains
96  * \ingroup common
97  */
98  template <typename PointT> inline int
99  getFieldIndex (const std::string &field_name,
100  const std::vector<pcl::PCLPointField> &fields);
101 
102  /** \brief Get the list of available fields (i.e., dimension/channel)
103  * \param[in] cloud the point cloud message
104  * \param[out] fields a vector to the original \a PCLPointField vector that the raw PointCloud message contains
105  * \ingroup common
106  */
107  template <typename PointT>
108  [[deprecated("use getFields<PointT> () with return value instead")]]
109  inline void
110  getFields (const pcl::PointCloud<PointT> &cloud, std::vector<pcl::PCLPointField> &fields);
111 
112  /** \brief Get the list of available fields (i.e., dimension/channel)
113  * \tparam PointT datatype whose details are requested
114  * \param[out] fields a vector to the original \a PCLPointField vector that the raw PointCloud message contains
115  * \ingroup common
116  */
117  template <typename PointT>
118  [[deprecated("use getFields<PointT> () with return value instead")]]
119  inline void
120  getFields (std::vector<pcl::PCLPointField> &fields);
121 
122  /** \brief Get the list of available fields (i.e., dimension/channel)
123  * \tparam PointT datatype whose details are requested
124  * \ingroup common
125  */
126  template <typename PointT> inline std::vector<pcl::PCLPointField>
127  getFields ();
128 
129  /** \brief Get the list of all fields available in a given cloud
130  * \param[in] cloud the point cloud message
131  * \ingroup common
132  */
133  template <typename PointT> inline std::string
134  getFieldsList (const pcl::PointCloud<PointT> &cloud);
135 
136  /** \brief Get the available point cloud fields as a space separated string
137  * \param[in] cloud a pointer to the PointCloud message
138  * \ingroup common
139  */
140  inline std::string
142  {
143  return std::accumulate(std::next (cloud.fields.begin ()), cloud.fields.end (), cloud.fields[0].name,
144  [](const auto& acc, const auto& field) { return acc + " " + field.name; });
145  }
146 
147  /** \brief Obtains the size of a specific field data type in bytes
148  * \param[in] datatype the field data type (see PCLPointField.h)
149  * \ingroup common
150  */
151  inline int
152  getFieldSize (const int datatype)
153  {
154  switch (datatype)
155  {
158  return (1);
159 
162  return (2);
163 
167  return (4);
168 
170  return (8);
171 
172  default:
173  return (0);
174  }
175  }
176 
177  /** \brief Obtain a vector with the sizes of all valid fields (e.g., not "_")
178  * \param[in] fields the input vector containing the fields
179  * \param[out] field_sizes the resultant field sizes in bytes
180  */
181  PCL_EXPORTS void
182  getFieldsSizes (const std::vector<pcl::PCLPointField> &fields,
183  std::vector<int> &field_sizes);
184 
185  /** \brief Obtains the type of the PCLPointField from a specific size and type
186  * \param[in] size the size in bytes of the data field
187  * \param[in] type a char describing the type of the field ('F' = float, 'I' = signed, 'U' = unsigned)
188  * \ingroup common
189  */
190  inline int
191  getFieldType (const int size, char type)
192  {
193  type = std::toupper (type, std::locale::classic ());
194  switch (size)
195  {
196  case 1:
197  if (type == 'I')
198  return (pcl::PCLPointField::INT8);
199  if (type == 'U')
200  return (pcl::PCLPointField::UINT8);
201  break;
202 
203  case 2:
204  if (type == 'I')
205  return (pcl::PCLPointField::INT16);
206  if (type == 'U')
208  break;
209 
210  case 4:
211  if (type == 'I')
212  return (pcl::PCLPointField::INT32);
213  if (type == 'U')
215  if (type == 'F')
217  break;
218 
219  case 8:
220  if (type == 'F')
222  break;
223  }
224  return (-1);
225  }
226 
227  /** \brief Obtains the type of the PCLPointField from a specific PCLPointField as a char
228  * \param[in] type the PCLPointField field type
229  * \ingroup common
230  */
231  inline char
232  getFieldType (const int type)
233  {
234  switch (type)
235  {
239  return ('I');
240 
244  return ('U');
245 
248  return ('F');
249  default:
250  return ('?');
251  }
252  }
253 
255  {
260  };
261 
262  /** \brief \return the right index according to the interpolation type.
263  * \note this is adapted from OpenCV
264  * \param p the index of point to interpolate
265  * \param length the top/bottom row or left/right column index
266  * \param type the requested interpolation
267  * \throws pcl::BadArgumentException if type is unknown
268  */
269  PCL_EXPORTS int
270  interpolatePointIndex (int p, int length, InterpolationType type);
271 
272  /** \brief Concatenate two pcl::PointCloud<PointT>
273  * \param[in] cloud1 the first input point cloud dataset
274  * \param[in] cloud2 the second input point cloud dataset
275  * \param[out] cloud_out the resultant output point cloud dataset
276  * \return true if successful, false otherwise
277  * \ingroup common
278  */
279  template <typename PointT>
280  PCL_EXPORTS bool
282  const pcl::PointCloud<PointT> &cloud2,
283  pcl::PointCloud<PointT> &cloud_out)
284  {
285  return pcl::PointCloud<PointT>::concatenate(cloud1, cloud2, cloud_out);
286  }
287 
288  /** \brief Concatenate two pcl::PCLPointCloud2
289  *
290  * \warn This function subtly differs from the deprecated `concatenatePointloud`
291  * The difference is thatthis function will concatenate IFF the non-skip fields
292  * are in the correct order and same in number. The deprecated function skipped
293  * fields even if both clouds didn't agree on the number of output fields
294  * \param[in] cloud1 the first input point cloud dataset
295  * \param[in] cloud2 the second input point cloud dataset
296  * \param[out] cloud_out the resultant output point cloud dataset
297  * \return true if successful, false otherwise
298  * \ingroup common
299  */
300  PCL_EXPORTS inline bool
302  const pcl::PCLPointCloud2 &cloud2,
303  pcl::PCLPointCloud2 &cloud_out)
304  {
305  return pcl::PCLPointCloud2::concatenate(cloud1, cloud2, cloud_out);
306  }
307 
308  /** \brief Concatenate two pcl::PolygonMesh
309  * \param[in] mesh1 the first input mesh
310  * \param[in] mesh2 the second input mesh
311  * \param[out] mesh_out the resultant output mesh
312  * \return true if successful, false otherwise
313  * \ingroup common
314  */
315  PCL_EXPORTS inline bool
317  const pcl::PolygonMesh &mesh2,
318  pcl::PolygonMesh &mesh_out)
319  {
320  return pcl::PolygonMesh::concatenate(mesh1, mesh2, mesh_out);
321  }
322 
323  /** \brief Concatenate two pcl::PCLPointCloud2
324  * \param[in] cloud1 the first input point cloud dataset
325  * \param[in] cloud2 the second input point cloud dataset
326  * \param[out] cloud_out the resultant output point cloud dataset
327  * \return true if successful, false otherwise (e.g., name/number of fields differs)
328  * \ingroup common
329  */
330  [[deprecated("use pcl::concatenate() instead, but beware of subtle difference in behavior (see documentation)")]]
331  PCL_EXPORTS bool
333  const pcl::PCLPointCloud2 &cloud2,
334  pcl::PCLPointCloud2 &cloud_out);
335 
336  /** \brief Extract the indices of a given point cloud as a new point cloud
337  * \param[in] cloud_in the input point cloud dataset
338  * \param[in] indices the vector of indices representing the points to be copied from \a cloud_in
339  * \param[out] cloud_out the resultant output point cloud dataset
340  * \note Assumes unique indices.
341  * \ingroup common
342  */
343  PCL_EXPORTS void
344  copyPointCloud (const pcl::PCLPointCloud2 &cloud_in,
345  const std::vector<int> &indices,
346  pcl::PCLPointCloud2 &cloud_out);
347 
348  /** \brief Extract the indices of a given point cloud as a new point cloud
349  * \param[in] cloud_in the input point cloud dataset
350  * \param[in] indices the vector of indices representing the points to be copied from \a cloud_in
351  * \param[out] cloud_out the resultant output point cloud dataset
352  * \note Assumes unique indices.
353  * \ingroup common
354  */
355  PCL_EXPORTS void
356  copyPointCloud (const pcl::PCLPointCloud2 &cloud_in,
357  const std::vector<int, Eigen::aligned_allocator<int> > &indices,
358  pcl::PCLPointCloud2 &cloud_out);
359 
360  /** \brief Copy fields and point cloud data from \a cloud_in to \a cloud_out
361  * \param[in] cloud_in the input point cloud dataset
362  * \param[out] cloud_out the resultant output point cloud dataset
363  * \ingroup common
364  */
365  PCL_EXPORTS void
366  copyPointCloud (const pcl::PCLPointCloud2 &cloud_in,
367  pcl::PCLPointCloud2 &cloud_out);
368 
369  /** \brief Check if two given point types are the same or not. */
370  template <typename Point1T, typename Point2T> inline bool
372  {
373  return (typeid (Point1T) == typeid (Point2T));
374  }
375 
376  /** \brief Extract the indices of a given point cloud as a new point cloud
377  * \param[in] cloud_in the input point cloud dataset
378  * \param[in] indices the vector of indices representing the points to be copied from \a cloud_in
379  * \param[out] cloud_out the resultant output point cloud dataset
380  * \note Assumes unique indices.
381  * \ingroup common
382  */
383  template <typename PointT, typename IndicesVectorAllocator = std::allocator<int>> void
384  copyPointCloud (const pcl::PointCloud<PointT> &cloud_in,
385  const std::vector<int, IndicesVectorAllocator> &indices,
386  pcl::PointCloud<PointT> &cloud_out);
387 
388  /** \brief Extract the indices of a given point cloud as a new point cloud
389  * \param[in] cloud_in the input point cloud dataset
390  * \param[in] indices the PointIndices structure representing the points to be copied from cloud_in
391  * \param[out] cloud_out the resultant output point cloud dataset
392  * \note Assumes unique indices.
393  * \ingroup common
394  */
395  template <typename PointT> void
396  copyPointCloud (const pcl::PointCloud<PointT> &cloud_in,
397  const PointIndices &indices,
398  pcl::PointCloud<PointT> &cloud_out);
399 
400  /** \brief Extract the indices of a given point cloud as a new point cloud
401  * \param[in] cloud_in the input point cloud dataset
402  * \param[in] indices the vector of indices representing the points to be copied from \a cloud_in
403  * \param[out] cloud_out the resultant output point cloud dataset
404  * \note Assumes unique indices.
405  * \ingroup common
406  */
407  template <typename PointT> void
408  copyPointCloud (const pcl::PointCloud<PointT> &cloud_in,
409  const std::vector<pcl::PointIndices> &indices,
410  pcl::PointCloud<PointT> &cloud_out);
411 
412  /** \brief Copy all the fields from a given point cloud into a new point cloud
413  * \param[in] cloud_in the input point cloud dataset
414  * \param[out] cloud_out the resultant output point cloud dataset
415  * \ingroup common
416  */
417  template <typename PointInT, typename PointOutT> void
418  copyPointCloud (const pcl::PointCloud<PointInT> &cloud_in,
419  pcl::PointCloud<PointOutT> &cloud_out);
420 
421  /** \brief Extract the indices of a given point cloud as a new point cloud
422  * \param[in] cloud_in the input point cloud dataset
423  * \param[in] indices the vector of indices representing the points to be copied from \a cloud_in
424  * \param[out] cloud_out the resultant output point cloud dataset
425  * \note Assumes unique indices.
426  * \ingroup common
427  */
428  template <typename PointInT, typename PointOutT, typename IndicesVectorAllocator = std::allocator<int>> void
429  copyPointCloud (const pcl::PointCloud<PointInT> &cloud_in,
430  const std::vector<int, IndicesVectorAllocator> &indices,
431  pcl::PointCloud<PointOutT> &cloud_out);
432 
433  /** \brief Extract the indices of a given point cloud as a new point cloud
434  * \param[in] cloud_in the input point cloud dataset
435  * \param[in] indices the PointIndices structure representing the points to be copied from cloud_in
436  * \param[out] cloud_out the resultant output point cloud dataset
437  * \note Assumes unique indices.
438  * \ingroup common
439  */
440  template <typename PointInT, typename PointOutT> void
441  copyPointCloud (const pcl::PointCloud<PointInT> &cloud_in,
442  const PointIndices &indices,
443  pcl::PointCloud<PointOutT> &cloud_out);
444 
445  /** \brief Extract the indices of a given point cloud as a new point cloud
446  * \param[in] cloud_in the input point cloud dataset
447  * \param[in] indices the vector of indices representing the points to be copied from cloud_in
448  * \param[out] cloud_out the resultant output point cloud dataset
449  * \note Assumes unique indices.
450  * \ingroup common
451  */
452  template <typename PointInT, typename PointOutT> void
453  copyPointCloud (const pcl::PointCloud<PointInT> &cloud_in,
454  const std::vector<pcl::PointIndices> &indices,
455  pcl::PointCloud<PointOutT> &cloud_out);
456 
457  /** \brief Copy a point cloud inside a larger one interpolating borders.
458  * \param[in] cloud_in the input point cloud dataset
459  * \param[out] cloud_out the resultant output point cloud dataset
460  * \param top
461  * \param bottom
462  * \param left
463  * \param right
464  * Position of cloud_in inside cloud_out is given by \a top, \a left, \a bottom \a right.
465  * \param[in] border_type the interpolating method (pcl::BORDER_XXX)
466  * BORDER_REPLICATE: aaaaaa|abcdefgh|hhhhhhh
467  * BORDER_REFLECT: fedcba|abcdefgh|hgfedcb
468  * BORDER_REFLECT_101: gfedcb|abcdefgh|gfedcba
469  * BORDER_WRAP: cdefgh|abcdefgh|abcdefg
470  * BORDER_CONSTANT: iiiiii|abcdefgh|iiiiiii with some specified 'i'
471  * BORDER_TRANSPARENT: mnopqr|abcdefgh|tuvwxyz where m-r and t-z are original values of cloud_out
472  * \param value
473  * \throw pcl::BadArgumentException if any of top, bottom, left or right is negative.
474  * \ingroup common
475  */
476  template <typename PointT> void
477  copyPointCloud (const pcl::PointCloud<PointT> &cloud_in,
478  pcl::PointCloud<PointT> &cloud_out,
479  int top, int bottom, int left, int right,
480  pcl::InterpolationType border_type, const PointT& value);
481 
482  /** \brief Concatenate two datasets representing different fields.
483  *
484  * \note If the input datasets have overlapping fields (i.e., both contain
485  * the same fields), then the data in the second cloud (cloud2_in) will
486  * overwrite the data in the first (cloud1_in).
487  *
488  * \param[in] cloud1_in the first input dataset
489  * \param[in] cloud2_in the second input dataset (overwrites the fields of the first dataset for those that are shared)
490  * \param[out] cloud_out the resultant output dataset created by the concatenation of all the fields in the input datasets
491  * \ingroup common
492  */
493  template <typename PointIn1T, typename PointIn2T, typename PointOutT> void
495  const pcl::PointCloud<PointIn2T> &cloud2_in,
496  pcl::PointCloud<PointOutT> &cloud_out);
497 
498  /** \brief Concatenate two datasets representing different fields.
499  *
500  * \note If the input datasets have overlapping fields (i.e., both contain
501  * the same fields), then the data in the second cloud (cloud2_in) will
502  * overwrite the data in the first (cloud1_in).
503  *
504  * \param[in] cloud1_in the first input dataset
505  * \param[in] cloud2_in the second input dataset (overwrites the fields of the first dataset for those that are shared)
506  * \param[out] cloud_out the output dataset created by concatenating all the fields in the input datasets
507  * \ingroup common
508  */
509  PCL_EXPORTS bool
510  concatenateFields (const pcl::PCLPointCloud2 &cloud1_in,
511  const pcl::PCLPointCloud2 &cloud2_in,
512  pcl::PCLPointCloud2 &cloud_out);
513 
514  /** \brief Copy the XYZ dimensions of a pcl::PCLPointCloud2 into Eigen format
515  * \param[in] in the point cloud message
516  * \param[out] out the resultant Eigen MatrixXf format containing XYZ0 / point
517  * \ingroup common
518  */
519  PCL_EXPORTS bool
520  getPointCloudAsEigen (const pcl::PCLPointCloud2 &in, Eigen::MatrixXf &out);
521 
522  /** \brief Copy the XYZ dimensions from an Eigen MatrixXf into a pcl::PCLPointCloud2 message
523  * \param[in] in the Eigen MatrixXf format containing XYZ0 / point
524  * \param[out] out the resultant point cloud message
525  * \note the method assumes that the PCLPointCloud2 message already has the fields set up properly !
526  * \ingroup common
527  */
528  PCL_EXPORTS bool
529  getEigenAsPointCloud (Eigen::MatrixXf &in, pcl::PCLPointCloud2 &out);
530 
531  namespace io
532  {
533  /** \brief swap bytes order of a char array of length N
534  * \param bytes char array to swap
535  * \ingroup common
536  */
537  template <std::size_t N> void
538  swapByte (char* bytes);
539 
540  /** \brief specialization of swapByte for dimension 1
541  * \param bytes char array to swap
542  */
543  template <> inline void
544  swapByte<1> (char* bytes) { bytes[0] = bytes[0]; }
545 
546 
547  /** \brief specialization of swapByte for dimension 2
548  * \param bytes char array to swap
549  */
550  template <> inline void
551  swapByte<2> (char* bytes) { std::swap (bytes[0], bytes[1]); }
552 
553  /** \brief specialization of swapByte for dimension 4
554  * \param bytes char array to swap
555  */
556  template <> inline void
557  swapByte<4> (char* bytes)
558  {
559  std::swap (bytes[0], bytes[3]);
560  std::swap (bytes[1], bytes[2]);
561  }
562 
563  /** \brief specialization of swapByte for dimension 8
564  * \param bytes char array to swap
565  */
566  template <> inline void
567  swapByte<8> (char* bytes)
568  {
569  std::swap (bytes[0], bytes[7]);
570  std::swap (bytes[1], bytes[6]);
571  std::swap (bytes[2], bytes[5]);
572  std::swap (bytes[3], bytes[4]);
573  }
574 
575  /** \brief swaps byte of an arbitrary type T casting it to char*
576  * \param value the data you want its bytes swapped
577  */
578  template <typename T> void
579  swapByte (T& value)
580  {
581  pcl::io::swapByte<sizeof(T)> (reinterpret_cast<char*> (&value));
582  }
583  }
584 }
585 
586 #include <pcl/common/impl/io.hpp>
std::vector<::pcl::PCLPointField > fields
int getFieldIndex(const pcl::PCLPointCloud2 &cloud, const std::string &field_name)
Get the index of a specified field (i.e., dimension/channel)
Definition: io.h:61
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
std::string getFieldsList(const pcl::PointCloud< PointT > &cloud)
Get the list of all fields available in a given cloud.
Definition: io.hpp:105
static bool concatenate(pcl::PCLPointCloud2 &cloud1, const pcl::PCLPointCloud2 &cloud2)
Inplace concatenate two pcl::PCLPointCloud2.
void swapByte< 8 >(char *bytes)
specialization of swapByte for dimension 8
Definition: io.h:567
bool isSamePointType()
Check if two given point types are the same or not.
Definition: io.h:371
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.
Definition: io.h:191
PCL_EXPORTS bool getPointCloudAsEigen(const pcl::PCLPointCloud2 &in, Eigen::MatrixXf &out)
Copy the XYZ dimensions of a pcl::PCLPointCloud2 into Eigen format.
float distance(const PointT &p1, const PointT &p2)
Definition: geometry.h:60
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 "_")
PCL_EXPORTS bool concatenate(const pcl::PointCloud< PointT > &cloud1, const pcl::PointCloud< PointT > &cloud2, pcl::PointCloud< PointT > &cloud_out)
Concatenate two pcl::PointCloud<PointT>
Definition: io.h:281
void swapByte< 1 >(char *bytes)
specialization of swapByte for dimension 1
Definition: io.h:544
int getFieldSize(const int datatype)
Obtains the size of a specific field data type in bytes.
Definition: io.h:152
PointCloud represents the base class in PCL for storing collections of 3D points. ...
InterpolationType
Definition: io.h:254
PCL_EXPORTS bool getEigenAsPointCloud(Eigen::MatrixXf &in, pcl::PCLPointCloud2 &out)
Copy the XYZ dimensions from an Eigen MatrixXf into a pcl::PCLPointCloud2 message.
static bool concatenate(pcl::PointCloud< PointT > &cloud1, const pcl::PointCloud< PointT > &cloud2)
Definition: point_cloud.h:236
PCL_EXPORTS int interpolatePointIndex(int p, int length, InterpolationType type)
void swapByte< 2 >(char *bytes)
specialization of swapByte for dimension 2
Definition: io.h:551
PCL_EXPORTS bool concatenatePointCloud(const pcl::PCLPointCloud2 &cloud1, const pcl::PCLPointCloud2 &cloud2, pcl::PCLPointCloud2 &cloud_out)
Concatenate two pcl::PCLPointCloud2.
static bool concatenate(pcl::PolygonMesh &mesh1, const pcl::PolygonMesh &mesh2)
Inplace concatenate two pcl::PolygonMesh.
Definition: PolygonMesh.h:32
A point structure representing Euclidean xyz coordinates, and the RGB color.
void swapByte< 4 >(char *bytes)
specialization of swapByte for dimension 4
Definition: io.h:557
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.
Definition: io.hpp:305
#define PCL_EXPORTS
Definition: pcl_macros.h:241
void getFields(const pcl::PointCloud< PointT > &cloud, std::vector< pcl::PCLPointField > &fields)
Get the list of available fields (i.e., dimension/channel)
Definition: io.hpp:81