Point Cloud Library (PCL)
1.7.0
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2011, Alexandru-Eugen Ichim 00006 * Copyright (c) 2012-, Open Perception, Inc. 00007 * 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 00014 * * Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * * Redistributions in binary form must reproduce the above 00017 * copyright notice, this list of conditions and the following 00018 * disclaimer in the documentation and/or other materials provided 00019 * with the distribution. 00020 * * Neither the name of the copyright holder(s) nor the names of its 00021 * contributors may be used to endorse or promote products derived 00022 * from this software without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00025 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00026 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00027 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00028 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00029 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00030 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00031 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00033 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00034 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00035 * POSSIBILITY OF SUCH DAMAGE. 00036 * 00037 * $Id$ 00038 */ 00039 00040 #ifndef PCL_PFHRGB_H_ 00041 #define PCL_PFHRGB_H_ 00042 00043 #include <pcl/features/feature.h> 00044 #include <pcl/features/pfh_tools.h> 00045 00046 namespace pcl 00047 { 00048 template <typename PointInT, typename PointNT, typename PointOutT = pcl::PFHRGBSignature250> 00049 class PFHRGBEstimation : public FeatureFromNormals<PointInT, PointNT, PointOutT> 00050 { 00051 public: 00052 typedef boost::shared_ptr<PFHRGBEstimation<PointInT, PointNT, PointOutT> > Ptr; 00053 typedef boost::shared_ptr<const PFHRGBEstimation<PointInT, PointNT, PointOutT> > ConstPtr; 00054 using PCLBase<PointInT>::indices_; 00055 using Feature<PointInT, PointOutT>::feature_name_; 00056 using Feature<PointInT, PointOutT>::surface_; 00057 using Feature<PointInT, PointOutT>::k_; 00058 using Feature<PointInT, PointOutT>::search_parameter_; 00059 using FeatureFromNormals<PointInT, PointNT, PointOutT>::normals_; 00060 typedef typename Feature<PointInT, PointOutT>::PointCloudOut PointCloudOut; 00061 00062 00063 PFHRGBEstimation () 00064 : nr_subdiv_ (5), pfhrgb_histogram_ (), pfhrgb_tuple_ (), d_pi_ (1.0f / (2.0f * static_cast<float> (M_PI))) 00065 { 00066 feature_name_ = "PFHRGBEstimation"; 00067 } 00068 00069 bool 00070 computeRGBPairFeatures (const pcl::PointCloud<PointInT> &cloud, const pcl::PointCloud<PointNT> &normals, 00071 int p_idx, int q_idx, 00072 float &f1, float &f2, float &f3, float &f4, float &f5, float &f6, float &f7); 00073 00074 void 00075 computePointPFHRGBSignature (const pcl::PointCloud<PointInT> &cloud, const pcl::PointCloud<PointNT> &normals, 00076 const std::vector<int> &indices, int nr_split, Eigen::VectorXf &pfhrgb_histogram); 00077 00078 protected: 00079 void 00080 computeFeature (PointCloudOut &output); 00081 00082 private: 00083 /** \brief The number of subdivisions for each angular feature interval. */ 00084 int nr_subdiv_; 00085 00086 /** \brief Placeholder for a point's PFHRGB signature. */ 00087 Eigen::VectorXf pfhrgb_histogram_; 00088 00089 /** \brief Placeholder for a PFHRGB 7-tuple. */ 00090 Eigen::VectorXf pfhrgb_tuple_; 00091 00092 /** \brief Placeholder for a histogram index. */ 00093 int f_index_[7]; 00094 00095 /** \brief Float constant = 1.0 / (2.0 * M_PI) */ 00096 float d_pi_; 00097 }; 00098 } 00099 00100 #ifdef PCL_NO_PRECOMPILE 00101 #include <pcl/features/impl/pfhrgb.hpp> 00102 #endif 00103 00104 #endif /* PCL_PFHRGB_H_ */