Point Cloud Library (PCL)  1.10.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/pcl_macros.h>
51 #include <pcl/PolygonMesh.h>
52 #include <locale>
53 
54 namespace pcl
55 {
56  /** \brief Get the index of a specified field (i.e., dimension/channel)
57  * \param[in] cloud the point cloud message
58  * \param[in] field_name the string defining the field name
59  * \ingroup common
60  */
61  inline int
62  getFieldIndex (const pcl::PCLPointCloud2 &cloud, const std::string &field_name)
63  {
64  // Get the index we need
65  const auto result = std::find_if(cloud.fields.begin (), cloud.fields.end (),
66  [&field_name](const auto field) { return field.name == field_name; });
67  if (result == cloud.fields.end ())
68  return -1;
69  return std::distance(cloud.fields.begin (), result);
70  }
71 
72  /** \brief Get the index of a specified field (i.e., dimension/channel)
73  * \param[in] cloud the point cloud message
74  * \param[in] field_name the string defining the field name
75  * \param[out] fields a vector to the original \a PCLPointField vector that the raw PointCloud message contains
76  * \ingroup common
77  */
78  template <typename PointT>
79  PCL_DEPRECATED(1, 12, "use getFieldIndex<PointT> (field_name, fields) instead")
80  inline int
81  getFieldIndex (const pcl::PointCloud<PointT> &cloud, const std::string &field_name,
82  std::vector<pcl::PCLPointField> &fields);
83 
84  /** \brief Get the index of a specified field (i.e., dimension/channel)
85  * \tparam PointT datatype for which fields is being queries
86  * \param[in] field_name the string defining the field name
87  * \param[out] fields a vector to the original \a PCLPointField vector that the raw PointCloud message contains
88  * \ingroup common
89  */
90  template <typename PointT> inline int
91  getFieldIndex (const std::string &field_name,
92  std::vector<pcl::PCLPointField> &fields);
93  /** \brief Get the index of a specified field (i.e., dimension/channel)
94  * \tparam PointT datatype for which fields is being queries
95  * \param[in] field_name the string defining the field name
96  * \param[in] fields a vector to the original \a PCLPointField vector that the raw PointCloud message contains
97  * \ingroup common
98  */
99  template <typename PointT> inline int
100  getFieldIndex (const std::string &field_name,
101  const std::vector<pcl::PCLPointField> &fields);
102 
103  /** \brief Get the list of available fields (i.e., dimension/channel)
104  * \param[in] cloud the point cloud message
105  * \param[out] fields a vector to the original \a PCLPointField vector that the raw PointCloud message contains
106  * \ingroup common
107  */
108  template <typename PointT>
109  PCL_DEPRECATED(1, 12, "use getFields<PointT> () with return value instead")
110  inline void
111  getFields (const pcl::PointCloud<PointT> &cloud, std::vector<pcl::PCLPointField> &fields);
112 
113  /** \brief Get the list of available fields (i.e., dimension/channel)
114  * \tparam PointT datatype whose details are requested
115  * \param[out] fields a vector to the original \a PCLPointField vector that the raw PointCloud message contains
116  * \ingroup common
117  */
118  template <typename PointT>
119  PCL_DEPRECATED(1, 12, "use getFields<PointT> () with return value instead")
120  inline void
121  getFields (std::vector<pcl::PCLPointField> &fields);
122 
123  /** \brief Get the list of available fields (i.e., dimension/channel)
124  * \tparam PointT datatype whose details are requested
125  * \ingroup common
126  */
127  template <typename PointT> inline std::vector<pcl::PCLPointField>
128  getFields ();
129 
130  /** \brief Get the list of all fields available in a given cloud
131  * \param[in] cloud the point cloud message
132  * \ingroup common
133  */
134  template <typename PointT> inline std::string
135  getFieldsList (const pcl::PointCloud<PointT> &cloud);
136 
137  /** \brief Get the available point cloud fields as a space separated string
138  * \param[in] cloud a pointer to the PointCloud message
139  * \ingroup common
140  */
141  inline std::string
143  {
144  return std::accumulate(std::next (cloud.fields.begin ()), cloud.fields.end (), cloud.fields[0].name,
145  [](const auto& acc, const auto& field) { return acc + " " + field.name; });
146  }
147 
148  /** \brief Obtains the size of a specific field data type in bytes
149  * \param[in] datatype the field data type (see PCLPointField.h)
150  * \ingroup common
151  */
152  inline int
153  getFieldSize (const int datatype)
154  {
155  switch (datatype)
156  {
159  return (1);
160 
163  return (2);
164 
168  return (4);
169 
171  return (8);
172 
173  default:
174  return (0);
175  }
176  }
177 
178  /** \brief Obtain a vector with the sizes of all valid fields (e.g., not "_")
179  * \param[in] fields the input vector containing the fields
180  * \param[out] field_sizes the resultant field sizes in bytes
181  */
182  PCL_EXPORTS void
183  getFieldsSizes (const std::vector<pcl::PCLPointField> &fields,
184  std::vector<int> &field_sizes);
185 
186  /** \brief Obtains the type of the PCLPointField from a specific size and type
187  * \param[in] size the size in bytes of the data field
188  * \param[in] type a char describing the type of the field ('F' = float, 'I' = signed, 'U' = unsigned)
189  * \ingroup common
190  */
191  inline int
192  getFieldType (const int size, char type)
193  {
194  type = std::toupper (type, std::locale::classic ());
195  switch (size)
196  {
197  case 1:
198  if (type == 'I')
199  return (pcl::PCLPointField::INT8);
200  if (type == 'U')
201  return (pcl::PCLPointField::UINT8);
202  break;
203 
204  case 2:
205  if (type == 'I')
206  return (pcl::PCLPointField::INT16);
207  if (type == 'U')
209  break;
210 
211  case 4:
212  if (type == 'I')
213  return (pcl::PCLPointField::INT32);
214  if (type == 'U')
216  if (type == 'F')
218  break;
219 
220  case 8:
221  if (type == 'F')
223  break;
224  }
225  return (-1);
226  }
227 
228  /** \brief Obtains the type of the PCLPointField from a specific PCLPointField as a char
229  * \param[in] type the PCLPointField field type
230  * \ingroup common
231  */
232  inline char
233  getFieldType (const int type)
234  {
235  switch (type)
236  {
240  return ('I');
241 
245  return ('U');
246 
249  return ('F');
250  default:
251  return ('?');
252  }
253  }
254 
256  {
261  };
262 
263  /** \brief \return the right index according to the interpolation type.
264  * \note this is adapted from OpenCV
265  * \param p the index of point to interpolate
266  * \param length the top/bottom row or left/right column index
267  * \param type the requested interpolation
268  * \throws pcl::BadArgumentException if type is unknown
269  */
270  PCL_EXPORTS int
271  interpolatePointIndex (int p, int length, InterpolationType type);
272 
273  /** \brief Concatenate two pcl::PointCloud<PointT>
274  * \param[in] cloud1 the first input point cloud dataset
275  * \param[in] cloud2 the second input point cloud dataset
276  * \param[out] cloud_out the resultant output point cloud dataset
277  * \return true if successful, false otherwise
278  * \ingroup common
279  */
280  template <typename PointT>
281  PCL_EXPORTS bool
283  const pcl::PointCloud<PointT> &cloud2,
284  pcl::PointCloud<PointT> &cloud_out)
285  {
286  return pcl::PointCloud<PointT>::concatenate(cloud1, cloud2, cloud_out);
287  }
288 
289  /** \brief Concatenate two pcl::PCLPointCloud2
290  *
291  * \warning This function subtly differs from the deprecated concatenatePointCloud()
292  * The difference is that this function will concatenate IFF the non-skip fields
293  * are in the correct order and same in number. The deprecated function skipped
294  * fields even if both clouds didn't agree on the number of output fields
295  * \param[in] cloud1 the first input point cloud dataset
296  * \param[in] cloud2 the second input point cloud dataset
297  * \param[out] cloud_out the resultant output point cloud dataset
298  * \return true if successful, false otherwise
299  * \ingroup common
300  */
301  PCL_EXPORTS inline bool
303  const pcl::PCLPointCloud2 &cloud2,
304  pcl::PCLPointCloud2 &cloud_out)
305  {
306  return pcl::PCLPointCloud2::concatenate(cloud1, cloud2, cloud_out);
307  }
308 
309  /** \brief Concatenate two pcl::PolygonMesh
310  * \param[in] mesh1 the first input mesh
311  * \param[in] mesh2 the second input mesh
312  * \param[out] mesh_out the resultant output mesh
313  * \return true if successful, false otherwise
314  * \ingroup common
315  */
316  PCL_EXPORTS inline bool
318  const pcl::PolygonMesh &mesh2,
319  pcl::PolygonMesh &mesh_out)
320  {
321  return pcl::PolygonMesh::concatenate(mesh1, mesh2, mesh_out);
322  }
323 
324  /** \brief Concatenate two pcl::PCLPointCloud2
325  * \param[in] cloud1 the first input point cloud dataset
326  * \param[in] cloud2 the second input point cloud dataset
327  * \param[out] cloud_out the resultant output point cloud dataset
328  * \return true if successful, false otherwise (e.g., name/number of fields differs)
329  * \ingroup common
330  */
331  PCL_DEPRECATED(1, 12, "use pcl::concatenate() instead, but beware of subtle difference in behavior (see documentation)")
332  PCL_EXPORTS bool
333  concatenatePointCloud (const pcl::PCLPointCloud2 &cloud1,
334  const pcl::PCLPointCloud2 &cloud2,
335  pcl::PCLPointCloud2 &cloud_out);
336 
337  /** \brief Extract the indices of a given point cloud as a new point cloud
338  * \param[in] cloud_in the input point cloud dataset
339  * \param[in] indices the vector of indices representing the points to be copied from \a cloud_in
340  * \param[out] cloud_out the resultant output point cloud dataset
341  * \note Assumes unique indices.
342  * \ingroup common
343  */
344  PCL_EXPORTS void
345  copyPointCloud (const pcl::PCLPointCloud2 &cloud_in,
346  const std::vector<int> &indices,
347  pcl::PCLPointCloud2 &cloud_out);
348 
349  /** \brief Extract the indices of a given point cloud as a new point cloud
350  * \param[in] cloud_in the input point cloud dataset
351  * \param[in] indices the vector of indices representing the points to be copied from \a cloud_in
352  * \param[out] cloud_out the resultant output point cloud dataset
353  * \note Assumes unique indices.
354  * \ingroup common
355  */
356  PCL_EXPORTS void
357  copyPointCloud (const pcl::PCLPointCloud2 &cloud_in,
358  const std::vector<int, Eigen::aligned_allocator<int> > &indices,
359  pcl::PCLPointCloud2 &cloud_out);
360 
361  /** \brief Copy fields and point cloud data from \a cloud_in to \a cloud_out
362  * \param[in] cloud_in the input point cloud dataset
363  * \param[out] cloud_out the resultant output point cloud dataset
364  * \ingroup common
365  */
366  PCL_EXPORTS void
367  copyPointCloud (const pcl::PCLPointCloud2 &cloud_in,
368  pcl::PCLPointCloud2 &cloud_out);
369 
370  /** \brief Check if two given point types are the same or not. */
371  template <typename Point1T, typename Point2T> inline bool
373  {
374  return (typeid (Point1T) == typeid (Point2T));
375  }
376 
377  /** \brief Extract the indices of a given point cloud as a new point cloud
378  * \param[in] cloud_in the input point cloud dataset
379  * \param[in] indices the vector of indices representing the points to be copied from \a cloud_in
380  * \param[out] cloud_out the resultant output point cloud dataset
381  * \note Assumes unique indices.
382  * \ingroup common
383  */
384  template <typename PointT, typename IndicesVectorAllocator = std::allocator<int>> void
385  copyPointCloud (const pcl::PointCloud<PointT> &cloud_in,
386  const std::vector<int, IndicesVectorAllocator> &indices,
387  pcl::PointCloud<PointT> &cloud_out);
388 
389  /** \brief Extract the indices of a given point cloud as a new point cloud
390  * \param[in] cloud_in the input point cloud dataset
391  * \param[in] indices the PointIndices structure representing the points to be copied from cloud_in
392  * \param[out] cloud_out the resultant output point cloud dataset
393  * \note Assumes unique indices.
394  * \ingroup common
395  */
396  template <typename PointT> void
397  copyPointCloud (const pcl::PointCloud<PointT> &cloud_in,
398  const PointIndices &indices,
399  pcl::PointCloud<PointT> &cloud_out);
400 
401  /** \brief Extract the indices of a given point cloud as a new point cloud
402  * \param[in] cloud_in the input point cloud dataset
403  * \param[in] indices the vector of indices representing the points to be copied from \a cloud_in
404  * \param[out] cloud_out the resultant output point cloud dataset
405  * \note Assumes unique indices.
406  * \ingroup common
407  */
408  template <typename PointT> void
409  copyPointCloud (const pcl::PointCloud<PointT> &cloud_in,
410  const std::vector<pcl::PointIndices> &indices,
411  pcl::PointCloud<PointT> &cloud_out);
412 
413  /** \brief Copy all the fields from a given point cloud into a new point cloud
414  * \param[in] cloud_in the input point cloud dataset
415  * \param[out] cloud_out the resultant output point cloud dataset
416  * \ingroup common
417  */
418  template <typename PointInT, typename PointOutT> void
419  copyPointCloud (const pcl::PointCloud<PointInT> &cloud_in,
420  pcl::PointCloud<PointOutT> &cloud_out);
421 
422  /** \brief Extract the indices of a given point cloud as a new point cloud
423  * \param[in] cloud_in the input point cloud dataset
424  * \param[in] indices the vector of indices representing the points to be copied from \a cloud_in
425  * \param[out] cloud_out the resultant output point cloud dataset
426  * \note Assumes unique indices.
427  * \ingroup common
428  */
429  template <typename PointInT, typename PointOutT, typename IndicesVectorAllocator = std::allocator<int>> void
430  copyPointCloud (const pcl::PointCloud<PointInT> &cloud_in,
431  const std::vector<int, IndicesVectorAllocator> &indices,
432  pcl::PointCloud<PointOutT> &cloud_out);
433 
434  /** \brief Extract the indices of a given point cloud as a new point cloud
435  * \param[in] cloud_in the input point cloud dataset
436  * \param[in] indices the PointIndices structure representing the points to be copied from cloud_in
437  * \param[out] cloud_out the resultant output point cloud dataset
438  * \note Assumes unique indices.
439  * \ingroup common
440  */
441  template <typename PointInT, typename PointOutT> void
442  copyPointCloud (const pcl::PointCloud<PointInT> &cloud_in,
443  const PointIndices &indices,
444  pcl::PointCloud<PointOutT> &cloud_out);
445 
446  /** \brief Extract the indices of a given point cloud as a new point cloud
447  * \param[in] cloud_in the input point cloud dataset
448  * \param[in] indices the vector of indices representing the points to be copied from cloud_in
449  * \param[out] cloud_out the resultant output point cloud dataset
450  * \note Assumes unique indices.
451  * \ingroup common
452  */
453  template <typename PointInT, typename PointOutT> void
454  copyPointCloud (const pcl::PointCloud<PointInT> &cloud_in,
455  const std::vector<pcl::PointIndices> &indices,
456  pcl::PointCloud<PointOutT> &cloud_out);
457 
458  /** \brief Copy a point cloud inside a larger one interpolating borders.
459  * \param[in] cloud_in the input point cloud dataset
460  * \param[out] cloud_out the resultant output point cloud dataset
461  * \param top
462  * \param bottom
463  * \param left
464  * \param right
465  * Position of cloud_in inside cloud_out is given by \a top, \a left, \a bottom \a right.
466  * \param[in] border_type the interpolating method (pcl::BORDER_XXX)
467  * BORDER_REPLICATE: aaaaaa|abcdefgh|hhhhhhh
468  * BORDER_REFLECT: fedcba|abcdefgh|hgfedcb
469  * BORDER_REFLECT_101: gfedcb|abcdefgh|gfedcba
470  * BORDER_WRAP: cdefgh|abcdefgh|abcdefg
471  * BORDER_CONSTANT: iiiiii|abcdefgh|iiiiiii with some specified 'i'
472  * BORDER_TRANSPARENT: mnopqr|abcdefgh|tuvwxyz where m-r and t-z are original values of cloud_out
473  * \param value
474  * \throw pcl::BadArgumentException if any of top, bottom, left or right is negative.
475  * \ingroup common
476  */
477  template <typename PointT> void
478  copyPointCloud (const pcl::PointCloud<PointT> &cloud_in,
479  pcl::PointCloud<PointT> &cloud_out,
480  int top, int bottom, int left, int right,
481  pcl::InterpolationType border_type, const PointT& value);
482 
483  /** \brief Concatenate two datasets representing different fields.
484  *
485  * \note If the input datasets have overlapping fields (i.e., both contain
486  * the same fields), then the data in the second cloud (cloud2_in) will
487  * overwrite the data in the first (cloud1_in).
488  *
489  * \param[in] cloud1_in the first input dataset
490  * \param[in] cloud2_in the second input dataset (overwrites the fields of the first dataset for those that are shared)
491  * \param[out] cloud_out the resultant output dataset created by the concatenation of all the fields in the input datasets
492  * \ingroup common
493  */
494  template <typename PointIn1T, typename PointIn2T, typename PointOutT> void
496  const pcl::PointCloud<PointIn2T> &cloud2_in,
497  pcl::PointCloud<PointOutT> &cloud_out);
498 
499  /** \brief Concatenate two datasets representing different fields.
500  *
501  * \note If the input datasets have overlapping fields (i.e., both contain
502  * the same fields), then the data in the second cloud (cloud2_in) will
503  * overwrite the data in the first (cloud1_in).
504  *
505  * \param[in] cloud1_in the first input dataset
506  * \param[in] cloud2_in the second input dataset (overwrites the fields of the first dataset for those that are shared)
507  * \param[out] cloud_out the output dataset created by concatenating all the fields in the input datasets
508  * \ingroup common
509  */
510  PCL_EXPORTS bool
511  concatenateFields (const pcl::PCLPointCloud2 &cloud1_in,
512  const pcl::PCLPointCloud2 &cloud2_in,
513  pcl::PCLPointCloud2 &cloud_out);
514 
515  /** \brief Copy the XYZ dimensions of a pcl::PCLPointCloud2 into Eigen format
516  * \param[in] in the point cloud message
517  * \param[out] out the resultant Eigen MatrixXf format containing XYZ0 / point
518  * \ingroup common
519  */
520  PCL_EXPORTS bool
521  getPointCloudAsEigen (const pcl::PCLPointCloud2 &in, Eigen::MatrixXf &out);
522 
523  /** \brief Copy the XYZ dimensions from an Eigen MatrixXf into a pcl::PCLPointCloud2 message
524  * \param[in] in the Eigen MatrixXf format containing XYZ0 / point
525  * \param[out] out the resultant point cloud message
526  * \note the method assumes that the PCLPointCloud2 message already has the fields set up properly !
527  * \ingroup common
528  */
529  PCL_EXPORTS bool
530  getEigenAsPointCloud (Eigen::MatrixXf &in, pcl::PCLPointCloud2 &out);
531 
532  namespace io
533  {
534  /** \brief swap bytes order of a char array of length N
535  * \param bytes char array to swap
536  * \ingroup common
537  */
538  template <std::size_t N> void
539  swapByte (char* bytes);
540 
541  /** \brief specialization of swapByte for dimension 1
542  * \param bytes char array to swap
543  */
544  template <> inline void
545  swapByte<1> (char* bytes) { bytes[0] = bytes[0]; }
546 
547 
548  /** \brief specialization of swapByte for dimension 2
549  * \param bytes char array to swap
550  */
551  template <> inline void
552  swapByte<2> (char* bytes) { std::swap (bytes[0], bytes[1]); }
553 
554  /** \brief specialization of swapByte for dimension 4
555  * \param bytes char array to swap
556  */
557  template <> inline void
558  swapByte<4> (char* bytes)
559  {
560  std::swap (bytes[0], bytes[3]);
561  std::swap (bytes[1], bytes[2]);
562  }
563 
564  /** \brief specialization of swapByte for dimension 8
565  * \param bytes char array to swap
566  */
567  template <> inline void
568  swapByte<8> (char* bytes)
569  {
570  std::swap (bytes[0], bytes[7]);
571  std::swap (bytes[1], bytes[6]);
572  std::swap (bytes[2], bytes[5]);
573  std::swap (bytes[3], bytes[4]);
574  }
575 
576  /** \brief swaps byte of an arbitrary type T casting it to char*
577  * \param value the data you want its bytes swapped
578  */
579  template <typename T> void
580  swapByte (T& value)
581  {
582  pcl::io::swapByte<sizeof(T)> (reinterpret_cast<char*> (&value));
583  }
584  }
585 }
586 
587 #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:62
use use getFields< PointT >() with return value instead") inline void getFields (std std::vector<pcl::PCLPointField> getFields()
Get the list of available fields (i.e., dimension/channel)
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:568
bool isSamePointType()
Check if two given point types are the same or not.
Definition: io.h:372
void swapByte(char *bytes)
swap bytes order of a char array of length N
int getFieldType(const int size, char type)
Obtains the type of the PCLPointField from a specific size and type.
Definition: io.h:192
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:282
void swapByte< 1 >(char *bytes)
specialization of swapByte for dimension 1
Definition: io.h:545
int getFieldSize(const int datatype)
Obtains the size of a specific field data type in bytes.
Definition: io.h:153
PointCloud represents the base class in PCL for storing collections of 3D points. ...
InterpolationType
Definition: io.h:255
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:238
PCL_EXPORTS int interpolatePointIndex(int p, int length, InterpolationType type)
void swapByte< 2 >(char *bytes)
specialization of swapByte for dimension 2
Definition: io.h:552
use but beware of subtle difference in behavior(see documentation)") PCL_EXPORTS bool concatenatePointCloud ( const pcl 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.
static bool concatenate(pcl::PolygonMesh &mesh1, const pcl::PolygonMesh &mesh2)
Inplace concatenate two pcl::PolygonMesh.
Definition: PolygonMesh.h:32
#define PCL_DEPRECATED(Major, Minor, Message)
macro for compatibility across compilers and help remove old deprecated items for the Major...
Definition: pcl_macros.h:120
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:558
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:276
Defines all the PCL and non-PCL macros used.