Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
point_types.h
Go to the documentation of this file.
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 Willow Garage, Inc. 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: point_types.h 6126 2012-07-03 20:19:58Z aichim $
37  *
38  */
39 #ifndef PCL_DATA_TYPES_H_
40 #define PCL_DATA_TYPES_H_
41 
42 #include <pcl/pcl_macros.h>
43 #include <pcl/common/eigen.h>
44 #include <bitset>
45 #include <vector>
47 
54 // We're doing a lot of black magic with Boost here, so disable warnings in Maintainer mode, as we will never
55 // be able to fix them anyway
56 #pragma warning(disable: 4201)
57 //#pragma warning(push, 1)
58 #ifdef BUILD_Maintainer
59 # if defined __GNUC__
60 # include <features.h>
61 # if __GNUC_PREREQ(4, 3)
62 # pragma GCC diagnostic ignored "-Weffc++"
63 # pragma GCC diagnostic ignored "-pedantic"
64 # else
65 # pragma GCC system_header
66 # endif
67 //# elif defined _MSC_VER
68 # endif
69 #endif
70 
72 namespace pcl
73 {
77  struct PointXYZ;
78 
82  struct RGB;
83 
87  struct PointXYZI;
88 
92  struct PointXYZL;
93 
97  struct Label;
98 
102  struct PointXYZRGBA;
103 
107  struct PointXYZRGB;
108 
112  struct PointXYZRGBL;
113 
117  struct PointXYZHSV;
118 
122  struct PointXY;
123 
127  struct InterestPoint;
128 
132  struct Normal;
133 
137  struct Axis;
138 
142  struct PointNormal;
143 
147  struct PointXYZRGBNormal;
148 
152  struct PointXYZINormal;
153 
157  struct PointWithRange;
158 
162  struct PointWithViewpoint;
163 
167  struct MomentInvariants;
168 
172  struct PrincipalRadiiRSD;
173 
177  struct Boundary;
178 
182  struct PrincipalCurvatures;
183 
188  struct
189  PCL_DEPRECATED_CLASS (SHOT, "USE SHOT352 FOR SHAPE AND SHOT1344 FOR SHAPE+COLOR INSTEAD");
190 
194  struct SHOT352;
195 
199  struct SHOT1344;
200 
204  struct ReferenceFrame;
205 
209  struct ShapeContext;
210 
214  struct PFHSignature125;
215 
219  struct PFHRGBSignature250;
220 
224  struct PPFSignature;
225 
229  struct PPFRGBSignature;
230 
234  struct NormalBasedSignature12;
235 
239  struct FPFHSignature33;
240 
244  struct VFHSignature308;
248  struct ESFSignature640;
253  struct Narf36;
254 
258  typedef std::bitset<32> BorderTraits;
259 
264  {
270  };
271 
275  struct BorderDescription;
276 
280  struct IntensityGradient;
281 
285  template<int N>
286  struct Histogram;
287 
291  struct PointWithScale;
292 
296  struct PointSurfel;
297 }
298 
301 #include <pcl/impl/point_types.hpp> // Include struct definitions
302 
303 // ==============================
304 // =====POINT_CLOUD_REGISTER=====
305 // ==============================
306 
308  (uint32_t, rgba, rgba)
309 )
310 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZ,
311  (float, x, x)
312  (float, y, y)
313  (float, z, z)
314 )
315 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZ, pcl::_PointXYZ)
316 
317 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBA,
318  (float, x, x)
319  (float, y, y)
320  (float, z, z)
321  (uint32_t, rgba, rgba)
322 )
323 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBA, pcl::_PointXYZRGBA)
324 
325 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGB,
326  (float, x, x)
327  (float, y, y)
328  (float, z, z)
329  (float, rgb, rgb)
330 )
331 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGB, pcl::_PointXYZRGB)
332 
333 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBL,
334  (float, x, x)
335  (float, y, y)
336  (float, z, z)
337  (uint32_t, rgba, rgba)
338  (uint32_t, label, label)
339 )
340 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBL, pcl::_PointXYZRGBL)
341 
342 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZHSV,
343  (float, x, x)
344  (float, y, y)
345  (float, z, z)
346  (float, h, h)
347  (float, s, s)
348  (float, v, v)
349 )
350 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZHSV, pcl::_PointXYZHSV)
351 
353  (float, x, x)
354  (float, y, y)
355 )
356 
357 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::InterestPoint,
358  (float, x, x)
359  (float, y, y)
360  (float, z, z)
361  (float, strength, strength)
362 )
363 
364 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZI,
365  (float, x, x)
366  (float, y, y)
367  (float, z, z)
368  (float, intensity, intensity)
369 )
370 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZI, pcl::_PointXYZI)
371 
372 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZL,
373  (float, x, x)
374  (float, y, y)
375  (float, z, z)
376  (uint32_t, label, label)
377 )
378 
380  (uint32_t, label, label)
381 )
382 
384  (float, normal_x, normal_x)
385  (float, normal_y, normal_y)
386  (float, normal_z, normal_z)
387  (float, curvature, curvature)
388 )
389 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Normal, pcl::_Normal)
390 
392  (float, normal_x, normal_x)
393  (float, normal_y, normal_y)
394  (float, normal_z, normal_z)
395 )
396 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Axis, pcl::_Axis)
397 
398 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointNormal,
399  (float, x, x)
400  (float, y, y)
401  (float, z, z)
402  (float, normal_x, normal_x)
403  (float, normal_y, normal_y)
404  (float, normal_z, normal_z)
405  (float, curvature, curvature)
406 )
407 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBNormal,
408  (float, x, x)
409  (float, y, y)
410  (float, z, z)
411  (float, rgb, rgb)
412  (float, normal_x, normal_x)
413  (float, normal_y, normal_y)
414  (float, normal_z, normal_z)
415  (float, curvature, curvature)
416 )
417 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBNormal, pcl::_PointXYZRGBNormal)
418 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZINormal,
419  (float, x, x)
420  (float, y, y)
421  (float, z, z)
422  (float, intensity, intensity)
423  (float, normal_x, normal_x)
424  (float, normal_y, normal_y)
425  (float, normal_z, normal_z)
426  (float, curvature, curvature)
427 )
428 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithRange,
429  (float, x, x)
430  (float, y, y)
431  (float, z, z)
432  (float, range, range)
433 )
434 
435 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointWithViewpoint,
436  (float, x, x)
437  (float, y, y)
438  (float, z, z)
439  (float, vp_x, vp_x)
440  (float, vp_y, vp_y)
441  (float, vp_z, vp_z)
442 )
443 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointWithViewpoint, pcl::_PointWithViewpoint)
444 
445 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::MomentInvariants,
446  (float, j1, j1)
447  (float, j2, j2)
448  (float, j3, j3)
449 )
450 
451 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalRadiiRSD,
452  (float, r_min, r_min)
453  (float, r_max, r_max)
454 )
455 
456 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Boundary,
457  (uint8_t, boundary_point, boundary_point)
458 )
459 
460 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalCurvatures,
461  (float, principal_curvature_x, principal_curvature_x)
462  (float, principal_curvature_y, principal_curvature_y)
463  (float, principal_curvature_z, principal_curvature_z)
464  (float, pc1, pc1)
465  (float, pc2, pc2)
466 )
467 
468 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHSignature125,
469  (float[125], histogram, pfh)
470 )
471 
472 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHRGBSignature250,
473  (float[250], histogram, pfhrgb)
474 )
475 
476 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFSignature,
477  (float, f1, f1)
478  (float, f2, f2)
479  (float, f3, f3)
480  (float, f4, f4)
481  (float, alpha_m, alpha_m)
482 )
483 
484 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature,
485  (float, f1, f1)
486  (float, f2, f2)
487  (float, f3, f3)
488  (float, f4, f4)
489  (float, r_ratio, r_ratio)
490  (float, g_ratio, g_ratio)
491  (float, b_ratio, b_ratio)
492  (float, alpha_m, alpha_m)
493 )
494 
495 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::NormalBasedSignature12,
496  (float[12], values, values)
497 )
498 
500  (float[352], descriptor, shot)
501  (float[9], rf, rf)
502 )
503 
504 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT1344,
505  (float[1344], descriptor, shot)
506  (float[9], rf, rf)
507 )
508 
509 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::FPFHSignature33,
510  (float[33], histogram, fpfh)
511 )
512 
513 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::VFHSignature308,
514  (float[308], histogram, vfh)
515 )
516 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ESFSignature640,
517  (float[640], histogram, esf)
518 )
520  (float[36], descriptor, descriptor)
521 )
522 
523 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::GFPFHSignature16,
524  (float[16], histogram, gfpfh)
525 )
526 
527 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::IntensityGradient,
528  (float, gradient_x, gradient_x)
529  (float, gradient_y, gradient_y)
530  (float, gradient_z, gradient_z)
531 )
532 
533 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithScale,
534  (float, x, x)
535  (float, y, y)
536  (float, z, z)
537  (float, scale, scale)
538 )
539 
540 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointSurfel,
541  (float, x, x)
542  (float, y, y)
543  (float, z, z)
544  (float, normal_x, normal_x)
545  (float, normal_y, normal_y)
546  (float, normal_z, normal_z)
547  (uint32_t, rgba, rgba)
548  (float, radius, radius)
549  (float, confidence, confidence)
550  (float, curvature, curvature)
551 )
552 
553 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_ReferenceFrame,
554  (float[3], x_axis, x_axis)
555  (float[3], y_axis, y_axis)
556  (float[3], z_axis, z_axis)
557  //(float, confidence, confidence)
558 )
559 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::ReferenceFrame, pcl::_ReferenceFrame)
560 
561 //POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::BorderDescription,
562 // (int, x, x)
563 // (int, y, y)
564 // (uint32_t, traits, traits)
565 //)
566 
567 namespace pcl {
568  // Allow float 'rgb' data to match to the newer uint32 'rgba' tag. This is so
569  // you can load old 'rgb' PCD files into e.g. a PointCloud<PointXYZRGBA>.
570  template<typename PointT>
571  struct FieldMatches<PointT, fields::rgba>
572  {
573  bool operator() (const sensor_msgs::PointField& field)
574  {
575  if (field.name == "rgb")
576  {
577  return (field.datatype == sensor_msgs::PointField::FLOAT32 &&
578  field.count == 1);
579  }
580  else
581  {
582  return (field.name == traits::name<PointT, fields::rgba>::value &&
583  field.datatype == traits::datatype<PointT, fields::rgba>::value &&
584  field.count == traits::datatype<PointT, fields::rgba>::size);
585  }
586  }
587  };
588 } // namespace pcl
589 
590 #pragma warning(default: 4201)
591 //#pragma warning(pop)
592 #ifdef BUILD_Maintainer
593 # if defined __GNUC__
594 # if __GNUC_PREREQ(4, 3)
595 # pragma GCC diagnostic warning "-Weffc++"
596 # pragma GCC diagnostic warning "-pedantic"
597 # endif
598 //# elif defined _MSC_VER
599 # endif
600 #endif
601 
602 #endif //#ifndef PCL_DATA_TYPES_H_