Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
point_types.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Point Cloud Library (PCL) - www.pointclouds.org
00005  *  Copyright (c) 2010-2011, Willow Garage, Inc.
00006  *
00007  *  All rights reserved.
00008  *
00009  *  Redistribution and use in source and binary forms, with or without
00010  *  modification, are permitted provided that the following conditions
00011  *  are met:
00012  *
00013  *   * Redistributions of source code must retain the above copyright
00014  *     notice, this list of conditions and the following disclaimer.
00015  *   * Redistributions in binary form must reproduce the above
00016  *     copyright notice, this list of conditions and the following
00017  *     disclaimer in the documentation and/or other materials provided
00018  *     with the distribution.
00019  *   * Neither the name of Willow Garage, Inc. nor the names of its
00020  *     contributors may be used to endorse or promote products derived
00021  *     from this software without specific prior written permission.
00022  *
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00029  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034  *  POSSIBILITY OF SUCH DAMAGE.
00035  *
00036  * $Id: point_types.h 6126 2012-07-03 20:19:58Z aichim $
00037  *
00038  */
00039 #ifndef PCL_DATA_TYPES_H_
00040 #define PCL_DATA_TYPES_H_
00041 
00042 #include <pcl/pcl_macros.h>
00043 #include <pcl/common/eigen.h>
00044 #include <bitset>
00045 #include <vector>
00046 #include <pcl/ros/register_point_struct.h>
00047 
00054 // We're doing a lot of black magic with Boost here, so disable warnings in Maintainer mode, as we will never
00055 // be able to fix them anyway
00056 #pragma warning(disable: 4201)
00057 //#pragma warning(push, 1)
00058 #ifdef BUILD_Maintainer
00059 #  if defined __GNUC__
00060 #    include <features.h>
00061 #    if __GNUC_PREREQ(4, 3)
00062 #      pragma GCC diagnostic ignored "-Weffc++"
00063 #      pragma GCC diagnostic ignored "-pedantic"
00064 #    else
00065 #      pragma GCC system_header
00066 #    endif
00067 //#  elif defined _MSC_VER
00068 #  endif
00069 #endif
00070 
00072 namespace pcl
00073 {
00077   struct PointXYZ;
00078 
00082   struct RGB;
00083 
00087   struct PointXYZI;
00088 
00092   struct PointXYZL;
00093 
00097   struct Label;
00098 
00102   struct PointXYZRGBA;
00103 
00107   struct PointXYZRGB;
00108 
00112   struct PointXYZRGBL;
00113 
00117   struct PointXYZHSV;
00118 
00122   struct PointXY;
00123 
00127   struct InterestPoint;
00128 
00132   struct Normal;
00133 
00137   struct Axis;
00138 
00142   struct PointNormal;
00143 
00147   struct PointXYZRGBNormal;
00148 
00152   struct PointXYZINormal;
00153 
00157   struct PointWithRange;
00158 
00162   struct PointWithViewpoint;
00163 
00167   struct MomentInvariants;
00168 
00172   struct PrincipalRadiiRSD;
00173 
00177   struct Boundary;
00178 
00182   struct PrincipalCurvatures;
00183 
00188   struct
00189   PCL_DEPRECATED_CLASS (SHOT, "USE SHOT352 FOR SHAPE AND SHOT1344 FOR SHAPE+COLOR INSTEAD");
00190 
00194   struct SHOT352;
00195 
00199   struct SHOT1344;
00200 
00204   struct ReferenceFrame;
00205 
00209   struct ShapeContext;
00210 
00214   struct PFHSignature125;
00215 
00219   struct PFHRGBSignature250;
00220 
00224   struct PPFSignature;
00225 
00229   struct PPFRGBSignature;
00230 
00234   struct NormalBasedSignature12;
00235 
00239   struct FPFHSignature33;
00240 
00244   struct VFHSignature308;
00248   struct ESFSignature640;
00253   struct Narf36;
00254 
00258   typedef std::bitset<32> BorderTraits;
00259 
00263   enum BorderTrait
00264   {
00265     BORDER_TRAIT__OBSTACLE_BORDER, BORDER_TRAIT__SHADOW_BORDER, BORDER_TRAIT__VEIL_POINT,
00266     BORDER_TRAIT__SHADOW_BORDER_TOP, BORDER_TRAIT__SHADOW_BORDER_RIGHT, BORDER_TRAIT__SHADOW_BORDER_BOTTOM,
00267     BORDER_TRAIT__SHADOW_BORDER_LEFT, BORDER_TRAIT__OBSTACLE_BORDER_TOP, BORDER_TRAIT__OBSTACLE_BORDER_RIGHT,
00268     BORDER_TRAIT__OBSTACLE_BORDER_BOTTOM, BORDER_TRAIT__OBSTACLE_BORDER_LEFT, BORDER_TRAIT__VEIL_POINT_TOP,
00269     BORDER_TRAIT__VEIL_POINT_RIGHT, BORDER_TRAIT__VEIL_POINT_BOTTOM, BORDER_TRAIT__VEIL_POINT_LEFT
00270   };
00271 
00275   struct BorderDescription;
00276 
00280   struct IntensityGradient;
00281 
00285   template<int N>
00286   struct Histogram;
00287 
00291   struct PointWithScale;
00292 
00296   struct PointSurfel;
00297 }
00298 
00301 #include <pcl/impl/point_types.hpp>  // Include struct definitions
00302 
00303 // ==============================
00304 // =====POINT_CLOUD_REGISTER=====
00305 // ==============================
00306 
00307 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::RGB,
00308     (uint32_t, rgba, rgba)
00309 )
00310 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZ,
00311     (float, x, x)
00312     (float, y, y)
00313     (float, z, z)
00314 )
00315 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZ, pcl::_PointXYZ)
00316 
00317 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBA,
00318     (float, x, x)
00319     (float, y, y)
00320     (float, z, z)
00321     (uint32_t, rgba, rgba)
00322 )
00323 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBA, pcl::_PointXYZRGBA)
00324 
00325 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGB,
00326     (float, x, x)
00327     (float, y, y)
00328     (float, z, z)
00329     (float, rgb, rgb)
00330 )
00331 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGB, pcl::_PointXYZRGB)
00332 
00333 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBL,
00334     (float, x, x)
00335     (float, y, y)
00336     (float, z, z)
00337     (uint32_t, rgba, rgba)
00338     (uint32_t, label, label)
00339 )
00340 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBL, pcl::_PointXYZRGBL)
00341 
00342 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZHSV,
00343     (float, x, x)
00344     (float, y, y)
00345     (float, z, z)
00346     (float, h, h)
00347     (float, s, s)
00348     (float, v, v)
00349 )
00350 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZHSV, pcl::_PointXYZHSV)
00351 
00352 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXY,
00353     (float, x, x)
00354     (float, y, y)
00355 )
00356 
00357 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::InterestPoint,
00358     (float, x, x)
00359     (float, y, y)
00360     (float, z, z)
00361     (float, strength, strength)
00362 )
00363 
00364 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZI,
00365     (float, x, x)
00366     (float, y, y)
00367     (float, z, z)
00368     (float, intensity, intensity)
00369 )
00370 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZI, pcl::_PointXYZI)
00371 
00372 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZL,
00373     (float, x, x)
00374     (float, y, y)
00375     (float, z, z)
00376     (uint32_t, label, label)
00377 )
00378 
00379 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Label,
00380     (uint32_t, label, label)
00381 )
00382 
00383 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Normal,
00384     (float, normal_x, normal_x)
00385     (float, normal_y, normal_y)
00386     (float, normal_z, normal_z)
00387     (float, curvature, curvature)
00388 )
00389 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Normal, pcl::_Normal)
00390 
00391 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Axis,
00392     (float, normal_x, normal_x)
00393     (float, normal_y, normal_y)
00394     (float, normal_z, normal_z)
00395 )
00396 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Axis, pcl::_Axis)
00397 
00398 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointNormal,
00399     (float, x, x)
00400     (float, y, y)
00401     (float, z, z)
00402     (float, normal_x, normal_x)
00403     (float, normal_y, normal_y)
00404     (float, normal_z, normal_z)
00405     (float, curvature, curvature)
00406 )
00407 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBNormal,
00408     (float, x, x)
00409     (float, y, y)
00410     (float, z, z)
00411     (float, rgb, rgb)
00412     (float, normal_x, normal_x)
00413     (float, normal_y, normal_y)
00414     (float, normal_z, normal_z)
00415     (float, curvature, curvature)
00416 )
00417 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBNormal, pcl::_PointXYZRGBNormal)
00418 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZINormal,
00419     (float, x, x)
00420     (float, y, y)
00421     (float, z, z)
00422     (float, intensity, intensity)
00423     (float, normal_x, normal_x)
00424     (float, normal_y, normal_y)
00425     (float, normal_z, normal_z)
00426     (float, curvature, curvature)
00427 )
00428 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithRange,
00429     (float, x, x)
00430     (float, y, y)
00431     (float, z, z)
00432     (float, range, range)
00433 )
00434 
00435 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointWithViewpoint,
00436     (float, x, x)
00437     (float, y, y)
00438     (float, z, z)
00439     (float, vp_x, vp_x)
00440     (float, vp_y, vp_y)
00441     (float, vp_z, vp_z)
00442 )
00443 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointWithViewpoint, pcl::_PointWithViewpoint)
00444 
00445 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::MomentInvariants,
00446     (float, j1, j1)
00447     (float, j2, j2)
00448     (float, j3, j3)
00449 )
00450 
00451 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalRadiiRSD,
00452     (float, r_min, r_min)
00453     (float, r_max, r_max)
00454 )
00455 
00456 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Boundary,
00457     (uint8_t, boundary_point, boundary_point)
00458 )
00459 
00460 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalCurvatures,
00461     (float, principal_curvature_x, principal_curvature_x)
00462     (float, principal_curvature_y, principal_curvature_y)
00463     (float, principal_curvature_z, principal_curvature_z)
00464     (float, pc1, pc1)
00465     (float, pc2, pc2)
00466 )
00467 
00468 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHSignature125,
00469     (float[125], histogram, pfh)
00470 )
00471 
00472 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHRGBSignature250,
00473     (float[250], histogram, pfhrgb)
00474 )
00475 
00476 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFSignature,
00477     (float, f1, f1)
00478     (float, f2, f2)
00479     (float, f3, f3)
00480     (float, f4, f4)
00481     (float, alpha_m, alpha_m)
00482 )
00483 
00484 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature,
00485     (float, f1, f1)
00486     (float, f2, f2)
00487     (float, f3, f3)
00488     (float, f4, f4)
00489     (float, r_ratio, r_ratio)
00490     (float, g_ratio, g_ratio)
00491     (float, b_ratio, b_ratio)
00492     (float, alpha_m, alpha_m)
00493 )
00494 
00495 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::NormalBasedSignature12,
00496     (float[12], values, values)
00497 )
00498 
00499 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT352,
00500     (float[352], descriptor, shot)
00501     (float[9], rf, rf)
00502 )
00503 
00504 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT1344,
00505     (float[1344], descriptor, shot)
00506     (float[9], rf, rf)
00507 )
00508 
00509 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::FPFHSignature33,
00510     (float[33], histogram, fpfh)
00511 )
00512 
00513 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::VFHSignature308,
00514     (float[308], histogram, vfh)
00515 )
00516 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ESFSignature640,
00517     (float[640], histogram, esf)
00518 )
00519 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Narf36,
00520     (float[36], descriptor, descriptor)
00521 )
00522 
00523 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::GFPFHSignature16,
00524     (float[16], histogram, gfpfh)
00525 )
00526 
00527 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::IntensityGradient,
00528     (float, gradient_x, gradient_x)
00529     (float, gradient_y, gradient_y)
00530     (float, gradient_z, gradient_z)
00531 )
00532 
00533 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithScale,
00534     (float, x, x)
00535     (float, y, y)
00536     (float, z, z)
00537     (float, scale, scale)
00538 )
00539 
00540 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointSurfel,
00541     (float, x, x)
00542     (float, y, y)
00543     (float, z, z)
00544     (float, normal_x, normal_x)
00545     (float, normal_y, normal_y)
00546     (float, normal_z, normal_z)
00547     (uint32_t, rgba, rgba)
00548     (float, radius, radius)
00549     (float, confidence, confidence)
00550     (float, curvature, curvature)
00551 )
00552 
00553 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_ReferenceFrame,
00554     (float[3], x_axis, x_axis)
00555     (float[3], y_axis, y_axis)
00556     (float[3], z_axis, z_axis)
00557     //(float, confidence, confidence)
00558 )
00559 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::ReferenceFrame, pcl::_ReferenceFrame)
00560 
00561 //POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::BorderDescription,
00562 //                                  (int, x, x)
00563 //                                  (int, y, y)
00564 //                                  (uint32_t, traits, traits)
00565 //)
00566 
00567 namespace pcl {
00568   // Allow float 'rgb' data to match to the newer uint32 'rgba' tag. This is so
00569   // you can load old 'rgb' PCD files into e.g. a PointCloud<PointXYZRGBA>.
00570   template<typename PointT>
00571   struct FieldMatches<PointT, fields::rgba>
00572   {
00573     bool operator() (const sensor_msgs::PointField& field)
00574     {
00575       if (field.name == "rgb")
00576       {
00577         return (field.datatype == sensor_msgs::PointField::FLOAT32 &&
00578                 field.count == 1);
00579       }
00580       else
00581       {
00582         return (field.name == traits::name<PointT, fields::rgba>::value &&
00583                 field.datatype == traits::datatype<PointT, fields::rgba>::value &&
00584                 field.count == traits::datatype<PointT, fields::rgba>::size);
00585       }
00586     }
00587   };
00588 } // namespace pcl
00589 
00590 #pragma warning(default: 4201)
00591 //#pragma warning(pop)
00592 #ifdef BUILD_Maintainer
00593 #  if defined __GNUC__
00594 #    if __GNUC_PREREQ(4, 3)
00595 #      pragma GCC diagnostic warning "-Weffc++"
00596 #      pragma GCC diagnostic warning "-pedantic"
00597 #    endif
00598 //#  elif defined _MSC_VER
00599 #  endif
00600 #endif
00601 
00602 #endif  //#ifndef PCL_DATA_TYPES_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines