point_types.h

Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2010, Willow Garage, Inc.
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of Willow Garage, Inc. nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  * $Id: point_types.h 1385 2011-06-19 19:15:56Z rusu $
00035  *
00036  */
00037 #ifndef PCL_DATA_TYPES_H_
00038 #define PCL_DATA_TYPES_H_
00039 
00040 #include "pcl/pcl_macros.h"
00041 #include <Eigen/Core>
00042 #include <bitset>
00043 #include <vector>
00044 #include "pcl/ros/register_point_struct.h"
00045 #include "pcl/win32_macros.h"
00046 #include <math.h>
00047 
00055 namespace pcl
00056 {
00057   struct PointXYZ;
00058   // Members: float x, y, z;
00059 
00060   struct PointXYZI;
00061   // Members: float x, y, z, intensity; 
00062 
00063   struct PointXYZRGBA;
00064   // Members: float x, y, z; uint32_t rgba;
00065 
00066   struct PointXYZRGB;
00067   // Members: float x, y, z, rgb;
00068 
00069   struct PointXY;
00070   // Members: float x, y;
00071 
00072   struct InterestPoint;
00073   // Members: float x, y, z, strength;
00074 
00075   struct Normal;
00076   // Members: float normal[3], curvature;
00077 
00078   struct PointNormal;
00079   // Members: float x, y, z; float normal[3], curvature;
00080 
00081   struct PointXYZRGBNormal;
00082   // Members: float x, y, z, rgb, normal[3], curvature;
00083 
00084   struct PointXYZINormal;
00085   // Members: float x, y, z, intensity, normal[3], curvature;
00086 
00087   struct PointWithRange;
00088   // Members: float x, y, z (union with float point[4]), range;
00089 
00090   struct PointWithViewpoint;
00091   // Members: float x, y, z, vp_x, vp_y, vp_z;
00092 
00093   struct MomentInvariants;
00094   // Members: float j1, j2, j3;
00095 
00096   // TODO add point type for Radius-based Surface Descriptor (RSD) histograms, and let pcl::RSDEstimation return it if needed
00097 
00098   struct PrincipalRadiiRSD;
00099   // Members: float r_min, r_max;
00100 
00101   struct Boundary;
00102   // Members: uint8_t boundary_point;
00103 
00104   struct PrincipalCurvatures;
00105   // Members: float principal_curvature[3], pc1, pc2;
00106 
00107   struct PFHSignature125;
00108   // Members: float pfh[125];
00109 
00110   struct FPFHSignature33;
00111   // Members: float fpfh[33];
00112 
00113   struct VFHSignature308;
00114   // Members: float vfh[308];
00115   
00116   struct Narf36;
00117   // Members: float x, y, z, roll, pitch, yaw; float descriptor[36];
00118 
00119 
00123   typedef std::bitset<32> BorderTraits;
00124 
00128   enum BorderTrait 
00129   {
00130     BORDER_TRAIT__OBSTACLE_BORDER,
00131     BORDER_TRAIT__SHADOW_BORDER,
00132     BORDER_TRAIT__VEIL_POINT,
00133     BORDER_TRAIT__SHADOW_BORDER_TOP,
00134     BORDER_TRAIT__SHADOW_BORDER_RIGHT,
00135     BORDER_TRAIT__SHADOW_BORDER_BOTTOM,
00136     BORDER_TRAIT__SHADOW_BORDER_LEFT,
00137     BORDER_TRAIT__OBSTACLE_BORDER_TOP,
00138     BORDER_TRAIT__OBSTACLE_BORDER_RIGHT,
00139     BORDER_TRAIT__OBSTACLE_BORDER_BOTTOM,
00140     BORDER_TRAIT__OBSTACLE_BORDER_LEFT,
00141     BORDER_TRAIT__VEIL_POINT_TOP,
00142     BORDER_TRAIT__VEIL_POINT_RIGHT,
00143     BORDER_TRAIT__VEIL_POINT_BOTTOM,
00144     BORDER_TRAIT__VEIL_POINT_LEFT,
00145   };
00146   
00147   struct BorderDescription;
00148   // Members: int x, y; BorderTraits traits;
00149 
00150   struct IntensityGradient;
00151   // Members: float gradient[3];
00152 
00153   template <int N>
00154   struct Histogram;
00155   // Members: float histogram[N];
00156 
00157   struct PointWithScale;
00158   // Members: float x, y, z, scale;
00159   
00160   struct PointSurfel;
00161   // Members: float x, y, z, normal[3], rgba, radius, confidence, curvature;
00162 
00163   // -----Functions on points-----
00165   template <typename PointType1, typename PointType2> inline float 
00166   euclideanDistance (const PointType1& p1, const PointType2& p2);
00167   
00169   template <typename PointType1, typename PointType2> inline float 
00170   squaredEuclideanDistance (const PointType1& p1, const PointType2& p2);
00171 
00173   template <typename PointType> inline bool 
00174   hasValidXYZ (const PointType& p);
00175 }
00176 
00179 #include "pcl/impl/point_types.hpp"  // Include struct definitions
00180 
00181 
00182 // ==============================
00183 // =====POINT_CLOUD_REGISTER=====
00184 // ==============================
00185 
00186 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZ,
00187                                    (float, x, x)
00188                                    (float, y, y)
00189                                    (float, z, z)
00190 )
00191 
00192 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZ, pcl::_PointXYZ)
00193 
00194 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZRGBA,
00195                                    (float, x, x)
00196                                    (float, y, y)
00197                                    (float, z, z)
00198                                    (uint32_t, rgba, rgba)
00199 )
00200 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZRGB,
00201                                    (float, x, x)
00202                                    (float, y, y)
00203                                    (float, z, z)
00204                                    (float, rgb, rgb)
00205 )
00206 
00207 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXY,
00208                                    (float, x, x)
00209                                    (float, y, y)
00210 )
00211 
00212 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::InterestPoint,
00213                                    (float, x, x)
00214                                    (float, y, y)
00215                                    (float, z, z)
00216                                    (float, strength, strength)
00217 )
00218 
00219 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZI, 
00220                                    (float, x, x) 
00221                                    (float, y, y) 
00222                                    (float, z, z) 
00223                                    (float, intensity, intensity) 
00224 ) 
00225 
00226 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Normal,
00227                                    (float, normal_x, normal_x)
00228                                    (float, normal_y, normal_y)
00229                                    (float, normal_z, normal_z)
00230                                    (float, curvature, curvature)
00231 )
00232 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointNormal,
00233                                    (float, x, x)
00234                                    (float, y, y)
00235                                    (float, z, z)
00236                                    (float, normal_x, normal_x)
00237                                    (float, normal_y, normal_y)
00238                                    (float, normal_z, normal_z)
00239                                    (float, curvature, curvature)
00240 )
00241 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZRGBNormal,
00242                                    (float, x, x)
00243                                    (float, y, y)
00244                                    (float, z, z)
00245                                    (float, rgb, rgb)
00246                                    (float, normal_x, normal_x)
00247                                    (float, normal_y, normal_y)
00248                                    (float, normal_z, normal_z)
00249                                    (float, curvature, curvature)
00250 )
00251 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZINormal,
00252                                    (float, x, x)
00253                                    (float, y, y)
00254                                    (float, z, z)
00255                                    (float, intensity, intensity)
00256                                    (float, normal_x, normal_x)
00257                                    (float, normal_y, normal_y)
00258                                    (float, normal_z, normal_z)
00259                                    (float, curvature, curvature)
00260 )
00261 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithRange,
00262                                    (float, x, x)
00263                                    (float, y, y)
00264                                    (float, z, z)
00265                                    (float, range, range)
00266 )
00267 
00268 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointWithViewpoint,
00269                                    (float, x, x)
00270                                    (float, y, y)
00271                                    (float, z, z)
00272                                    (float, vp_x, vp_x)
00273                                    (float, vp_y, vp_y)
00274                                    (float, vp_z, vp_z)
00275 )
00276 
00277 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointWithViewpoint, pcl::_PointWithViewpoint)
00278 
00279 
00280 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::MomentInvariants,
00281                                    (float, j1, j1)
00282                                    (float, j2, j2)
00283                                    (float, j3, j3)
00284 )
00285 
00286 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalRadiiRSD,
00287                                    (float, r_min, r_min)
00288                                    (float, r_max, r_max)
00289 )
00290 
00291 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Boundary,
00292                                    (uint8_t, boundary_point, boundary_point)
00293 )
00294 
00295 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalCurvatures,
00296                                    (float, principal_curvature_x, principal_curvature_x)
00297                                    (float, principal_curvature_y, principal_curvature_y)
00298                                    (float, principal_curvature_z, principal_curvature_z)
00299                                    (float, pc1, pc1)
00300                                    (float, pc2, pc2)
00301 )
00302 
00303 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHSignature125,
00304                                    (float[125], histogram, pfh)
00305 )
00306 
00307 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::FPFHSignature33,
00308                                    (float[33], histogram, fpfh)
00309 )
00310 
00311 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::VFHSignature308,
00312                                    (float[308], histogram, vfh)
00313 )
00314 
00315 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Narf36,
00316                                    (float[36], descriptor, descriptor)
00317 )
00318 
00319 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::IntensityGradient,
00320                                    (float, gradient_x, gradient_x)
00321                                    (float, gradient_y, gradient_y)
00322                                    (float, gradient_z, gradient_z)
00323 )
00324 
00325 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithScale,
00326                                    (float, x, x)
00327                                    (float, y, y)
00328                                    (float, z, z)
00329                                    (float, scale, scale)
00330 )
00331 
00332 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointSurfel,
00333                                    (float, x, x)
00334                                    (float, y, y)
00335                                    (float, z, z)
00336                                    (float, normal_x, normal_x)
00337                                    (float, normal_y, normal_y)
00338                                    (float, normal_z, normal_z)
00339                                    (uint32_t, rgba, rgba)
00340                                    (float, radius, radius)
00341                                    (float, confidence, confidence)
00342                                    (float, curvature, curvature)
00343 )
00344 
00345 //POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::BorderDescription,
00346                                    //(int, x, x)
00347                                    //(int, y, y)
00348                                    //(uint32_t, traits_int, traits)
00349 //)
00350 
00351 
00352 #endif  //#ifndef PCL_DATA_TYPES_H_