Point Cloud Library (PCL)  1.9.1-dev
point_types.hpp
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010, 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  */
38 
39 #ifndef PCL_IMPL_POINT_TYPES_HPP_
40 #define PCL_IMPL_POINT_TYPES_HPP_
41 
42 #if defined __GNUC__
43 # pragma GCC system_header
44 #endif
45 
46 #include <algorithm>
47 #include <ostream>
48 
49 #include <Eigen/Core>
50 
51 #include <pcl/pcl_macros.h>
52 
53 // Define all PCL point types
54 #define PCL_POINT_TYPES \
55  (pcl::PointXYZ) \
56  (pcl::PointXYZI) \
57  (pcl::PointXYZL) \
58  (pcl::Label) \
59  (pcl::PointXYZRGBA) \
60  (pcl::PointXYZRGB) \
61  (pcl::PointXYZRGBL) \
62  (pcl::PointXYZHSV) \
63  (pcl::PointXY) \
64  (pcl::InterestPoint) \
65  (pcl::Axis) \
66  (pcl::Normal) \
67  (pcl::PointNormal) \
68  (pcl::PointXYZRGBNormal) \
69  (pcl::PointXYZINormal) \
70  (pcl::PointXYZLNormal) \
71  (pcl::PointWithRange) \
72  (pcl::PointWithViewpoint) \
73  (pcl::MomentInvariants) \
74  (pcl::PrincipalRadiiRSD) \
75  (pcl::Boundary) \
76  (pcl::PrincipalCurvatures) \
77  (pcl::PFHSignature125) \
78  (pcl::PFHRGBSignature250) \
79  (pcl::PPFSignature) \
80  (pcl::CPPFSignature) \
81  (pcl::PPFRGBSignature) \
82  (pcl::NormalBasedSignature12) \
83  (pcl::FPFHSignature33) \
84  (pcl::VFHSignature308) \
85  (pcl::GASDSignature512) \
86  (pcl::GASDSignature984) \
87  (pcl::GASDSignature7992) \
88  (pcl::GRSDSignature21) \
89  (pcl::ESFSignature640) \
90  (pcl::BRISKSignature512) \
91  (pcl::Narf36) \
92  (pcl::IntensityGradient) \
93  (pcl::PointWithScale) \
94  (pcl::PointSurfel) \
95  (pcl::ShapeContext1980) \
96  (pcl::UniqueShapeContext1960) \
97  (pcl::SHOT352) \
98  (pcl::SHOT1344) \
99  (pcl::PointUV) \
100  (pcl::ReferenceFrame) \
101  (pcl::PointDEM)
102 
103 // Define all point types that include RGB data
104 #define PCL_RGB_POINT_TYPES \
105  (pcl::PointXYZRGBA) \
106  (pcl::PointXYZRGB) \
107  (pcl::PointXYZRGBL) \
108  (pcl::PointXYZRGBNormal) \
109  (pcl::PointSurfel) \
110 
111 // Define all point types that include XYZ data
112 #define PCL_XYZ_POINT_TYPES \
113  (pcl::PointXYZ) \
114  (pcl::PointXYZI) \
115  (pcl::PointXYZL) \
116  (pcl::PointXYZRGBA) \
117  (pcl::PointXYZRGB) \
118  (pcl::PointXYZRGBL) \
119  (pcl::PointXYZHSV) \
120  (pcl::InterestPoint) \
121  (pcl::PointNormal) \
122  (pcl::PointXYZRGBNormal) \
123  (pcl::PointXYZINormal) \
124  (pcl::PointXYZLNormal) \
125  (pcl::PointWithRange) \
126  (pcl::PointWithViewpoint) \
127  (pcl::PointWithScale) \
128  (pcl::PointSurfel) \
129  (pcl::PointDEM)
130 
131 // Define all point types with XYZ and label
132 #define PCL_XYZL_POINT_TYPES \
133  (pcl::PointXYZL) \
134  (pcl::PointXYZRGBL) \
135  (pcl::PointXYZLNormal)
136 
137 // Define all point types that include normal[3] data
138 #define PCL_NORMAL_POINT_TYPES \
139  (pcl::Normal) \
140  (pcl::PointNormal) \
141  (pcl::PointXYZRGBNormal) \
142  (pcl::PointXYZINormal) \
143  (pcl::PointXYZLNormal) \
144  (pcl::PointSurfel)
145 
146 // Define all point types that represent features
147 #define PCL_FEATURE_POINT_TYPES \
148  (pcl::PFHSignature125) \
149  (pcl::PFHRGBSignature250) \
150  (pcl::PPFSignature) \
151  (pcl::CPPFSignature) \
152  (pcl::PPFRGBSignature) \
153  (pcl::NormalBasedSignature12) \
154  (pcl::FPFHSignature33) \
155  (pcl::VFHSignature308) \
156  (pcl::GASDSignature512) \
157  (pcl::GASDSignature984) \
158  (pcl::GASDSignature7992) \
159  (pcl::GRSDSignature21) \
160  (pcl::ESFSignature640) \
161  (pcl::BRISKSignature512) \
162  (pcl::Narf36)
163 
164 namespace pcl
165 {
166 
167  using Array3fMap = Eigen::Map<Eigen::Array3f>;
168  using Array3fMapConst = const Eigen::Map<const Eigen::Array3f>;
169  using Array4fMap = Eigen::Map<Eigen::Array4f, Eigen::Aligned>;
170  using Array4fMapConst = const Eigen::Map<const Eigen::Array4f, Eigen::Aligned>;
171  using Vector3fMap = Eigen::Map<Eigen::Vector3f>;
172  using Vector3fMapConst = const Eigen::Map<const Eigen::Vector3f>;
173  using Vector4fMap = Eigen::Map<Eigen::Vector4f, Eigen::Aligned>;
174  using Vector4fMapConst = const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned>;
175 
176  using Vector3c = Eigen::Matrix<std::uint8_t, 3, 1>;
177  using Vector3cMap = Eigen::Map<Vector3c>;
178  using Vector3cMapConst = const Eigen::Map<const Vector3c>;
179  using Vector4c = Eigen::Matrix<std::uint8_t, 4, 1>;
180  using Vector4cMap = Eigen::Map<Vector4c, Eigen::Aligned>;
181  using Vector4cMapConst = const Eigen::Map<const Vector4c, Eigen::Aligned>;
182 
183 #define PCL_ADD_UNION_POINT4D \
184  union EIGEN_ALIGN16 { \
185  float data[4]; \
186  struct { \
187  float x; \
188  float y; \
189  float z; \
190  }; \
191  };
192 
193 #define PCL_ADD_EIGEN_MAPS_POINT4D \
194  inline pcl::Vector3fMap getVector3fMap () { return (pcl::Vector3fMap (data)); } \
195  inline pcl::Vector3fMapConst getVector3fMap () const { return (pcl::Vector3fMapConst (data)); } \
196  inline pcl::Vector4fMap getVector4fMap () { return (pcl::Vector4fMap (data)); } \
197  inline pcl::Vector4fMapConst getVector4fMap () const { return (pcl::Vector4fMapConst (data)); } \
198  inline pcl::Array3fMap getArray3fMap () { return (pcl::Array3fMap (data)); } \
199  inline pcl::Array3fMapConst getArray3fMap () const { return (pcl::Array3fMapConst (data)); } \
200  inline pcl::Array4fMap getArray4fMap () { return (pcl::Array4fMap (data)); } \
201  inline pcl::Array4fMapConst getArray4fMap () const { return (pcl::Array4fMapConst (data)); }
202 
203 #define PCL_ADD_POINT4D \
204  PCL_ADD_UNION_POINT4D \
205  PCL_ADD_EIGEN_MAPS_POINT4D
206 
207 #define PCL_ADD_UNION_NORMAL4D \
208  union EIGEN_ALIGN16 { \
209  float data_n[4]; \
210  float normal[3]; \
211  struct { \
212  float normal_x; \
213  float normal_y; \
214  float normal_z; \
215  }; \
216  };
217 
218 #define PCL_ADD_EIGEN_MAPS_NORMAL4D \
219  inline pcl::Vector3fMap getNormalVector3fMap () { return (pcl::Vector3fMap (data_n)); } \
220  inline pcl::Vector3fMapConst getNormalVector3fMap () const { return (pcl::Vector3fMapConst (data_n)); } \
221  inline pcl::Vector4fMap getNormalVector4fMap () { return (pcl::Vector4fMap (data_n)); } \
222  inline pcl::Vector4fMapConst getNormalVector4fMap () const { return (pcl::Vector4fMapConst (data_n)); }
223 
224 #define PCL_ADD_NORMAL4D \
225  PCL_ADD_UNION_NORMAL4D \
226  PCL_ADD_EIGEN_MAPS_NORMAL4D
227 
228 #define PCL_ADD_UNION_RGB \
229  union \
230  { \
231  union \
232  { \
233  struct \
234  { \
235  std::uint8_t b; \
236  std::uint8_t g; \
237  std::uint8_t r; \
238  std::uint8_t a; \
239  }; \
240  float rgb; \
241  }; \
242  std::uint32_t rgba; \
243  };
244 
245 #define PCL_ADD_EIGEN_MAPS_RGB \
246  inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); } \
247  inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); } \
248  inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, a)); } \
249  inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, a)); } \
250  inline Eigen::Vector4i getRGBAVector4i () { return (Eigen::Vector4i (r, g, b, a)); } \
251  inline const Eigen::Vector4i getRGBAVector4i () const { return (Eigen::Vector4i (r, g, b, a)); } \
252  inline pcl::Vector3cMap getBGRVector3cMap () { return (pcl::Vector3cMap (reinterpret_cast<std::uint8_t*> (&rgba))); } \
253  inline pcl::Vector3cMapConst getBGRVector3cMap () const { return (pcl::Vector3cMapConst (reinterpret_cast<const std::uint8_t*> (&rgba))); } \
254  inline pcl::Vector4cMap getBGRAVector4cMap () { return (pcl::Vector4cMap (reinterpret_cast<std::uint8_t*> (&rgba))); } \
255  inline pcl::Vector4cMapConst getBGRAVector4cMap () const { return (pcl::Vector4cMapConst (reinterpret_cast<const std::uint8_t*> (&rgba))); }
256 
257 #define PCL_ADD_RGB \
258  PCL_ADD_UNION_RGB \
259  PCL_ADD_EIGEN_MAPS_RGB
260 
261 #define PCL_ADD_INTENSITY \
262  struct \
263  { \
264  float intensity; \
265  }; \
266 
267 #define PCL_ADD_INTENSITY_8U \
268  struct \
269  { \
270  std::uint8_t intensity; \
271  }; \
272 
273 #define PCL_ADD_INTENSITY_32U \
274  struct \
275  { \
276  std::uint32_t intensity; \
277  }; \
278 
279 
280  struct _PointXYZ
281  {
282  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
283 
285  };
286 
287  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZ& p);
288  /** \brief A point structure representing Euclidean xyz coordinates. (SSE friendly)
289  * \ingroup common
290  */
291  struct EIGEN_ALIGN16 PointXYZ : public _PointXYZ
292  {
293  inline PointXYZ (const _PointXYZ &p)
294  {
295  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
296  }
297 
298  inline PointXYZ ()
299  {
300  x = y = z = 0.0f;
301  data[3] = 1.0f;
302  }
303 
304  inline PointXYZ (float _x, float _y, float _z)
305  {
306  x = _x; y = _y; z = _z;
307  data[3] = 1.0f;
308  }
309 
310  friend std::ostream& operator << (std::ostream& os, const PointXYZ& p);
312  };
313 
314 
315 #ifdef RGB
316 #undef RGB
317 #endif
318  struct _RGB
319  {
321  };
322 
323  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const RGB& p);
324  /** \brief A structure representing RGB color information.
325  *
326  * The RGBA information is available either as separate r, g, b, or as a
327  * packed std::uint32_t rgba value. To pack it, use:
328  *
329  * \code
330  * int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
331  * \endcode
332  *
333  * To unpack it use:
334  *
335  * \code
336  * int rgb = ...;
337  * std::uint8_t r = (rgb >> 16) & 0x0000ff;
338  * std::uint8_t g = (rgb >> 8) & 0x0000ff;
339  * std::uint8_t b = (rgb) & 0x0000ff;
340  * \endcode
341  *
342  */
343  struct RGB: public _RGB
344  {
345  inline RGB (const _RGB &p)
346  {
347  rgba = p.rgba;
348  }
349 
350  inline RGB ()
351  {
352  r = g = b = 0;
353  a = 255;
354  }
355 
356  inline RGB (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
357  {
358  r = _r;
359  g = _g;
360  b = _b;
361  a = 255;
362  }
363 
364  friend std::ostream& operator << (std::ostream& os, const RGB& p);
365  };
366 
367  struct _Intensity
368  {
370  };
371 
372  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity& p);
373  /** \brief A point structure representing the grayscale intensity in single-channel images.
374  * Intensity is represented as a float value.
375  * \ingroup common
376  */
377  struct Intensity: public _Intensity
378  {
379  inline Intensity (const _Intensity &p)
380  {
381  intensity = p.intensity;
382  }
383 
384  inline Intensity ()
385  {
386  intensity = 0.0f;
387  }
388 
389  friend std::ostream& operator << (std::ostream& os, const Intensity& p);
390  };
391 
392 
394  {
396  };
397 
398  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity8u& p);
399  /** \brief A point structure representing the grayscale intensity in single-channel images.
400  * Intensity is represented as a std::uint8_t value.
401  * \ingroup common
402  */
403  struct Intensity8u: public _Intensity8u
404  {
405  inline Intensity8u (const _Intensity8u &p)
406  {
407  intensity = p.intensity;
408  }
409 
410  inline Intensity8u ()
411  {
412  intensity = 0;
413  }
414 
415 #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 1101
416  operator unsigned char() const
417  {
418  return intensity;
419  }
420 #endif
421 
422  friend std::ostream& operator << (std::ostream& os, const Intensity8u& p);
423  };
424 
426  {
428  };
429 
430  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity32u& p);
431  /** \brief A point structure representing the grayscale intensity in single-channel images.
432  * Intensity is represented as a std::uint32_t value.
433  * \ingroup common
434  */
436  {
437  inline Intensity32u (const _Intensity32u &p)
438  {
439  intensity = p.intensity;
440  }
441 
442  inline Intensity32u ()
443  {
444  intensity = 0;
445  }
446 
447  friend std::ostream& operator << (std::ostream& os, const Intensity32u& p);
448  };
449 
450  /** \brief A point structure representing Euclidean xyz coordinates, and the intensity value.
451  * \ingroup common
452  */
453  struct EIGEN_ALIGN16 _PointXYZI
454  {
455  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
456  union
457  {
458  struct
459  {
460  float intensity;
461  };
462  float data_c[4];
463  };
465  };
466 
467  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZI& p);
468  struct PointXYZI : public _PointXYZI
469  {
470  inline PointXYZI (const _PointXYZI &p)
471  {
472  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
473  intensity = p.intensity;
474  }
475 
476  inline PointXYZI ()
477  {
478  x = y = z = 0.0f;
479  data[3] = 1.0f;
480  intensity = 0.0f;
481  }
482  inline PointXYZI (float _intensity)
483  {
484  x = y = z = 0.0f;
485  data[3] = 1.0f;
486  intensity = _intensity;
487  }
488  friend std::ostream& operator << (std::ostream& os, const PointXYZI& p);
489  };
490 
491 
492  struct EIGEN_ALIGN16 _PointXYZL
493  {
494  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
495  std::uint32_t label;
497  };
498 
499  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZL& p);
500  struct PointXYZL : public _PointXYZL
501  {
502  inline PointXYZL (const _PointXYZL &p)
503  {
504  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
505  label = p.label;
506  }
507 
508  inline PointXYZL ()
509  {
510  x = y = z = 0.0f;
511  data[3] = 1.0f;
512  label = 0;
513  }
514 
515  friend std::ostream& operator << (std::ostream& os, const PointXYZL& p);
516  };
517 
518 
519  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Label& p);
520  struct Label
521  {
522  std::uint32_t label;
523 
524  friend std::ostream& operator << (std::ostream& os, const Label& p);
525  };
526 
527 
528  struct EIGEN_ALIGN16 _PointXYZRGBA
529  {
530  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
533  };
534 
535  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
536  /** \brief A point structure representing Euclidean xyz coordinates, and the RGBA color.
537  *
538  * The RGBA information is available either as separate r, g, b, or as a
539  * packed std::uint32_t rgba value. To pack it, use:
540  *
541  * \code
542  * int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
543  * \endcode
544  *
545  * To unpack it use:
546  *
547  * \code
548  * int rgb = ...;
549  * std::uint8_t r = (rgb >> 16) & 0x0000ff;
550  * std::uint8_t g = (rgb >> 8) & 0x0000ff;
551  * std::uint8_t b = (rgb) & 0x0000ff;
552  * \endcode
553  *
554  * \ingroup common
555  */
556  struct EIGEN_ALIGN16 PointXYZRGBA : public _PointXYZRGBA
557  {
558  inline PointXYZRGBA (const _PointXYZRGBA &p)
559  {
560  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
561  rgba = p.rgba;
562  }
563 
564  inline PointXYZRGBA ()
565  {
566  x = y = z = 0.0f;
567  data[3] = 1.0f;
568  r = g = b = 0;
569  a = 255;
570  }
571 
572  friend std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
573  };
574 
575 
576  struct EIGEN_ALIGN16 _PointXYZRGB
577  {
578  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
581  };
582 
583  struct EIGEN_ALIGN16 _PointXYZRGBL
584  {
585  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
587  std::uint32_t label;
589  };
590 
591  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
592  /** \brief A point structure representing Euclidean xyz coordinates, and the RGB color.
593  *
594  * Due to historical reasons (PCL was first developed as a ROS package), the
595  * RGB information is packed into an integer and casted to a float. This is
596  * something we wish to remove in the near future, but in the meantime, the
597  * following code snippet should help you pack and unpack RGB colors in your
598  * PointXYZRGB structure:
599  *
600  * \code
601  * // pack r/g/b into rgb
602  * std::uint8_t r = 255, g = 0, b = 0; // Example: Red color
603  * std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
604  * p.rgb = *reinterpret_cast<float*>(&rgb);
605  * \endcode
606  *
607  * To unpack the data into separate values, use:
608  *
609  * \code
610  * PointXYZRGB p;
611  * // unpack rgb into r/g/b
612  * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
613  * std::uint8_t r = (rgb >> 16) & 0x0000ff;
614  * std::uint8_t g = (rgb >> 8) & 0x0000ff;
615  * std::uint8_t b = (rgb) & 0x0000ff;
616  * \endcode
617  *
618  *
619  * Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
620  *
621  * \ingroup common
622  */
623  struct EIGEN_ALIGN16 PointXYZRGB : public _PointXYZRGB
624  {
625  inline PointXYZRGB (const _PointXYZRGB &p)
626  {
627  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
628  rgb = p.rgb;
629  }
630 
631  inline PointXYZRGB ()
632  {
633  x = y = z = 0.0f;
634  data[3] = 1.0f;
635  r = g = b = 0;
636  a = 255;
637  }
638  inline PointXYZRGB (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
639  {
640  x = y = z = 0.0f;
641  data[3] = 1.0f;
642  r = _r;
643  g = _g;
644  b = _b;
645  a = 255;
646  }
647 
648  friend std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
650  };
651 
652 
653  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
654  struct EIGEN_ALIGN16 PointXYZRGBL : public _PointXYZRGBL
655  {
656  inline PointXYZRGBL (const _PointXYZRGBL &p)
657  {
658  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
659  rgba = p.rgba;
660  label = p.label;
661  }
662 
663  inline PointXYZRGBL ()
664  {
665  x = y = z = 0.0f;
666  data[3] = 1.0f;
667  r = g = b = 0;
668  a = 255;
669  label = 0;
670  }
671  inline PointXYZRGBL (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint32_t _label)
672  {
673  x = y = z = 0.0f;
674  data[3] = 1.0f;
675  r = _r;
676  g = _g;
677  b = _b;
678  a = 255;
679  label = _label;
680  }
681 
682  friend std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
684  };
685 
686 
687  struct EIGEN_ALIGN16 _PointXYZHSV
688  {
689  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
690  union
691  {
692  struct
693  {
694  float h;
695  float s;
696  float v;
697  };
698  float data_c[4];
699  };
701  };
702 
703  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
704  struct EIGEN_ALIGN16 PointXYZHSV : public _PointXYZHSV
705  {
706  inline PointXYZHSV (const _PointXYZHSV &p)
707  {
708  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
709  h = p.h; s = p.s; v = p.v;
710  }
711 
712  inline PointXYZHSV ()
713  {
714  x = y = z = 0.0f;
715  data[3] = 1.0f;
716  h = s = v = data_c[3] = 0;
717  }
718  inline PointXYZHSV (float _h, float _v, float _s)
719  {
720  x = y = z = 0.0f;
721  data[3] = 1.0f;
722  h = _h; v = _v; s = _s;
723  data_c[3] = 0;
724  }
725 
726  friend std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
728  };
729 
730 
731 
732  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXY& p);
733  /** \brief A 2D point structure representing Euclidean xy coordinates.
734  * \ingroup common
735  */
736  struct PointXY
737  {
738  float x;
739  float y;
740 
741  friend std::ostream& operator << (std::ostream& os, const PointXY& p);
742  };
743 
744  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointUV& p);
745  /** \brief A 2D point structure representing pixel image coordinates.
746  * \note We use float to be able to represent subpixels.
747  * \ingroup common
748  */
749  struct PointUV
750  {
751  float u;
752  float v;
753 
754  friend std::ostream& operator << (std::ostream& os, const PointUV& p);
755  };
756 
757  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const InterestPoint& p);
758  /** \brief A point structure representing an interest point with Euclidean xyz coordinates, and an interest value.
759  * \ingroup common
760  */
761  struct EIGEN_ALIGN16 InterestPoint
762  {
763  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
764  union
765  {
766  struct
767  {
768  float strength;
769  };
770  float data_c[4];
771  };
773 
774  friend std::ostream& operator << (std::ostream& os, const InterestPoint& p);
775  };
776 
777  struct EIGEN_ALIGN16 _Normal
778  {
779  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
780  union
781  {
782  struct
783  {
784  float curvature;
785  };
786  float data_c[4];
787  };
789  };
790 
791  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Normal& p);
792  /** \brief A point structure representing normal coordinates and the surface curvature estimate. (SSE friendly)
793  * \ingroup common
794  */
795  struct Normal : public _Normal
796  {
797  inline Normal (const _Normal &p)
798  {
799  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z;
800  data_n[3] = 0.0f;
801  curvature = p.curvature;
802  }
803 
804  inline Normal ()
805  {
806  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
807  curvature = 0;
808  }
809 
810  inline Normal (float n_x, float n_y, float n_z)
811  {
812  normal_x = n_x; normal_y = n_y; normal_z = n_z;
813  curvature = 0;
814  data_n[3] = 0.0f;
815  }
816 
817  friend std::ostream& operator << (std::ostream& os, const Normal& p);
819  };
820 
821 
822  struct EIGEN_ALIGN16 _Axis
823  {
826  };
827 
828  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Axis& p);
829  /** \brief A point structure representing an Axis using its normal coordinates. (SSE friendly)
830  * \ingroup common
831  */
832  struct EIGEN_ALIGN16 Axis : public _Axis
833  {
834  inline Axis (const _Axis &p)
835  {
836  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z;
837  data_n[3] = 0.0f;
838  }
839 
840  inline Axis ()
841  {
842  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
843  }
844 
845  inline Axis (float n_x, float n_y, float n_z)
846  {
847  normal_x = n_x; normal_y = n_y; normal_z = n_z;
848  data_n[3] = 0.0f;
849  }
850 
851  friend std::ostream& operator << (std::ostream& os, const Axis& p);
853  };
854 
855 
856  struct EIGEN_ALIGN16 _PointNormal
857  {
858  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
859  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
860  union
861  {
862  struct
863  {
864  float curvature;
865  };
866  float data_c[4];
867  };
869  };
870 
871  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointNormal& p);
872  /** \brief A point structure representing Euclidean xyz coordinates, together with normal coordinates and the surface curvature estimate. (SSE friendly)
873  * \ingroup common
874  */
875  struct PointNormal : public _PointNormal
876  {
877  inline PointNormal (const _PointNormal &p)
878  {
879  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
880  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
881  curvature = p.curvature;
882  }
883 
884  inline PointNormal ()
885  {
886  x = y = z = 0.0f;
887  data[3] = 1.0f;
888  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
889  curvature = 0.f;
890  }
891 
892  friend std::ostream& operator << (std::ostream& os, const PointNormal& p);
893  };
894 
895 
896  struct EIGEN_ALIGN16 _PointXYZRGBNormal
897  {
898  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
899  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
900  union
901  {
902  struct
903  {
905  float curvature;
906  };
907  float data_c[4];
908  };
911  };
912 
913  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
914  /** \brief A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coordinates and the surface curvature estimate.
915  * Due to historical reasons (PCL was first developed as a ROS package), the
916  * RGB information is packed into an integer and casted to a float. This is
917  * something we wish to remove in the near future, but in the meantime, the
918  * following code snippet should help you pack and unpack RGB colors in your
919  * PointXYZRGB structure:
920  *
921  * \code
922  * // pack r/g/b into rgb
923  * std::uint8_t r = 255, g = 0, b = 0; // Example: Red color
924  * std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
925  * p.rgb = *reinterpret_cast<float*>(&rgb);
926  * \endcode
927  *
928  * To unpack the data into separate values, use:
929  *
930  * \code
931  * PointXYZRGB p;
932  * // unpack rgb into r/g/b
933  * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
934  * std::uint8_t r = (rgb >> 16) & 0x0000ff;
935  * std::uint8_t g = (rgb >> 8) & 0x0000ff;
936  * std::uint8_t b = (rgb) & 0x0000ff;
937  * \endcode
938  *
939  *
940  * Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
941  * \ingroup common
942  */
944  {
946  {
947  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
948  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
949  curvature = p.curvature;
950  rgba = p.rgba;
951  }
952 
954  {
955  x = y = z = 0.0f;
956  data[3] = 1.0f;
957  r = g = b = 0;
958  a = 255;
959  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
960  curvature = 0;
961  }
962 
963  friend std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
964  };
965 
966  struct EIGEN_ALIGN16 _PointXYZINormal
967  {
968  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
969  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
970  union
971  {
972  struct
973  {
974  float intensity;
975  float curvature;
976  };
977  float data_c[4];
978  };
980  };
981 
982  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
983  /** \brief A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates and the surface curvature estimate.
984  * \ingroup common
985  */
987  {
989  {
990  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
991  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
992  curvature = p.curvature;
993  intensity = p.intensity;
994  }
995 
996  inline PointXYZINormal ()
997  {
998  x = y = z = 0.0f;
999  data[3] = 1.0f;
1000  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
1001  intensity = 0.0f;
1002  curvature = 0;
1003  }
1004 
1005  friend std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
1006  };
1007 
1008 //----
1009  struct EIGEN_ALIGN16 _PointXYZLNormal
1010  {
1011  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1012  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1013  union
1014  {
1015  struct
1016  {
1017  std::uint32_t label;
1018  float curvature;
1019  };
1020  float data_c[4];
1021  };
1023  };
1024 
1025  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
1026  /** \brief A point structure representing Euclidean xyz coordinates, a label, together with normal coordinates and the surface curvature estimate.
1027  * \ingroup common
1028  */
1030  {
1032  {
1033  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1034  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
1035  curvature = p.curvature;
1036  label = p.label;
1037  }
1038 
1040  {
1041  x = y = z = 0.0f;
1042  data[3] = 1.0f;
1043  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
1044  label = 0;
1045  curvature = 0;
1046  }
1047 
1048  friend std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
1049  };
1050 
1051 // ---
1052 
1053 
1054  struct EIGEN_ALIGN16 _PointWithRange
1055  {
1056  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1057  union
1058  {
1059  struct
1060  {
1061  float range;
1062  };
1063  float data_c[4];
1064  };
1066  };
1067 
1068  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1069  /** \brief A point structure representing Euclidean xyz coordinates, padded with an extra range float.
1070  * \ingroup common
1071  */
1073  {
1075  {
1076  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1077  range = p.range;
1078  }
1079 
1080  inline PointWithRange ()
1081  {
1082  x = y = z = 0.0f;
1083  data[3] = 1.0f;
1084  range = 0.0f;
1085  }
1086 
1087  friend std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1088  };
1089 
1090 
1091  struct EIGEN_ALIGN16 _PointWithViewpoint
1092  {
1093  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1094  union
1095  {
1096  struct
1097  {
1098  float vp_x;
1099  float vp_y;
1100  float vp_z;
1101  };
1102  float data_c[4];
1103  };
1105  };
1106 
1107  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1108  /** \brief A point structure representing Euclidean xyz coordinates together with the viewpoint from which it was seen.
1109  * \ingroup common
1110  */
1111  struct EIGEN_ALIGN16 PointWithViewpoint : public _PointWithViewpoint
1112  {
1114  {
1115  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1116  vp_x = p.vp_x; vp_y = p.vp_y; vp_z = p.vp_z;
1117  }
1118 
1119  inline PointWithViewpoint (float _x = 0.0f, float _y = 0.0f, float _z = 0.0f,
1120  float _vp_x = 0.0f, float _vp_y = 0.0f, float _vp_z = 0.0f)
1121  {
1122  x = _x; y = _y; z = _z;
1123  data[3] = 1.0f;
1124  vp_x = _vp_x; vp_y = _vp_y; vp_z = _vp_z;
1125  }
1126 
1127  friend std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1128  };
1129 
1130  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const MomentInvariants& p);
1131  /** \brief A point structure representing the three moment invariants.
1132  * \ingroup common
1133  */
1135  {
1136  float j1, j2, j3;
1137 
1138  friend std::ostream& operator << (std::ostream& os, const MomentInvariants& p);
1139  };
1140 
1141  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p);
1142  /** \brief A point structure representing the minimum and maximum surface radii (in meters) computed using RSD.
1143  * \ingroup common
1144  */
1146  {
1147  float r_min, r_max;
1148 
1149  friend std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p);
1150  };
1151 
1152  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Boundary& p);
1153  /** \brief A point structure representing a description of whether a point is lying on a surface boundary or not.
1154  * \ingroup common
1155  */
1156  struct Boundary
1157  {
1158  std::uint8_t boundary_point;
1159 
1160 #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 1101
1161  operator unsigned char() const
1162  {
1163  return boundary_point;
1164  }
1165 #endif
1166 
1167  friend std::ostream& operator << (std::ostream& os, const Boundary& p);
1168  };
1169 
1170  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p);
1171  /** \brief A point structure representing the principal curvatures and their magnitudes.
1172  * \ingroup common
1173  */
1175  {
1176  union
1177  {
1178  float principal_curvature[3];
1179  struct
1180  {
1184  };
1185  };
1186  float pc1;
1187  float pc2;
1188 
1189  friend std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p);
1190  };
1191 
1192  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
1193  /** \brief A point structure representing the Point Feature Histogram (PFH).
1194  * \ingroup common
1195  */
1197  {
1198  float histogram[125];
1199  static int descriptorSize () { return 125; }
1200 
1201  friend std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
1202  };
1203 
1204  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p);
1205  /** \brief A point structure representing the Point Feature Histogram with colors (PFHRGB).
1206  * \ingroup common
1207  */
1209  {
1210  float histogram[250];
1211  static int descriptorSize () { return 250; }
1212 
1213  friend std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p);
1214  };
1215 
1216  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PPFSignature& p);
1217  /** \brief A point structure for storing the Point Pair Feature (PPF) values
1218  * \ingroup common
1219  */
1221  {
1222  float f1, f2, f3, f4;
1223  float alpha_m;
1224 
1225  friend std::ostream& operator << (std::ostream& os, const PPFSignature& p);
1226  };
1227 
1228  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const CPPFSignature& p);
1229  /** \brief A point structure for storing the Point Pair Feature (CPPF) values
1230  * \ingroup common
1231  */
1233  {
1234  float f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
1235  float alpha_m;
1236 
1237  friend std::ostream& operator << (std::ostream& os, const CPPFSignature& p);
1238  };
1239 
1240  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p);
1241  /** \brief A point structure for storing the Point Pair Color Feature (PPFRGB) values
1242  * \ingroup common
1243  */
1245  {
1246  float f1, f2, f3, f4;
1247  float r_ratio, g_ratio, b_ratio;
1248  float alpha_m;
1249 
1250  friend std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p);
1251  };
1252 
1253  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p);
1254  /** \brief A point structure representing the Normal Based Signature for
1255  * a feature matrix of 4-by-3
1256  * \ingroup common
1257  */
1259  {
1260  float values[12];
1261 
1262  friend std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p);
1263  };
1264 
1265  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ShapeContext1980& p);
1266  /** \brief A point structure representing a Shape Context.
1267  * \ingroup common
1268  */
1270  {
1271  float descriptor[1980];
1272  float rf[9];
1273  static int descriptorSize () { return 1980; }
1274 
1275  friend std::ostream& operator << (std::ostream& os, const ShapeContext1980& p);
1276  };
1277 
1278  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const UniqueShapeContext1960& p);
1279  /** \brief A point structure representing a Unique Shape Context.
1280  * \ingroup common
1281  */
1283  {
1284  float descriptor[1960];
1285  float rf[9];
1286  static int descriptorSize () { return 1960; }
1287 
1288  friend std::ostream& operator << (std::ostream& os, const UniqueShapeContext1960& p);
1289  };
1290 
1291  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const SHOT352& p);
1292  /** \brief A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape only.
1293  * \ingroup common
1294  */
1295  struct SHOT352
1296  {
1297  float descriptor[352];
1298  float rf[9];
1299  static int descriptorSize () { return 352; }
1300 
1301  friend std::ostream& operator << (std::ostream& os, const SHOT352& p);
1302  };
1303 
1304 
1305  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const SHOT1344& p);
1306  /** \brief A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+color.
1307  * \ingroup common
1308  */
1309  struct SHOT1344
1310  {
1311  float descriptor[1344];
1312  float rf[9];
1313  static int descriptorSize () { return 1344; }
1314 
1315  friend std::ostream& operator << (std::ostream& os, const SHOT1344& p);
1316  };
1317 
1318 
1319  /** \brief A structure representing the Local Reference Frame of a point.
1320  * \ingroup common
1321  */
1322  struct EIGEN_ALIGN16 _ReferenceFrame
1323  {
1324  union
1325  {
1326  float rf[9];
1327  struct
1328  {
1329  float x_axis[3];
1330  float y_axis[3];
1331  float z_axis[3];
1332  };
1333  };
1334 
1335  inline Eigen::Map<Eigen::Vector3f> getXAxisVector3fMap () { return (Eigen::Vector3f::Map (x_axis)); }
1336  inline const Eigen::Map<const Eigen::Vector3f> getXAxisVector3fMap () const { return (Eigen::Vector3f::Map (x_axis)); }
1337  inline Eigen::Map<Eigen::Vector3f> getYAxisVector3fMap () { return (Eigen::Vector3f::Map (y_axis)); }
1338  inline const Eigen::Map<const Eigen::Vector3f> getYAxisVector3fMap () const { return (Eigen::Vector3f::Map (y_axis)); }
1339  inline Eigen::Map<Eigen::Vector3f> getZAxisVector3fMap () { return (Eigen::Vector3f::Map (z_axis)); }
1340  inline const Eigen::Map<const Eigen::Vector3f> getZAxisVector3fMap () const { return (Eigen::Vector3f::Map (z_axis)); }
1341  inline Eigen::Map<Eigen::Matrix3f> getMatrix3fMap () { return (Eigen::Matrix3f::Map (rf)); }
1342  inline const Eigen::Map<const Eigen::Matrix3f> getMatrix3fMap () const { return (Eigen::Matrix3f::Map (rf)); }
1343 
1345  };
1346 
1347  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ReferenceFrame& p);
1348  struct EIGEN_ALIGN16 ReferenceFrame : public _ReferenceFrame
1349  {
1351  {
1352  std::copy_n(p.rf, 9, rf);
1353  }
1354 
1355  inline ReferenceFrame ()
1356  {
1357  std::fill_n(x_axis, 3, 0);
1358  std::fill_n(y_axis, 3, 0);
1359  std::fill_n(z_axis, 3, 0);
1360  }
1361 
1362  friend std::ostream& operator << (std::ostream& os, const ReferenceFrame& p);
1364  };
1365 
1366 
1367  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const FPFHSignature33& p);
1368  /** \brief A point structure representing the Fast Point Feature Histogram (FPFH).
1369  * \ingroup common
1370  */
1372  {
1373  float histogram[33];
1374  static int descriptorSize () { return 33; }
1375 
1376  friend std::ostream& operator << (std::ostream& os, const FPFHSignature33& p);
1377  };
1378 
1379  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const VFHSignature308& p);
1380  /** \brief A point structure representing the Viewpoint Feature Histogram (VFH).
1381  * \ingroup common
1382  */
1384  {
1385  float histogram[308];
1386  static int descriptorSize () { return 308; }
1387 
1388  friend std::ostream& operator << (std::ostream& os, const VFHSignature308& p);
1389  };
1390 
1391  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GRSDSignature21& p);
1392  /** \brief A point structure representing the Global Radius-based Surface Descriptor (GRSD).
1393  * \ingroup common
1394  */
1396  {
1397  float histogram[21];
1398  static int descriptorSize () { return 21; }
1399 
1400  friend std::ostream& operator << (std::ostream& os, const GRSDSignature21& p);
1401  };
1402 
1403  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BRISKSignature512& p);
1404  /** \brief A point structure representing the Binary Robust Invariant Scalable Keypoints (BRISK).
1405  * \ingroup common
1406  */
1408  {
1409  float scale;
1411  unsigned char descriptor[64];
1412  static int descriptorSize () { return 64; }
1413 
1414  friend std::ostream& operator << (std::ostream& os, const BRISKSignature512& p);
1415  };
1416 
1417  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ESFSignature640& p);
1418  /** \brief A point structure representing the Ensemble of Shape Functions (ESF).
1419  * \ingroup common
1420  */
1422  {
1423  float histogram[640];
1424  static int descriptorSize () { return 640; }
1425 
1426  friend std::ostream& operator << (std::ostream& os, const ESFSignature640& p);
1427  };
1428 
1429  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature512& p);
1430  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape descriptor.
1431  * \ingroup common
1432  */
1434  {
1435  float histogram[512];
1436  static int descriptorSize() { return 512; }
1437 
1438  friend std::ostream& operator << (std::ostream& os, const GASDSignature512& p);
1439  };
1440 
1441  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature984& p);
1442  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descriptor.
1443  * \ingroup common
1444  */
1446  {
1447  float histogram[984];
1448  static int descriptorSize() { return 984; }
1449 
1450  friend std::ostream& operator << (std::ostream& os, const GASDSignature984& p);
1451  };
1452 
1453  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature7992& p);
1454  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descriptor.
1455  * \ingroup common
1456  */
1458  {
1459  float histogram[7992];
1460  static int descriptorSize() { return 7992; }
1461 
1462  friend std::ostream& operator << (std::ostream& os, const GASDSignature7992& p);
1463  };
1464 
1465  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p);
1466  /** \brief A point structure representing the GFPFH descriptor with 16 bins.
1467  * \ingroup common
1468  */
1470  {
1471  float histogram[16];
1472  static int descriptorSize () { return 16; }
1473 
1474  friend std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p);
1475  };
1476 
1477  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Narf36& p);
1478  /** \brief A point structure representing the Narf descriptor.
1479  * \ingroup common
1480  */
1481  struct Narf36
1482  {
1483  float x, y, z, roll, pitch, yaw;
1484  float descriptor[36];
1485  static int descriptorSize () { return 36; }
1486 
1487  friend std::ostream& operator << (std::ostream& os, const Narf36& p);
1488  };
1489 
1490  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1491  /** \brief A structure to store if a point in a range image lies on a border between an obstacle and the background.
1492  * \ingroup common
1493  */
1495  {
1496  int x, y;
1498  //std::vector<const BorderDescription*> neighbors;
1499 
1500  friend std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1501  };
1502 
1503 
1504  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1505  /** \brief A point structure representing the intensity gradient of an XYZI point cloud.
1506  * \ingroup common
1507  */
1509  {
1510  union
1511  {
1512  float gradient[3];
1513  struct
1514  {
1515  float gradient_x;
1516  float gradient_y;
1517  float gradient_z;
1518  };
1519  };
1520 
1521  friend std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1522  };
1523 
1524  /** \brief A point structure representing an N-D histogram.
1525  * \ingroup common
1526  */
1527  template <int N>
1528  struct Histogram
1529  {
1530  float histogram[N];
1531  static int descriptorSize () { return N; }
1532  };
1533 
1534  struct EIGEN_ALIGN16 _PointWithScale
1535  {
1536  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1537 
1538  union
1539  {
1540  /** \brief Diameter of the meaningful keypoint neighborhood. */
1541  float scale;
1542  float size;
1543  };
1544 
1545  /** \brief Computed orientation of the keypoint (-1 if not applicable). */
1546  float angle;
1547  /** \brief The response by which the most strong keypoints have been selected. */
1548  float response;
1549  /** \brief octave (pyramid layer) from which the keypoint has been extracted. */
1550  int octave;
1551 
1553  };
1554 
1555  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1556  /** \brief A point structure representing a 3-D position and scale.
1557  * \ingroup common
1558  */
1560  {
1562  {
1563  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1564  scale = p.scale;
1565  angle = p.angle;
1566  response = p.response;
1567  octave = p.octave;
1568  }
1569 
1570  inline PointWithScale ()
1571  {
1572  x = y = z = 0.0f;
1573  scale = 1.0f;
1574  angle = -1.0f;
1575  response = 0.0f;
1576  octave = 0;
1577  data[3] = 1.0f;
1578  }
1579 
1580  inline PointWithScale (float _x, float _y, float _z, float _scale)
1581  {
1582  x = _x;
1583  y = _y;
1584  z = _z;
1585  scale = _scale;
1586  angle = -1.0f;
1587  response = 0.0f;
1588  octave = 0;
1589  data[3] = 1.0f;
1590  }
1591 
1592  inline PointWithScale (float _x, float _y, float _z, float _scale, float _angle, float _response, int _octave)
1593  {
1594  x = _x;
1595  y = _y;
1596  z = _z;
1597  scale = _scale;
1598  angle = _angle;
1599  response = _response;
1600  octave = _octave;
1601  data[3] = 1.0f;
1602  }
1603 
1604  friend std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1605  };
1606 
1607 
1608  struct EIGEN_ALIGN16 _PointSurfel
1609  {
1610  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1611  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1612  union
1613  {
1614  struct
1615  {
1617  float radius;
1618  float confidence;
1619  float curvature;
1620  };
1621  float data_c[4];
1622  };
1625  };
1626 
1627  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1628  /** \brief A surfel, that is, a point structure representing Euclidean xyz coordinates, together with normal coordinates, a RGBA color, a radius, a confidence value and the surface curvature estimate.
1629  * \ingroup common
1630  */
1631  struct PointSurfel : public _PointSurfel
1632  {
1633  inline PointSurfel (const _PointSurfel &p)
1634  {
1635  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1636  rgba = p.rgba;
1637  radius = p.radius;
1638  confidence = p.confidence;
1639  curvature = p.curvature;
1640  }
1641 
1642  inline PointSurfel ()
1643  {
1644  x = y = z = 0.0f;
1645  data[3] = 1.0f;
1646  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
1647  r = g = b = 0;
1648  a = 255;
1649  radius = confidence = curvature = 0.0f;
1650  }
1651 
1652  friend std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1653  };
1654 
1655  struct EIGEN_ALIGN16 _PointDEM
1656  {
1658  float intensity;
1662  };
1663 
1664  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointDEM& p);
1665  /** \brief A point structure representing Digital Elevation Map.
1666  * \ingroup common
1667  */
1668  struct PointDEM : public _PointDEM
1669  {
1670  inline PointDEM (const _PointDEM &p)
1671  {
1672  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1673  intensity = p.intensity;
1674  intensity_variance = p.intensity_variance;
1675  height_variance = p.height_variance;
1676  }
1677 
1678  inline PointDEM ()
1679  {
1680  x = y = z = 0.0f; data[3] = 1.0f;
1681  intensity = 0.0f;
1682  intensity_variance = height_variance = 0.0f;
1683  }
1684 
1685  friend std::ostream& operator << (std::ostream& os, const PointDEM& p);
1686  };
1687 
1688  template <int N> std::ostream&
1689  operator << (std::ostream& os, const Histogram<N>& p)
1690  {
1691  // make constexpr
1692  if (N > 0)
1693  {
1694  os << "(" << p.histogram[0];
1695  std::for_each(p.histogram + 1, std::end(p.histogram),
1696  [&os](const auto& hist) { os << ", " << hist; });
1697  os << ")";
1698  }
1699  return (os);
1700  }
1701 } // End namespace
1702 
1703 #endif
PointXYZI(float _intensity)
A point structure representing normal coordinates and the surface curvature estimate.
Eigen::Map< Eigen::Vector3f > Vector3fMap
std::uint32_t label
A point structure representing the grayscale intensity in single-channel images.
A point structure representing a Shape Context.
Eigen::Map< Eigen::Vector3f > getXAxisVector3fMap()
std::bitset< 32 > BorderTraits
Data type to store extended information about a transition from foreground to backgroundSpecification...
Definition: point_types.h:311
Axis(const _Axis &p)
A point structure representing a description of whether a point is lying on a surface boundary or not...
A point structure representing Euclidean xyz coordinates, a label, together with normal coordinates a...
A point structure representing Euclidean xyz coordinates, padded with an extra range float...
float intensity_variance
PointDEM(const _PointDEM &p)
const Eigen::Map< const Eigen::Vector4f, Eigen::Aligned > Vector4fMapConst
static int descriptorSize()
const Eigen::Map< const Eigen::Vector3f > getXAxisVector3fMap() const
float scale
Diameter of the meaningful keypoint neighborhood.
A point structure representing the Normal Based Signature for a feature matrix of 4-by-3...
A point structure representing a Unique Shape Context.
PointWithScale(float _x, float _y, float _z, float _scale)
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
Eigen::Map< Eigen::Vector3f > getZAxisVector3fMap()
A structure representing the Local Reference Frame of a point.
float angle
Computed orientation of the keypoint (-1 if not applicable).
PointXYZRGBNormal(const _PointXYZRGBNormal &p)
static int descriptorSize()
A point structure representing Digital Elevation Map.
static int descriptorSize()
A point structure representing the Binary Robust Invariant Scalable Keypoints (BRISK).
PointXYZ(float _x, float _y, float _z)
PointXYZRGBA(const _PointXYZRGBA &p)
float response
The response by which the most strong keypoints have been selected.
Eigen::Map< Vector3c > Vector3cMap
static int descriptorSize()
PointWithScale(float _x, float _y, float _z, float _scale, float _angle, float _response, int _octave)
A point structure representing an Axis using its normal coordinates.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: pcl_macros.h:359
A point structure representing Euclidean xyz coordinates, and the RGBA color.
Intensity8u(const _Intensity8u &p)
A point structure representing the grayscale intensity in single-channel images.
std::ostream & operator<<(std::ostream &os, const BivariatePolynomialT< real > &p)
A point structure representing the Fast Point Feature Histogram (FPFH).
A 2D point structure representing Euclidean xy coordinates.
PointXYZ(const _PointXYZ &p)
A structure representing RGB color information.
A point structure representing an N-D histogram.
A 2D point structure representing pixel image coordinates.
A point structure representing the GFPFH descriptor with 16 bins.
const Eigen::Map< const Eigen::Matrix3f > getMatrix3fMap() const
A point structure representing the Point Feature Histogram with colors (PFHRGB).
A point structure representing Euclidean xyz coordinates, and the intensity value.
Eigen::Map< Eigen::Array3f > Array3fMap
static int descriptorSize()
PointXYZRGBL(const _PointXYZRGBL &p)
A point structure representing Euclidean xyz coordinates.
A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates...
const Eigen::Map< const Eigen::Vector3f > getYAxisVector3fMap() const
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descr...
static int descriptorSize()
A point structure representing an interest point with Euclidean xyz coordinates, and an interest valu...
PointXYZINormal(const _PointXYZINormal &p)
const Eigen::Map< const Vector4c, Eigen::Aligned > Vector4cMapConst
A point structure representing the three moment invariants.
PointXYZLNormal(const _PointXYZLNormal &p)
const Eigen::Map< const Eigen::Vector3f > Vector3fMapConst
Eigen::Map< Eigen::Vector3f > getYAxisVector3fMap()
PointXYZI(const _PointXYZI &p)
static int descriptorSize()
A point structure representing the grayscale intensity in single-channel images.
PointXYZHSV(const _PointXYZHSV &p)
static int descriptorSize()
Normal(float n_x, float n_y, float n_z)
std::uint8_t boundary_point
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape onl...
static int descriptorSize()
Axis(float n_x, float n_y, float n_z)
PointSurfel(const _PointSurfel &p)
static int descriptorSize()
int octave
octave (pyramid layer) from which the keypoint has been extracted.
A structure to store if a point in a range image lies on a border between an obstacle and the backgro...
ReferenceFrame(const _ReferenceFrame &p)
A point structure representing Euclidean xyz coordinates, together with normal coordinates and the su...
Eigen::Map< Eigen::Array4f, Eigen::Aligned > Array4fMap
const Eigen::Map< const Eigen::Array4f, Eigen::Aligned > Array4fMapConst
Intensity32u(const _Intensity32u &p)
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descr...
A point structure for storing the Point Pair Feature (CPPF) values.
A point structure representing Euclidean xyz coordinates together with the viewpoint from which it wa...
A point structure representing the intensity gradient of an XYZI point cloud.
const Eigen::Map< const Eigen::Vector3f > getZAxisVector3fMap() const
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+col...
static int descriptorSize()
PointXYZRGB(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
PointXYZRGB(const _PointXYZRGB &p)
RGB(const _RGB &p)
A point structure representing the Viewpoint Feature Histogram (VFH).
A point structure representing a 3-D position and scale.
A point structure representing the minimum and maximum surface radii (in meters) computed using RSD...
Eigen::Matrix< std::uint8_t, 4, 1 > Vector4c
A point structure representing the Narf descriptor.
const Eigen::Map< const Vector3c > Vector3cMapConst
A point structure representing Euclidean xyz coordinates, and the RGB color.
A point structure representing the principal curvatures and their magnitudes.
PointWithRange(const _PointWithRange &p)
Eigen::Map< Vector4c, Eigen::Aligned > Vector4cMap
PointWithScale(const _PointWithScale &p)
A point structure representing the Point Feature Histogram (PFH).
static int descriptorSize()
std::uint32_t label
PointWithViewpoint(const _PointWithViewpoint &p)
A point structure representing the Ensemble of Shape Functions (ESF).
static int descriptorSize()
const Eigen::Map< const Eigen::Array3f > Array3fMapConst
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape descriptor...
Intensity(const _Intensity &p)
std::uint32_t label
static int descriptorSize()
PointXYZHSV(float _h, float _v, float _s)
A point structure representing the Global Radius-based Surface Descriptor (GRSD). ...
PointXYZL(const _PointXYZL &p)
RGB(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
A surfel, that is, a point structure representing Euclidean xyz coordinates, together with normal coo...
Eigen::Map< Eigen::Vector4f, Eigen::Aligned > Vector4fMap
#define PCL_EXPORTS
Definition: pcl_macros.h:241
Eigen::Matrix< std::uint8_t, 3, 1 > Vector3c
PointNormal(const _PointNormal &p)
PointWithViewpoint(float _x=0.0f, float _y=0.0f, float _z=0.0f, float _vp_x=0.0f, float _vp_y=0.0f, float _vp_z=0.0f)
Defines all the PCL and non-PCL macros used.
static int descriptorSize()
A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coo...
A point structure for storing the Point Pair Feature (PPF) values.
PointXYZRGBL(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint32_t _label)
Normal(const _Normal &p)
Eigen::Map< Eigen::Matrix3f > getMatrix3fMap()
A point structure for storing the Point Pair Color Feature (PPFRGB) values.