Point Cloud Library (PCL)  1.7.1
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 
46 /**
47  * \file pcl/point_types.h
48  * Defines all the PCL implemented PointT point type structures
49  * \ingroup common
50  */
51 
52 // We're doing a lot of black magic with Boost here, so disable warnings in Maintainer mode, as we will never
53 // be able to fix them anyway
54 #if defined _MSC_VER
55  #pragma warning(disable: 4201)
56 #endif
57 //#pragma warning(push, 1)
58 #if defined __GNUC__
59 # pragma GCC system_header
60 #endif
61 
62 /** @{*/
63 namespace pcl
64 {
65  /** \brief Members: float x, y, z
66  * \ingroup common
67  */
68  struct PointXYZ;
69 
70  /** \brief Members: rgba
71  * \ingroup common
72  */
73  struct RGB;
74 
75  /** \brief Members: intensity (float)
76  * \ingroup common
77  */
78  struct Intensity;
79 
80  /** \brief Members: intensity (uint8_t)
81  * \ingroup common
82  */
83  struct Intensity8u;
84 
85  /** \brief Members: intensity (uint32_t)
86  * \ingroup common
87  */
88  struct Intensity32u;
89 
90  /** \brief Members: float x, y, z, intensity
91  * \ingroup common
92  */
93  struct PointXYZI;
94 
95  /** \brief Members: float x, y, z, uin32_t label
96  * \ingroup common
97  */
98  struct PointXYZL;
99 
100  /** \brief Members: uint32_t label
101  * \ingroup common
102  */
103  struct Label;
104 
105  /** \brief Members: float x, y, z; uint32_t rgba
106  * \ingroup common
107  */
108  struct PointXYZRGBA;
109 
110  /** \brief Members: float x, y, z, rgb
111  * \ingroup common
112  */
113  struct PointXYZRGB;
114 
115  /** \brief Members: float x, y, z, rgb, uint32_t label
116  * \ingroup common
117  */
118  struct PointXYZRGBL;
119 
120  /** \brief Members: float x, y, z, h, s, v
121  * \ingroup common
122  */
123  struct PointXYZHSV;
124 
125  /** \brief Members: float x, y
126  * \ingroup common
127  */
128  struct PointXY;
129 
130  /** \brief Members: float u, v
131  * \ingroup common
132  */
133  struct PointUV;
134 
135  /** \brief Members: float x, y, z, strength
136  * \ingroup common
137  */
138  struct InterestPoint;
139 
140  /** \brief Members: float normal[3], curvature
141  * \ingroup common
142  */
143  struct Normal;
144 
145  /** \brief Members: float normal[3]
146  * \ingroup common
147  */
148  struct Axis;
149 
150  /** \brief Members: float x, y, z; float normal[3], curvature
151  * \ingroup common
152  */
153  struct PointNormal;
154 
155  /** \brief Members: float x, y, z, rgb, normal[3], curvature
156  * \ingroup common
157  */
158  struct PointXYZRGBNormal;
159 
160  /** \brief Members: float x, y, z, intensity, normal[3], curvature
161  * \ingroup common
162  */
163  struct PointXYZINormal;
164 
165  /** \brief Members: float x, y, z (union with float point[4]), range
166  * \ingroup common
167  */
168  struct PointWithRange;
169 
170  /** \brief Members: float x, y, z, vp_x, vp_y, vp_z
171  * \ingroup common
172  */
173  struct PointWithViewpoint;
174 
175  /** \brief Members: float j1, j2, j3
176  * \ingroup common
177  */
178  struct MomentInvariants;
179 
180  /** \brief Members: float r_min, r_max
181  * \ingroup common
182  */
183  struct PrincipalRadiiRSD;
184 
185  /** \brief Members: uint8_t boundary_point
186  * \ingroup common
187  */
188  struct Boundary;
189 
190  /** \brief Members: float principal_curvature[3], pc1, pc2
191  * \ingroup common
192  */
193  struct PrincipalCurvatures;
194 
195  /** \brief Members: float descriptor[352], rf[9]
196  * \ingroup common
197  */
198  struct SHOT352;
199 
200  /** \brief Members: float descriptor[1344], rf[9]
201  * \ingroup common
202  */
203  struct SHOT1344;
204 
205  /** \brief Members: Axis x_axis, y_axis, z_axis
206  * \ingroup common
207  */
208  struct ReferenceFrame;
209 
210  /** \brief Members: float descriptor[1980], rf[9]
211  * \ingroup common
212  */
213  struct ShapeContext1980;
214 
215  /** \brief Members: float pfh[125]
216  * \ingroup common
217  */
218  struct PFHSignature125;
219 
220  /** \brief Members: float pfhrgb[250]
221  * \ingroup common
222  */
223  struct PFHRGBSignature250;
224 
225  /** \brief Members: float f1, f2, f3, f4, alpha_m
226  * \ingroup common
227  */
228  struct PPFSignature;
229 
230  /** \brief Members: float f1, f2, f3, f4, r_ratio, g_ratio, b_ratio, alpha_m
231  * \ingroup common
232  */
233  struct PPFRGBSignature;
234 
235  /** \brief Members: float values[12]
236  * \ingroup common
237  */
238  struct NormalBasedSignature12;
239 
240  /** \brief Members: float fpfh[33]
241  * \ingroup common
242  */
243  struct FPFHSignature33;
244 
245  /** \brief Members: float vfh[308]
246  * \ingroup common
247  */
248  struct VFHSignature308;
249 
250  /** \brief Members: float esf[640]
251  * \ingroup common
252  */
253  struct ESFSignature640;
254 
255  /** \brief Members: float histogram[16]
256  * \ingroup common
257  */
258  struct GFPFHSignature16;
259 
260  /** \brief Members: float x, y, z, roll, pitch, yaw; float descriptor[36]
261  * \ingroup common
262  */
263  struct Narf36;
264 
265  /** \brief Data type to store extended information about a transition from foreground to backgroundSpecification of the fields for BorderDescription::traits.
266  * \ingroup common
267  */
268  typedef std::bitset<32> BorderTraits;
269 
270  /** \brief Specification of the fields for BorderDescription::traits.
271  * \ingroup common
272  */
274  {
280  };
281 
282  /** \brief Members: int x, y; BorderTraits traits
283  * \ingroup common
284  */
285  struct BorderDescription;
286 
287  /** \brief Members: float gradient[3]
288  * \ingroup common
289  */
290  struct IntensityGradient;
291 
292  /** \brief Members: float histogram[N]
293  * \ingroup common
294  */
295  template<int N>
296  struct Histogram;
297 
298  /** \brief Members: float x, y, z, scale, angle, response, octave
299  * \ingroup common
300  */
301  struct PointWithScale;
302 
303  /** \brief Members: float x, y, z, normal[3], rgba, radius, confidence, curvature
304  * \ingroup common
305  */
306  struct PointSurfel;
307 }
308 
309 /** @} */
310 
311 #include <pcl/impl/point_types.hpp> // Include struct definitions
312 
313 // ==============================
314 // =====POINT_CLOUD_REGISTER=====
315 // ==============================
316 
317 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_RGB,
318  (uint32_t, rgba, rgba)
319 )
320 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::RGB, pcl::_RGB)
321 
322 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity,
323  (float, intensity, intensity)
324 )
325 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity, pcl::_Intensity)
326 
327 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity8u,
328  (uint8_t, intensity, intensity)
329 )
330 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity8u, pcl::_Intensity8u)
331 
332 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity32u,
333  (uint32_t, intensity, intensity)
334 )
335 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity32u, pcl::_Intensity32u)
336 
337 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZ,
338  (float, x, x)
339  (float, y, y)
340  (float, z, z)
341 )
342 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZ, pcl::_PointXYZ)
343 
344 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBA,
345  (float, x, x)
346  (float, y, y)
347  (float, z, z)
348  (uint32_t, rgba, rgba)
349 )
350 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBA, pcl::_PointXYZRGBA)
351 
352 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGB,
353  (float, x, x)
354  (float, y, y)
355  (float, z, z)
356  (float, rgb, rgb)
357 )
358 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGB, pcl::_PointXYZRGB)
359 
360 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBL,
361  (float, x, x)
362  (float, y, y)
363  (float, z, z)
364  (uint32_t, rgba, rgba)
365  (uint32_t, label, label)
366 )
367 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBL, pcl::_PointXYZRGBL)
368 
369 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZHSV,
370  (float, x, x)
371  (float, y, y)
372  (float, z, z)
373  (float, h, h)
374  (float, s, s)
375  (float, v, v)
376 )
377 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZHSV, pcl::_PointXYZHSV)
378 
379 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXY,
380  (float, x, x)
381  (float, y, y)
382 )
383 
384 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointUV,
385  (float, u, u)
386  (float, v, v)
387 )
388 
389 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::InterestPoint,
390  (float, x, x)
391  (float, y, y)
392  (float, z, z)
393  (float, strength, strength)
394 )
395 
396 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZI,
397  (float, x, x)
398  (float, y, y)
399  (float, z, z)
400  (float, intensity, intensity)
401 )
402 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZI, pcl::_PointXYZI)
403 
404 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZL,
405  (float, x, x)
406  (float, y, y)
407  (float, z, z)
408  (uint32_t, label, label)
409 )
410 
411 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Label,
412  (uint32_t, label, label)
413 )
414 
415 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Normal,
416  (float, normal_x, normal_x)
417  (float, normal_y, normal_y)
418  (float, normal_z, normal_z)
419  (float, curvature, curvature)
420 )
421 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Normal, pcl::_Normal)
422 
423 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Axis,
424  (float, normal_x, normal_x)
425  (float, normal_y, normal_y)
426  (float, normal_z, normal_z)
427 )
428 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Axis, pcl::_Axis)
429 
430 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointNormal,
431  (float, x, x)
432  (float, y, y)
433  (float, z, z)
434  (float, normal_x, normal_x)
435  (float, normal_y, normal_y)
436  (float, normal_z, normal_z)
437  (float, curvature, curvature)
438 )
439 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBNormal,
440  (float, x, x)
441  (float, y, y)
442  (float, z, z)
443  (float, rgb, rgb)
444  (float, normal_x, normal_x)
445  (float, normal_y, normal_y)
446  (float, normal_z, normal_z)
447  (float, curvature, curvature)
448 )
449 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBNormal, pcl::_PointXYZRGBNormal)
450 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZINormal,
451  (float, x, x)
452  (float, y, y)
453  (float, z, z)
454  (float, intensity, intensity)
455  (float, normal_x, normal_x)
456  (float, normal_y, normal_y)
457  (float, normal_z, normal_z)
458  (float, curvature, curvature)
459 )
460 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithRange,
461  (float, x, x)
462  (float, y, y)
463  (float, z, z)
464  (float, range, range)
465 )
466 
467 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointWithViewpoint,
468  (float, x, x)
469  (float, y, y)
470  (float, z, z)
471  (float, vp_x, vp_x)
472  (float, vp_y, vp_y)
473  (float, vp_z, vp_z)
474 )
475 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointWithViewpoint, pcl::_PointWithViewpoint)
476 
477 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::MomentInvariants,
478  (float, j1, j1)
479  (float, j2, j2)
480  (float, j3, j3)
481 )
482 
483 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalRadiiRSD,
484  (float, r_min, r_min)
485  (float, r_max, r_max)
486 )
487 
488 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Boundary,
489  (uint8_t, boundary_point, boundary_point)
490 )
491 
492 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalCurvatures,
493  (float, principal_curvature_x, principal_curvature_x)
494  (float, principal_curvature_y, principal_curvature_y)
495  (float, principal_curvature_z, principal_curvature_z)
496  (float, pc1, pc1)
497  (float, pc2, pc2)
498 )
499 
500 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHSignature125,
501  (float[125], histogram, pfh)
502 )
503 
504 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHRGBSignature250,
505  (float[250], histogram, pfhrgb)
506 )
507 
508 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFSignature,
509  (float, f1, f1)
510  (float, f2, f2)
511  (float, f3, f3)
512  (float, f4, f4)
513  (float, alpha_m, alpha_m)
514 )
515 
516 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature,
517  (float, f1, f1)
518  (float, f2, f2)
519  (float, f3, f3)
520  (float, f4, f4)
521  (float, r_ratio, r_ratio)
522  (float, g_ratio, g_ratio)
523  (float, b_ratio, b_ratio)
524  (float, alpha_m, alpha_m)
525 )
526 
527 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::NormalBasedSignature12,
528  (float[12], values, values)
529 )
530 
531 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ShapeContext1980,
532  (float[1980], descriptor, shape_context)
533  (float[9], rf, rf)
534 )
535 
536 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT352,
537  (float[352], descriptor, shot)
538  (float[9], rf, rf)
539 )
540 
541 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT1344,
542  (float[1344], descriptor, shot)
543  (float[9], rf, rf)
544 )
545 
546 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::FPFHSignature33,
547  (float[33], histogram, fpfh)
548 )
549 
550 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::VFHSignature308,
551  (float[308], histogram, vfh)
552 )
553 
554 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ESFSignature640,
555  (float[640], histogram, esf)
556 )
557 
558 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Narf36,
559  (float[36], descriptor, descriptor)
560 )
561 
562 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::GFPFHSignature16,
563  (float[16], histogram, gfpfh)
564 )
565 
566 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::IntensityGradient,
567  (float, gradient_x, gradient_x)
568  (float, gradient_y, gradient_y)
569  (float, gradient_z, gradient_z)
570 )
571 
572 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithScale,
573  (float, x, x)
574  (float, y, y)
575  (float, z, z)
576  (float, scale, scale)
577 )
578 
579 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointSurfel,
580  (float, x, x)
581  (float, y, y)
582  (float, z, z)
583  (float, normal_x, normal_x)
584  (float, normal_y, normal_y)
585  (float, normal_z, normal_z)
586  (uint32_t, rgba, rgba)
587  (float, radius, radius)
588  (float, confidence, confidence)
589  (float, curvature, curvature)
590 )
591 
592 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_ReferenceFrame,
593  (float[3], x_axis, x_axis)
594  (float[3], y_axis, y_axis)
595  (float[3], z_axis, z_axis)
596 )
597 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::ReferenceFrame, pcl::_ReferenceFrame)
598 
599 namespace pcl
600 {
601  // Allow float 'rgb' data to match to the newer uint32 'rgba' tag. This is so
602  // you can load old 'rgb' PCD files into e.g. a PointCloud<PointXYZRGBA>.
603  template<typename PointT>
604  struct FieldMatches<PointT, fields::rgba>
605  {
606  bool operator() (const pcl::PCLPointField& field)
607  {
608  if (field.name == "rgb")
609  {
610  return (field.datatype == pcl::PCLPointField::FLOAT32 &&
611  field.count == 1);
612  }
613  else
614  {
615  return (field.name == traits::name<PointT, fields::rgba>::value &&
616  field.datatype == traits::datatype<PointT, fields::rgba>::value &&
617  field.count == traits::datatype<PointT, fields::rgba>::size);
618  }
619  }
620  };
621  template<typename PointT>
622  struct FieldMatches<PointT, fields::rgb>
623  {
624  bool operator() (const pcl::PCLPointField& field)
625  {
626  if (field.name == "rgba")
627  {
628  return (field.datatype == pcl::PCLPointField::UINT32 &&
629  field.count == 1);
630  }
631  else
632  {
633  return (field.name == traits::name<PointT, fields::rgb>::value &&
634  field.datatype == traits::datatype<PointT, fields::rgb>::value &&
635  field.count == traits::datatype<PointT, fields::rgb>::size);
636  }
637  }
638  };
639 } // namespace pcl
640 
641 #if defined _MSC_VER
642  #pragma warning(default: 4201)
643 #endif
644 //#pragma warning(pop)
645 
646 #endif //#ifndef PCL_DATA_TYPES_H_