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