Point Cloud Library (PCL)  1.10.0-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  inline PointXYZRGB(float _x, float _y, float _z)
649  {
650  x = _x;
651  y = _y;
652  z = _z;
653  data[3] = 1.0f;
654  r = g = b = 0;
655  a = 255;
656  }
657 
658  inline PointXYZRGB(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
659  {
660  x = _x;
661  y = _y;
662  z = _z;
663  data[3] = 1.0f;
664  r = _r;
665  g = _g;
666  b = _b;
667  a = 255;
668  }
669 
670  friend std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
672  };
673 
674 
675  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
676  struct EIGEN_ALIGN16 PointXYZRGBL : public _PointXYZRGBL
677  {
678  inline PointXYZRGBL (const _PointXYZRGBL &p)
679  {
680  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
681  rgba = p.rgba;
682  label = p.label;
683  }
684 
685  inline PointXYZRGBL ()
686  {
687  x = y = z = 0.0f;
688  data[3] = 1.0f;
689  r = g = b = 0;
690  a = 255;
691  label = 0;
692  }
693  inline PointXYZRGBL (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint32_t _label)
694  {
695  x = y = z = 0.0f;
696  data[3] = 1.0f;
697  r = _r;
698  g = _g;
699  b = _b;
700  a = 255;
701  label = _label;
702  }
703 
704  friend std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
706  };
707 
708 
709  struct EIGEN_ALIGN16 _PointXYZHSV
710  {
711  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
712  union
713  {
714  struct
715  {
716  float h;
717  float s;
718  float v;
719  };
720  float data_c[4];
721  };
723  };
724 
725  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
726  struct EIGEN_ALIGN16 PointXYZHSV : public _PointXYZHSV
727  {
728  inline PointXYZHSV (const _PointXYZHSV &p)
729  {
730  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
731  h = p.h; s = p.s; v = p.v;
732  }
733 
734  inline PointXYZHSV ()
735  {
736  x = y = z = 0.0f;
737  data[3] = 1.0f;
738  h = s = v = data_c[3] = 0;
739  }
740  inline PointXYZHSV (float _h, float _v, float _s)
741  {
742  x = y = z = 0.0f;
743  data[3] = 1.0f;
744  h = _h; v = _v; s = _s;
745  data_c[3] = 0;
746  }
747 
748  friend std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
750  };
751 
752 
753 
754  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXY& p);
755  /** \brief A 2D point structure representing Euclidean xy coordinates.
756  * \ingroup common
757  */
758  struct PointXY
759  {
760  float x;
761  float y;
762 
763  friend std::ostream& operator << (std::ostream& os, const PointXY& p);
764  };
765 
766  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointUV& p);
767  /** \brief A 2D point structure representing pixel image coordinates.
768  * \note We use float to be able to represent subpixels.
769  * \ingroup common
770  */
771  struct PointUV
772  {
773  float u;
774  float v;
775 
776  friend std::ostream& operator << (std::ostream& os, const PointUV& p);
777  };
778 
779  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const InterestPoint& p);
780  /** \brief A point structure representing an interest point with Euclidean xyz coordinates, and an interest value.
781  * \ingroup common
782  */
783  struct EIGEN_ALIGN16 InterestPoint
784  {
785  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
786  union
787  {
788  struct
789  {
790  float strength;
791  };
792  float data_c[4];
793  };
795 
796  friend std::ostream& operator << (std::ostream& os, const InterestPoint& p);
797  };
798 
799  struct EIGEN_ALIGN16 _Normal
800  {
801  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
802  union
803  {
804  struct
805  {
806  float curvature;
807  };
808  float data_c[4];
809  };
811  };
812 
813  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Normal& p);
814  /** \brief A point structure representing normal coordinates and the surface curvature estimate. (SSE friendly)
815  * \ingroup common
816  */
817  struct Normal : public _Normal
818  {
819  inline Normal (const _Normal &p)
820  {
821  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z;
822  data_n[3] = 0.0f;
823  curvature = p.curvature;
824  }
825 
826  inline Normal ()
827  {
828  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
829  curvature = 0;
830  }
831 
832  inline Normal (float n_x, float n_y, float n_z)
833  {
834  normal_x = n_x; normal_y = n_y; normal_z = n_z;
835  curvature = 0;
836  data_n[3] = 0.0f;
837  }
838 
839  friend std::ostream& operator << (std::ostream& os, const Normal& p);
841  };
842 
843 
844  struct EIGEN_ALIGN16 _Axis
845  {
848  };
849 
850  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Axis& p);
851  /** \brief A point structure representing an Axis using its normal coordinates. (SSE friendly)
852  * \ingroup common
853  */
854  struct EIGEN_ALIGN16 Axis : public _Axis
855  {
856  inline Axis (const _Axis &p)
857  {
858  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z;
859  data_n[3] = 0.0f;
860  }
861 
862  inline Axis ()
863  {
864  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
865  }
866 
867  inline Axis (float n_x, float n_y, float n_z)
868  {
869  normal_x = n_x; normal_y = n_y; normal_z = n_z;
870  data_n[3] = 0.0f;
871  }
872 
873  friend std::ostream& operator << (std::ostream& os, const Axis& p);
875  };
876 
877 
878  struct EIGEN_ALIGN16 _PointNormal
879  {
880  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
881  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
882  union
883  {
884  struct
885  {
886  float curvature;
887  };
888  float data_c[4];
889  };
891  };
892 
893  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointNormal& p);
894  /** \brief A point structure representing Euclidean xyz coordinates, together with normal coordinates and the surface curvature estimate. (SSE friendly)
895  * \ingroup common
896  */
897  struct PointNormal : public _PointNormal
898  {
899  inline PointNormal (const _PointNormal &p)
900  {
901  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
902  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
903  curvature = p.curvature;
904  }
905 
906  inline PointNormal ()
907  {
908  x = y = z = 0.0f;
909  data[3] = 1.0f;
910  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
911  curvature = 0.f;
912  }
913 
914  friend std::ostream& operator << (std::ostream& os, const PointNormal& p);
915  };
916 
917 
918  struct EIGEN_ALIGN16 _PointXYZRGBNormal
919  {
920  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
921  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
922  union
923  {
924  struct
925  {
927  float curvature;
928  };
929  float data_c[4];
930  };
933  };
934 
935  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
936  /** \brief A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coordinates and the surface curvature estimate.
937  * Due to historical reasons (PCL was first developed as a ROS package), the
938  * RGB information is packed into an integer and casted to a float. This is
939  * something we wish to remove in the near future, but in the meantime, the
940  * following code snippet should help you pack and unpack RGB colors in your
941  * PointXYZRGB structure:
942  *
943  * \code
944  * // pack r/g/b into rgb
945  * std::uint8_t r = 255, g = 0, b = 0; // Example: Red color
946  * std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
947  * p.rgb = *reinterpret_cast<float*>(&rgb);
948  * \endcode
949  *
950  * To unpack the data into separate values, use:
951  *
952  * \code
953  * PointXYZRGB p;
954  * // unpack rgb into r/g/b
955  * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
956  * std::uint8_t r = (rgb >> 16) & 0x0000ff;
957  * std::uint8_t g = (rgb >> 8) & 0x0000ff;
958  * std::uint8_t b = (rgb) & 0x0000ff;
959  * \endcode
960  *
961  *
962  * Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
963  * \ingroup common
964  */
966  {
968  {
969  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
970  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
971  curvature = p.curvature;
972  rgba = p.rgba;
973  }
974 
976  {
977  x = y = z = 0.0f;
978  data[3] = 1.0f;
979  r = g = b = 0;
980  a = 255;
981  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
982  curvature = 0;
983  }
984 
985  friend std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
986  };
987 
988  struct EIGEN_ALIGN16 _PointXYZINormal
989  {
990  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
991  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
992  union
993  {
994  struct
995  {
996  float intensity;
997  float curvature;
998  };
999  float data_c[4];
1000  };
1002  };
1003 
1004  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
1005  /** \brief A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates and the surface curvature estimate.
1006  * \ingroup common
1007  */
1009  {
1011  {
1012  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1013  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
1014  curvature = p.curvature;
1015  intensity = p.intensity;
1016  }
1017 
1019  {
1020  x = y = z = 0.0f;
1021  data[3] = 1.0f;
1022  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
1023  intensity = 0.0f;
1024  curvature = 0;
1025  }
1026 
1027  friend std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
1028  };
1029 
1030 //----
1031  struct EIGEN_ALIGN16 _PointXYZLNormal
1032  {
1033  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1034  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1035  union
1036  {
1037  struct
1038  {
1039  std::uint32_t label;
1040  float curvature;
1041  };
1042  float data_c[4];
1043  };
1045  };
1046 
1047  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
1048  /** \brief A point structure representing Euclidean xyz coordinates, a label, together with normal coordinates and the surface curvature estimate.
1049  * \ingroup common
1050  */
1052  {
1054  {
1055  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1056  normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
1057  curvature = p.curvature;
1058  label = p.label;
1059  }
1060 
1062  {
1063  x = y = z = 0.0f;
1064  data[3] = 1.0f;
1065  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
1066  label = 0;
1067  curvature = 0;
1068  }
1069 
1070  friend std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
1071  };
1072 
1073 // ---
1074 
1075 
1076  struct EIGEN_ALIGN16 _PointWithRange
1077  {
1078  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1079  union
1080  {
1081  struct
1082  {
1083  float range;
1084  };
1085  float data_c[4];
1086  };
1088  };
1089 
1090  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1091  /** \brief A point structure representing Euclidean xyz coordinates, padded with an extra range float.
1092  * \ingroup common
1093  */
1095  {
1097  {
1098  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1099  range = p.range;
1100  }
1101 
1102  inline PointWithRange ()
1103  {
1104  x = y = z = 0.0f;
1105  data[3] = 1.0f;
1106  range = 0.0f;
1107  }
1108 
1109  friend std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1110  };
1111 
1112 
1113  struct EIGEN_ALIGN16 _PointWithViewpoint
1114  {
1115  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1116  union
1117  {
1118  struct
1119  {
1120  float vp_x;
1121  float vp_y;
1122  float vp_z;
1123  };
1124  float data_c[4];
1125  };
1127  };
1128 
1129  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1130  /** \brief A point structure representing Euclidean xyz coordinates together with the viewpoint from which it was seen.
1131  * \ingroup common
1132  */
1133  struct EIGEN_ALIGN16 PointWithViewpoint : public _PointWithViewpoint
1134  {
1136  {
1137  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1138  vp_x = p.vp_x; vp_y = p.vp_y; vp_z = p.vp_z;
1139  }
1140 
1141  inline PointWithViewpoint (float _x = 0.0f, float _y = 0.0f, float _z = 0.0f,
1142  float _vp_x = 0.0f, float _vp_y = 0.0f, float _vp_z = 0.0f)
1143  {
1144  x = _x; y = _y; z = _z;
1145  data[3] = 1.0f;
1146  vp_x = _vp_x; vp_y = _vp_y; vp_z = _vp_z;
1147  }
1148 
1149  friend std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1150  };
1151 
1152  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const MomentInvariants& p);
1153  /** \brief A point structure representing the three moment invariants.
1154  * \ingroup common
1155  */
1157  {
1158  float j1, j2, j3;
1159 
1160  friend std::ostream& operator << (std::ostream& os, const MomentInvariants& p);
1161  };
1162 
1163  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p);
1164  /** \brief A point structure representing the minimum and maximum surface radii (in meters) computed using RSD.
1165  * \ingroup common
1166  */
1168  {
1169  float r_min, r_max;
1170 
1171  friend std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p);
1172  };
1173 
1174  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Boundary& p);
1175  /** \brief A point structure representing a description of whether a point is lying on a surface boundary or not.
1176  * \ingroup common
1177  */
1178  struct Boundary
1179  {
1180  std::uint8_t boundary_point;
1181 
1182 #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 1101
1183  operator unsigned char() const
1184  {
1185  return boundary_point;
1186  }
1187 #endif
1188 
1189  friend std::ostream& operator << (std::ostream& os, const Boundary& p);
1190  };
1191 
1192  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p);
1193  /** \brief A point structure representing the principal curvatures and their magnitudes.
1194  * \ingroup common
1195  */
1197  {
1198  union
1199  {
1200  float principal_curvature[3];
1201  struct
1202  {
1206  };
1207  };
1208  float pc1;
1209  float pc2;
1210 
1211  friend std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p);
1212  };
1213 
1214  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
1215  /** \brief A point structure representing the Point Feature Histogram (PFH).
1216  * \ingroup common
1217  */
1219  {
1220  float histogram[125];
1221  static int descriptorSize () { return 125; }
1222 
1223  friend std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
1224  };
1225 
1226  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p);
1227  /** \brief A point structure representing the Point Feature Histogram with colors (PFHRGB).
1228  * \ingroup common
1229  */
1231  {
1232  float histogram[250];
1233  static int descriptorSize () { return 250; }
1234 
1235  friend std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p);
1236  };
1237 
1238  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PPFSignature& p);
1239  /** \brief A point structure for storing the Point Pair Feature (PPF) values
1240  * \ingroup common
1241  */
1243  {
1244  float f1, f2, f3, f4;
1245  float alpha_m;
1246 
1247  friend std::ostream& operator << (std::ostream& os, const PPFSignature& p);
1248  };
1249 
1250  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const CPPFSignature& p);
1251  /** \brief A point structure for storing the Point Pair Feature (CPPF) values
1252  * \ingroup common
1253  */
1255  {
1256  float f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
1257  float alpha_m;
1258 
1259  friend std::ostream& operator << (std::ostream& os, const CPPFSignature& p);
1260  };
1261 
1262  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p);
1263  /** \brief A point structure for storing the Point Pair Color Feature (PPFRGB) values
1264  * \ingroup common
1265  */
1267  {
1268  float f1, f2, f3, f4;
1269  float r_ratio, g_ratio, b_ratio;
1270  float alpha_m;
1271 
1272  friend std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p);
1273  };
1274 
1275  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p);
1276  /** \brief A point structure representing the Normal Based Signature for
1277  * a feature matrix of 4-by-3
1278  * \ingroup common
1279  */
1281  {
1282  float values[12];
1283 
1284  friend std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p);
1285  };
1286 
1287  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ShapeContext1980& p);
1288  /** \brief A point structure representing a Shape Context.
1289  * \ingroup common
1290  */
1292  {
1293  float descriptor[1980];
1294  float rf[9];
1295  static int descriptorSize () { return 1980; }
1296 
1297  friend std::ostream& operator << (std::ostream& os, const ShapeContext1980& p);
1298  };
1299 
1300  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const UniqueShapeContext1960& p);
1301  /** \brief A point structure representing a Unique Shape Context.
1302  * \ingroup common
1303  */
1305  {
1306  float descriptor[1960];
1307  float rf[9];
1308  static int descriptorSize () { return 1960; }
1309 
1310  friend std::ostream& operator << (std::ostream& os, const UniqueShapeContext1960& p);
1311  };
1312 
1313  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const SHOT352& p);
1314  /** \brief A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape only.
1315  * \ingroup common
1316  */
1317  struct SHOT352
1318  {
1319  float descriptor[352];
1320  float rf[9];
1321  static int descriptorSize () { return 352; }
1322 
1323  friend std::ostream& operator << (std::ostream& os, const SHOT352& p);
1324  };
1325 
1326 
1327  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const SHOT1344& p);
1328  /** \brief A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+color.
1329  * \ingroup common
1330  */
1331  struct SHOT1344
1332  {
1333  float descriptor[1344];
1334  float rf[9];
1335  static int descriptorSize () { return 1344; }
1336 
1337  friend std::ostream& operator << (std::ostream& os, const SHOT1344& p);
1338  };
1339 
1340 
1341  /** \brief A structure representing the Local Reference Frame of a point.
1342  * \ingroup common
1343  */
1344  struct EIGEN_ALIGN16 _ReferenceFrame
1345  {
1346  union
1347  {
1348  float rf[9];
1349  struct
1350  {
1351  float x_axis[3];
1352  float y_axis[3];
1353  float z_axis[3];
1354  };
1355  };
1356 
1357  inline Eigen::Map<Eigen::Vector3f> getXAxisVector3fMap () { return (Eigen::Vector3f::Map (x_axis)); }
1358  inline const Eigen::Map<const Eigen::Vector3f> getXAxisVector3fMap () const { return (Eigen::Vector3f::Map (x_axis)); }
1359  inline Eigen::Map<Eigen::Vector3f> getYAxisVector3fMap () { return (Eigen::Vector3f::Map (y_axis)); }
1360  inline const Eigen::Map<const Eigen::Vector3f> getYAxisVector3fMap () const { return (Eigen::Vector3f::Map (y_axis)); }
1361  inline Eigen::Map<Eigen::Vector3f> getZAxisVector3fMap () { return (Eigen::Vector3f::Map (z_axis)); }
1362  inline const Eigen::Map<const Eigen::Vector3f> getZAxisVector3fMap () const { return (Eigen::Vector3f::Map (z_axis)); }
1363  inline Eigen::Map<Eigen::Matrix3f> getMatrix3fMap () { return (Eigen::Matrix3f::Map (rf)); }
1364  inline const Eigen::Map<const Eigen::Matrix3f> getMatrix3fMap () const { return (Eigen::Matrix3f::Map (rf)); }
1365 
1367  };
1368 
1369  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ReferenceFrame& p);
1370  struct EIGEN_ALIGN16 ReferenceFrame : public _ReferenceFrame
1371  {
1373  {
1374  std::copy_n(p.rf, 9, rf);
1375  }
1376 
1377  inline ReferenceFrame ()
1378  {
1379  std::fill_n(x_axis, 3, 0);
1380  std::fill_n(y_axis, 3, 0);
1381  std::fill_n(z_axis, 3, 0);
1382  }
1383 
1384  friend std::ostream& operator << (std::ostream& os, const ReferenceFrame& p);
1386  };
1387 
1388 
1389  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const FPFHSignature33& p);
1390  /** \brief A point structure representing the Fast Point Feature Histogram (FPFH).
1391  * \ingroup common
1392  */
1394  {
1395  float histogram[33];
1396  static int descriptorSize () { return 33; }
1397 
1398  friend std::ostream& operator << (std::ostream& os, const FPFHSignature33& p);
1399  };
1400 
1401  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const VFHSignature308& p);
1402  /** \brief A point structure representing the Viewpoint Feature Histogram (VFH).
1403  * \ingroup common
1404  */
1406  {
1407  float histogram[308];
1408  static int descriptorSize () { return 308; }
1409 
1410  friend std::ostream& operator << (std::ostream& os, const VFHSignature308& p);
1411  };
1412 
1413  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GRSDSignature21& p);
1414  /** \brief A point structure representing the Global Radius-based Surface Descriptor (GRSD).
1415  * \ingroup common
1416  */
1418  {
1419  float histogram[21];
1420  static int descriptorSize () { return 21; }
1421 
1422  friend std::ostream& operator << (std::ostream& os, const GRSDSignature21& p);
1423  };
1424 
1425  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BRISKSignature512& p);
1426  /** \brief A point structure representing the Binary Robust Invariant Scalable Keypoints (BRISK).
1427  * \ingroup common
1428  */
1430  {
1431  float scale;
1433  unsigned char descriptor[64];
1434  static int descriptorSize () { return 64; }
1435 
1436  friend std::ostream& operator << (std::ostream& os, const BRISKSignature512& p);
1437  };
1438 
1439  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ESFSignature640& p);
1440  /** \brief A point structure representing the Ensemble of Shape Functions (ESF).
1441  * \ingroup common
1442  */
1444  {
1445  float histogram[640];
1446  static int descriptorSize () { return 640; }
1447 
1448  friend std::ostream& operator << (std::ostream& os, const ESFSignature640& p);
1449  };
1450 
1451  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature512& p);
1452  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape descriptor.
1453  * \ingroup common
1454  */
1456  {
1457  float histogram[512];
1458  static int descriptorSize() { return 512; }
1459 
1460  friend std::ostream& operator << (std::ostream& os, const GASDSignature512& p);
1461  };
1462 
1463  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature984& p);
1464  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descriptor.
1465  * \ingroup common
1466  */
1468  {
1469  float histogram[984];
1470  static int descriptorSize() { return 984; }
1471 
1472  friend std::ostream& operator << (std::ostream& os, const GASDSignature984& p);
1473  };
1474 
1475  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature7992& p);
1476  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descriptor.
1477  * \ingroup common
1478  */
1480  {
1481  float histogram[7992];
1482  static int descriptorSize() { return 7992; }
1483 
1484  friend std::ostream& operator << (std::ostream& os, const GASDSignature7992& p);
1485  };
1486 
1487  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p);
1488  /** \brief A point structure representing the GFPFH descriptor with 16 bins.
1489  * \ingroup common
1490  */
1492  {
1493  float histogram[16];
1494  static int descriptorSize () { return 16; }
1495 
1496  friend std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p);
1497  };
1498 
1499  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Narf36& p);
1500  /** \brief A point structure representing the Narf descriptor.
1501  * \ingroup common
1502  */
1503  struct Narf36
1504  {
1505  float x, y, z, roll, pitch, yaw;
1506  float descriptor[36];
1507  static int descriptorSize () { return 36; }
1508 
1509  friend std::ostream& operator << (std::ostream& os, const Narf36& p);
1510  };
1511 
1512  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1513  /** \brief A structure to store if a point in a range image lies on a border between an obstacle and the background.
1514  * \ingroup common
1515  */
1517  {
1518  int x, y;
1520  //std::vector<const BorderDescription*> neighbors;
1521 
1522  friend std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1523  };
1524 
1525 
1526  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1527  /** \brief A point structure representing the intensity gradient of an XYZI point cloud.
1528  * \ingroup common
1529  */
1531  {
1532  union
1533  {
1534  float gradient[3];
1535  struct
1536  {
1537  float gradient_x;
1538  float gradient_y;
1539  float gradient_z;
1540  };
1541  };
1542 
1543  friend std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1544  };
1545 
1546  /** \brief A point structure representing an N-D histogram.
1547  * \ingroup common
1548  */
1549  template <int N>
1550  struct Histogram
1551  {
1552  float histogram[N];
1553  static int descriptorSize () { return N; }
1554  };
1555 
1556  struct EIGEN_ALIGN16 _PointWithScale
1557  {
1558  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1559 
1560  union
1561  {
1562  /** \brief Diameter of the meaningful keypoint neighborhood. */
1563  float scale;
1564  float size;
1565  };
1566 
1567  /** \brief Computed orientation of the keypoint (-1 if not applicable). */
1568  float angle;
1569  /** \brief The response by which the most strong keypoints have been selected. */
1570  float response;
1571  /** \brief octave (pyramid layer) from which the keypoint has been extracted. */
1572  int octave;
1573 
1575  };
1576 
1577  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1578  /** \brief A point structure representing a 3-D position and scale.
1579  * \ingroup common
1580  */
1582  {
1584  {
1585  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1586  scale = p.scale;
1587  angle = p.angle;
1588  response = p.response;
1589  octave = p.octave;
1590  }
1591 
1592  inline PointWithScale ()
1593  {
1594  x = y = z = 0.0f;
1595  scale = 1.0f;
1596  angle = -1.0f;
1597  response = 0.0f;
1598  octave = 0;
1599  data[3] = 1.0f;
1600  }
1601 
1602  inline PointWithScale (float _x, float _y, float _z, float _scale)
1603  {
1604  x = _x;
1605  y = _y;
1606  z = _z;
1607  scale = _scale;
1608  angle = -1.0f;
1609  response = 0.0f;
1610  octave = 0;
1611  data[3] = 1.0f;
1612  }
1613 
1614  inline PointWithScale (float _x, float _y, float _z, float _scale, float _angle, float _response, int _octave)
1615  {
1616  x = _x;
1617  y = _y;
1618  z = _z;
1619  scale = _scale;
1620  angle = _angle;
1621  response = _response;
1622  octave = _octave;
1623  data[3] = 1.0f;
1624  }
1625 
1626  friend std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1627  };
1628 
1629 
1630  struct EIGEN_ALIGN16 _PointSurfel
1631  {
1632  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1633  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1634  union
1635  {
1636  struct
1637  {
1639  float radius;
1640  float confidence;
1641  float curvature;
1642  };
1643  float data_c[4];
1644  };
1647  };
1648 
1649  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1650  /** \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.
1651  * \ingroup common
1652  */
1653  struct PointSurfel : public _PointSurfel
1654  {
1655  inline PointSurfel (const _PointSurfel &p)
1656  {
1657  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1658  rgba = p.rgba;
1659  radius = p.radius;
1660  confidence = p.confidence;
1661  curvature = p.curvature;
1662  }
1663 
1664  inline PointSurfel ()
1665  {
1666  x = y = z = 0.0f;
1667  data[3] = 1.0f;
1668  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
1669  r = g = b = 0;
1670  a = 255;
1671  radius = confidence = curvature = 0.0f;
1672  }
1673 
1674  friend std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1675  };
1676 
1677  struct EIGEN_ALIGN16 _PointDEM
1678  {
1680  float intensity;
1684  };
1685 
1686  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointDEM& p);
1687  /** \brief A point structure representing Digital Elevation Map.
1688  * \ingroup common
1689  */
1690  struct PointDEM : public _PointDEM
1691  {
1692  inline PointDEM (const _PointDEM &p)
1693  {
1694  x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1695  intensity = p.intensity;
1696  intensity_variance = p.intensity_variance;
1697  height_variance = p.height_variance;
1698  }
1699 
1700  inline PointDEM ()
1701  {
1702  x = y = z = 0.0f; data[3] = 1.0f;
1703  intensity = 0.0f;
1704  intensity_variance = height_variance = 0.0f;
1705  }
1706 
1707  friend std::ostream& operator << (std::ostream& os, const PointDEM& p);
1708  };
1709 
1710  template <int N> std::ostream&
1711  operator << (std::ostream& os, const Histogram<N>& p)
1712  {
1713  // make constexpr
1714  if (N > 0)
1715  {
1716  os << "(" << p.histogram[0];
1717  std::for_each(p.histogram + 1, std::end(p.histogram),
1718  [&os](const auto& hist) { os << ", " << hist; });
1719  os << ")";
1720  }
1721  return (os);
1722  }
1723 } // End namespace
1724 
1725 #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
PointXYZRGB(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
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:371
PointXYZRGB(float _x, float _y, float _z)
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:253
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.