Point Cloud Library (PCL)  1.7.2
point_types.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2011, Willow Garage, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the copyright holder(s) nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * $Id$
37  *
38  */
39 #ifndef PCL_DATA_TYPES_H_
40 #define PCL_DATA_TYPES_H_
41 
42 #include <pcl/pcl_macros.h>
43 #include <bitset>
44 #include <pcl/register_point_struct.h>
45 #include <boost/mpl/contains.hpp>
46 #include <boost/mpl/fold.hpp>
47 #include <boost/mpl/vector.hpp>
48 
49 /**
50  * \file pcl/point_types.h
51  * Defines all the PCL implemented PointT point type structures
52  * \ingroup common
53  */
54 
55 // We're doing a lot of black magic with Boost here, so disable warnings in Maintainer mode, as we will never
56 // be able to fix them anyway
57 #if defined _MSC_VER
58  #pragma warning(disable: 4201)
59 #endif
60 //#pragma warning(push, 1)
61 #if defined __GNUC__
62 # pragma GCC system_header
63 #endif
64 
65 /** @{*/
66 namespace pcl
67 {
68  /** \brief Members: float x, y, z
69  * \ingroup common
70  */
71  struct PointXYZ;
72 
73  /** \brief Members: rgba
74  * \ingroup common
75  */
76  struct RGB;
77 
78  /** \brief Members: intensity (float)
79  * \ingroup common
80  */
81  struct Intensity;
82 
83  /** \brief Members: intensity (uint8_t)
84  * \ingroup common
85  */
86  struct Intensity8u;
87 
88  /** \brief Members: intensity (uint32_t)
89  * \ingroup common
90  */
91  struct Intensity32u;
92 
93  /** \brief Members: float x, y, z, intensity
94  * \ingroup common
95  */
96  struct PointXYZI;
97 
98  /** \brief Members: float x, y, z, uin32_t label
99  * \ingroup common
100  */
101  struct PointXYZL;
102 
103  /** \brief Members: uint32_t label
104  * \ingroup common
105  */
106  struct Label;
107 
108  /** \brief Members: float x, y, z; uint32_t rgba
109  * \ingroup common
110  */
111  struct PointXYZRGBA;
112 
113  /** \brief Members: float x, y, z, rgb
114  * \ingroup common
115  */
116  struct PointXYZRGB;
117 
118  /** \brief Members: float x, y, z, rgb, uint32_t label
119  * \ingroup common
120  */
121  struct PointXYZRGBL;
122 
123  /** \brief Members: float x, y, z, h, s, v
124  * \ingroup common
125  */
126  struct PointXYZHSV;
127 
128  /** \brief Members: float x, y
129  * \ingroup common
130  */
131  struct PointXY;
132 
133  /** \brief Members: float u, v
134  * \ingroup common
135  */
136  struct PointUV;
137 
138  /** \brief Members: float x, y, z, strength
139  * \ingroup common
140  */
141  struct InterestPoint;
142 
143  /** \brief Members: float normal[3], curvature
144  * \ingroup common
145  */
146  struct Normal;
147 
148  /** \brief Members: float normal[3]
149  * \ingroup common
150  */
151  struct Axis;
152 
153  /** \brief Members: float x, y, z; float normal[3], curvature
154  * \ingroup common
155  */
156  struct PointNormal;
157 
158  /** \brief Members: float x, y, z, rgb, normal[3], curvature
159  * \ingroup common
160  */
161  struct PointXYZRGBNormal;
162 
163  /** \brief Members: float x, y, z, intensity, normal[3], curvature
164  * \ingroup common
165  */
166  struct PointXYZINormal;
167 
168  /** \brief Members: float x, y, z (union with float point[4]), range
169  * \ingroup common
170  */
171  struct PointWithRange;
172 
173  /** \brief Members: float x, y, z, vp_x, vp_y, vp_z
174  * \ingroup common
175  */
176  struct PointWithViewpoint;
177 
178  /** \brief Members: float j1, j2, j3
179  * \ingroup common
180  */
181  struct MomentInvariants;
182 
183  /** \brief Members: float r_min, r_max
184  * \ingroup common
185  */
186  struct PrincipalRadiiRSD;
187 
188  /** \brief Members: uint8_t boundary_point
189  * \ingroup common
190  */
191  struct Boundary;
192 
193  /** \brief Members: float principal_curvature[3], pc1, pc2
194  * \ingroup common
195  */
196  struct PrincipalCurvatures;
197 
198  /** \brief Members: float descriptor[352], rf[9]
199  * \ingroup common
200  */
201  struct SHOT352;
202 
203  /** \brief Members: float descriptor[1344], rf[9]
204  * \ingroup common
205  */
206  struct SHOT1344;
207 
208  /** \brief Members: Axis x_axis, y_axis, z_axis
209  * \ingroup common
210  */
211  struct ReferenceFrame;
212 
213  /** \brief Members: float descriptor[1980], rf[9]
214  * \ingroup common
215  */
216  struct ShapeContext1980;
217 
218  /** \brief Members: float pfh[125]
219  * \ingroup common
220  */
221  struct PFHSignature125;
222 
223  /** \brief Members: float pfhrgb[250]
224  * \ingroup common
225  */
226  struct PFHRGBSignature250;
227 
228  /** \brief Members: float f1, f2, f3, f4, alpha_m
229  * \ingroup common
230  */
231  struct PPFSignature;
232 
233  /** \brief Members: float f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, alpha_m
234  * \ingroup common
235  */
236  struct CPPFSignature;
237 
238  /** \brief Members: float f1, f2, f3, f4, r_ratio, g_ratio, b_ratio, alpha_m
239  * \ingroup common
240  */
241  struct PPFRGBSignature;
242 
243  /** \brief Members: float values[12]
244  * \ingroup common
245  */
246  struct NormalBasedSignature12;
247 
248  /** \brief Members: float fpfh[33]
249  * \ingroup common
250  */
251  struct FPFHSignature33;
252 
253  /** \brief Members: float vfh[308]
254  * \ingroup common
255  */
256  struct VFHSignature308;
257 
258  /** \brief Members: float esf[640]
259  * \ingroup common
260  */
261  struct ESFSignature640;
262 
263  /** \brief Members: float histogram[16]
264  * \ingroup common
265  */
266  struct GFPFHSignature16;
267 
268  /** \brief Members: float x, y, z, roll, pitch, yaw; float descriptor[36]
269  * \ingroup common
270  */
271  struct Narf36;
272 
273  /** \brief Data type to store extended information about a transition from foreground to backgroundSpecification of the fields for BorderDescription::traits.
274  * \ingroup common
275  */
276  typedef std::bitset<32> BorderTraits;
277 
278  /** \brief Specification of the fields for BorderDescription::traits.
279  * \ingroup common
280  */
282  {
288  };
289 
290  /** \brief Members: int x, y; BorderTraits traits
291  * \ingroup common
292  */
293  struct BorderDescription;
294 
295  /** \brief Members: float gradient[3]
296  * \ingroup common
297  */
298  struct IntensityGradient;
299 
300  /** \brief Members: float histogram[N]
301  * \ingroup common
302  */
303  template<int N>
304  struct Histogram;
305 
306  /** \brief Members: float x, y, z, scale, angle, response, octave
307  * \ingroup common
308  */
309  struct PointWithScale;
310 
311  /** \brief Members: float x, y, z, normal[3], rgba, radius, confidence, curvature
312  * \ingroup common
313  */
314  struct PointSurfel;
315 }
316 
317 /** @} */
318 
319 #include <pcl/impl/point_types.hpp> // Include struct definitions
320 
321 // ==============================
322 // =====POINT_CLOUD_REGISTER=====
323 // ==============================
324 
326  (uint32_t, rgba, rgba)
327 )
328 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::RGB, pcl::_RGB)
329 
331  (float, intensity, intensity)
332 )
333 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity, pcl::_Intensity)
334 
336  (uint8_t, intensity, intensity)
337 )
338 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity8u, pcl::_Intensity8u)
339 
341  (uint32_t, intensity, intensity)
342 )
343 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity32u, pcl::_Intensity32u)
344 
346  (float, x, x)
347  (float, y, y)
348  (float, z, z)
349 )
350 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZ, pcl::_PointXYZ)
351 
353  (float, x, x)
354  (float, y, y)
355  (float, z, z)
356  (uint32_t, rgba, rgba)
357 )
358 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBA, pcl::_PointXYZRGBA)
359 
361  (float, x, x)
362  (float, y, y)
363  (float, z, z)
364  (float, rgb, rgb)
365 )
366 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGB, pcl::_PointXYZRGB)
367 
369  (float, x, x)
370  (float, y, y)
371  (float, z, z)
372  (uint32_t, rgba, rgba)
373  (uint32_t, label, label)
374 )
375 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBL, pcl::_PointXYZRGBL)
376 
378  (float, x, x)
379  (float, y, y)
380  (float, z, z)
381  (float, h, h)
382  (float, s, s)
383  (float, v, v)
384 )
385 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZHSV, pcl::_PointXYZHSV)
386 
388  (float, x, x)
389  (float, y, y)
390 )
391 
393  (float, u, u)
394  (float, v, v)
395 )
396 
398  (float, x, x)
399  (float, y, y)
400  (float, z, z)
401  (float, strength, strength)
402 )
403 
405  (float, x, x)
406  (float, y, y)
407  (float, z, z)
408  (float, intensity, intensity)
409 )
410 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZI, pcl::_PointXYZI)
411 
413  (float, x, x)
414  (float, y, y)
415  (float, z, z)
416  (uint32_t, label, label)
417 )
418 
420  (uint32_t, label, label)
421 )
422 
424  (float, normal_x, normal_x)
425  (float, normal_y, normal_y)
426  (float, normal_z, normal_z)
427  (float, curvature, curvature)
428 )
429 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Normal, pcl::_Normal)
430 
432  (float, normal_x, normal_x)
433  (float, normal_y, normal_y)
434  (float, normal_z, normal_z)
435 )
436 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Axis, pcl::_Axis)
437 
439  (float, x, x)
440  (float, y, y)
441  (float, z, z)
442  (float, normal_x, normal_x)
443  (float, normal_y, normal_y)
444  (float, normal_z, normal_z)
445  (float, curvature, curvature)
446 )
448  (float, x, x)
449  (float, y, y)
450  (float, z, z)
451  (float, rgb, rgb)
452  (float, normal_x, normal_x)
453  (float, normal_y, normal_y)
454  (float, normal_z, normal_z)
455  (float, curvature, curvature)
456 )
457 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBNormal, pcl::_PointXYZRGBNormal)
459  (float, x, x)
460  (float, y, y)
461  (float, z, z)
462  (float, intensity, intensity)
463  (float, normal_x, normal_x)
464  (float, normal_y, normal_y)
465  (float, normal_z, normal_z)
466  (float, curvature, curvature)
467 )
469  (float, x, x)
470  (float, y, y)
471  (float, z, z)
472  (float, range, range)
473 )
474 
476  (float, x, x)
477  (float, y, y)
478  (float, z, z)
479  (float, vp_x, vp_x)
480  (float, vp_y, vp_y)
481  (float, vp_z, vp_z)
482 )
483 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointWithViewpoint, pcl::_PointWithViewpoint)
484 
486  (float, j1, j1)
487  (float, j2, j2)
488  (float, j3, j3)
489 )
490 
492  (float, r_min, r_min)
493  (float, r_max, r_max)
494 )
495 
497  (uint8_t, boundary_point, boundary_point)
498 )
499 
501  (float, principal_curvature_x, principal_curvature_x)
502  (float, principal_curvature_y, principal_curvature_y)
503  (float, principal_curvature_z, principal_curvature_z)
504  (float, pc1, pc1)
505  (float, pc2, pc2)
506 )
507 
509  (float[125], histogram, pfh)
510 )
511 
513  (float[250], histogram, pfhrgb)
514 )
515 
517  (float, f1, f1)
518  (float, f2, f2)
519  (float, f3, f3)
520  (float, f4, f4)
521  (float, alpha_m, alpha_m)
522 )
523 
525  (float, f1, f1)
526  (float, f2, f2)
527  (float, f3, f3)
528  (float, f4, f4)
529  (float, f5, f5)
530  (float, f6, f6)
531  (float, f7, f7)
532  (float, f8, f8)
533  (float, f9, f9)
534  (float, f10, f10)
535  (float, alpha_m, alpha_m)
536 )
537 
539  (float, f1, f1)
540  (float, f2, f2)
541  (float, f3, f3)
542  (float, f4, f4)
543  (float, r_ratio, r_ratio)
544  (float, g_ratio, g_ratio)
545  (float, b_ratio, b_ratio)
546  (float, alpha_m, alpha_m)
547 )
548 
550  (float[12], values, values)
551 )
552 
554  (float[1980], descriptor, shape_context)
555  (float[9], rf, rf)
556 )
557 
559  (float[352], descriptor, shot)
560  (float[9], rf, rf)
561 )
562 
564  (float[1344], descriptor, shot)
565  (float[9], rf, rf)
566 )
567 
569  (float[33], histogram, fpfh)
570 )
571 
573  (float[308], histogram, vfh)
574 )
575 
577  (float[640], histogram, esf)
578 )
579 
581  (float[36], descriptor, descriptor)
582 )
583 
585  (float[16], histogram, gfpfh)
586 )
587 
589  (float, gradient_x, gradient_x)
590  (float, gradient_y, gradient_y)
591  (float, gradient_z, gradient_z)
592 )
593 
595  (float, x, x)
596  (float, y, y)
597  (float, z, z)
598  (float, scale, scale)
599 )
600 
602  (float, x, x)
603  (float, y, y)
604  (float, z, z)
605  (float, normal_x, normal_x)
606  (float, normal_y, normal_y)
607  (float, normal_z, normal_z)
608  (uint32_t, rgba, rgba)
609  (float, radius, radius)
610  (float, confidence, confidence)
611  (float, curvature, curvature)
612 )
613 
615  (float[3], x_axis, x_axis)
616  (float[3], y_axis, y_axis)
617  (float[3], z_axis, z_axis)
618 )
619 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::ReferenceFrame, pcl::_ReferenceFrame)
620 
621 namespace pcl
622 {
623  // Allow float 'rgb' data to match to the newer uint32 'rgba' tag. This is so
624  // you can load old 'rgb' PCD files into e.g. a PointCloud<PointXYZRGBA>.
625  template<typename PointT>
626  struct FieldMatches<PointT, fields::rgba>
627  {
628  bool operator() (const pcl::PCLPointField& field)
629  {
630  if (field.name == "rgb")
631  {
632  return (field.datatype == pcl::PCLPointField::FLOAT32 &&
633  field.count == 1);
634  }
635  else
636  {
640  }
641  }
642  };
643  template<typename PointT>
644  struct FieldMatches<PointT, fields::rgb>
645  {
646  bool operator() (const pcl::PCLPointField& field)
647  {
648  if (field.name == "rgba")
649  {
650  return (field.datatype == pcl::PCLPointField::UINT32 &&
651  field.count == 1);
652  }
653  else
654  {
658  }
659  }
660  };
661 
662  namespace traits
663  {
664 
665  /** \brief Metafunction to check if a given point type has a given field.
666  *
667  * Example usage at run-time:
668  *
669  * \code
670  * bool curvature_available = pcl::traits::has_field<PointT, pcl::fields::curvature>::value;
671  * \endcode
672  *
673  * Example usage at compile-time:
674  *
675  * \code
676  * BOOST_MPL_ASSERT_MSG ((pcl::traits::has_field<PointT, pcl::fields::label>::value),
677  * POINT_TYPE_SHOULD_HAVE_LABEL_FIELD,
678  * (PointT));
679  * \endcode
680  */
681  template <typename PointT, typename Field>
682  struct has_field : boost::mpl::contains<typename pcl::traits::fieldList<PointT>::type, Field>::type
683  { };
684 
685  /** Metafunction to check if a given point type has all given fields. */
686  template <typename PointT, typename Field>
687  struct has_all_fields : boost::mpl::fold<Field,
688  boost::mpl::bool_<true>,
689  boost::mpl::and_<boost::mpl::_1,
690  has_field<PointT, boost::mpl::_2> > >::type
691  { };
692 
693  /** Metafunction to check if a given point type has any of the given fields. */
694  template <typename PointT, typename Field>
695  struct has_any_field : boost::mpl::fold<Field,
696  boost::mpl::bool_<false>,
697  boost::mpl::or_<boost::mpl::_1,
698  has_field<PointT, boost::mpl::_2> > >::type
699  { };
700 
701  /** Metafunction to check if a given point type has x, y, and z fields. */
702  template <typename PointT>
703  struct has_xyz : has_all_fields<PointT, boost::mpl::vector<pcl::fields::x,
704  pcl::fields::y,
705  pcl::fields::z> >
706  { };
707 
708  /** Metafunction to check if a given point type has normal_x, normal_y, and
709  * normal_z fields. */
710  template <typename PointT>
711  struct has_normal : has_all_fields<PointT, boost::mpl::vector<pcl::fields::normal_x,
712  pcl::fields::normal_y,
713  pcl::fields::normal_z> >
714  { };
715 
716  /** Metafunction to check if a given point type has curvature field. */
717  template <typename PointT>
718  struct has_curvature : has_field<PointT, pcl::fields::curvature>
719  { };
720 
721  /** Metafunction to check if a given point type has intensity field. */
722  template <typename PointT>
723  struct has_intensity : has_field<PointT, pcl::fields::intensity>
724  { };
725 
726  /** Metafunction to check if a given point type has either rgb or rgba field. */
727  template <typename PointT>
728  struct has_color : has_any_field<PointT, boost::mpl::vector<pcl::fields::rgb,
729  pcl::fields::rgba> >
730  { };
731 
732  /** Metafunction to check if a given point type has label field. */
733  template <typename PointT>
734  struct has_label : has_field<PointT, pcl::fields::label>
735  { };
736 
737  }
738 
739 } // namespace pcl
740 
741 #if defined _MSC_VER
742  #pragma warning(default: 4201)
743 #endif
744 //#pragma warning(pop)
745 
746 #endif //#ifndef PCL_DATA_TYPES_H_
A point structure representing normal coordinates and the surface curvature estimate.
A point structure representing the grayscale intensity in single-channel images.
A point structure representing a Shape Context.
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, padded with an extra range float...
A point structure representing the Normal Based Signature for a feature matrix of 4-by-3...
BorderTrait
Specification of the fields for BorderDescription::traits.
Definition: point_types.h:281
A structure representing the Local Reference Frame of a point.
A point structure representing an Axis using its normal coordinates.
A point structure representing Euclidean xyz coordinates, and the RGBA color.
A point structure representing the grayscale intensity in single-channel images.
A point structure representing the Fast Point Feature Histogram (FPFH).
A 2D point structure representing Euclidean xy coordinates.
A structure representing RGB color information.
A point structure representing an N-D histogram.
A 2D point structure representing pixel image coordinates.
pcl::uint32_t count
Definition: PCLPointField.h:25
A point structure representing the GFPFH descriptor with 16 bins.
A point structure representing the Point Feature Histogram with colors (PFHRGB).
A point structure representing Euclidean xyz coordinates, and the intensity value.
POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::_PointXYZLAB,(float, x, x)(float, y, y)(float, z, z)(float, L, L)(float, a, a)(float, b, b)) namespace pcl
Definition: gicp6d.h:78
A point structure representing Euclidean xyz coordinates.
A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates...
A point structure representing an interest point with Euclidean xyz coordinates, and an interest valu...
A point structure representing the three moment invariants.
A point structure representing the grayscale intensity in single-channel images.
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape onl...
A structure to store if a point in a range image lies on a border between an obstacle and the backgro...
A point structure representing Euclidean xyz coordinates, together with normal coordinates and the su...
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.
bool operator()(const pcl::PCLPointField &field)
Definition: point_traits.h:203
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+col...
pcl::uint8_t datatype
Definition: PCLPointField.h:24
std::string name
Definition: PCLPointField.h:21
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.
A point structure representing the Point Feature Histogram (PFH).
A point structure representing the Ensemble of Shape Functions (ESF).
A surfel, that is, a point structure representing Euclidean xyz coordinates, together with normal coo...
std::bitset< 32 > BorderTraits
Data type to store extended information about a transition from foreground to backgroundSpecification...
Definition: point_types.h:271
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.
A point structure for storing the Point Pair Color Feature (PPFRGB) values.