smoothed_surfaces_keypoint.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2011, Alexandru-Eugen Ichim
00005  *                      Willow Garage, Inc
00006  *  All rights reserved.
00007  *
00008  *  Redistribution and use in source and binary forms, with or without
00009  *  modification, are permitted provided that the following conditions
00010  *  are met:
00011  *
00012  *   * Redistributions of source code must retain the above copyright
00013  *     notice, this list of conditions and the following disclaimer.
00014  *   * Redistributions in binary form must reproduce the above
00015  *     copyright notice, this list of conditions and the following
00016  *     disclaimer in the documentation and/or other materials provided
00017  *     with the distribution.
00018  *   * Neither the name of Willow Garage, Inc. nor the names of its
00019  *     contributors may be used to endorse or promote products derived
00020  *     from this software without specific prior written permission.
00021  *
00022  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033  *  POSSIBILITY OF SUCH DAMAGE.
00034  *
00035  * $Id: smoothed_surfaces_keypoint.h 2127 2011-08-16 20:00:21Z aichim $
00036  */
00037 
00038 #ifndef PCL_SMOOTHEDSURFACESKEYPOINT_H_
00039 #define PCL_SMOOTHEDSURFACESKEYPOINT_H_
00040 
00041 #include <pcl/keypoints/keypoint.h>
00042 
00043 namespace pcl
00044 {
00054   template <typename PointT, typename PointNT>
00055   class SmoothedSurfacesKeypoint : public Keypoint <PointT, PointT>
00056   {
00057     public:
00058       using PCLBase<PointT>::input_;
00059       using Keypoint<PointT, PointT>::name_;
00060       using Keypoint<PointT, PointT>::tree_;
00061       using Keypoint<PointT, PointT>::initCompute;
00062 
00063       typedef pcl::PointCloud<PointT> PointCloudT;
00064       typedef typename PointCloudT::ConstPtr PointCloudTConstPtr;
00065       typedef pcl::PointCloud<PointNT> PointCloudNT;
00066       typedef typename PointCloudNT::ConstPtr PointCloudNTConstPtr;
00067       typedef typename PointCloudT::Ptr PointCloudTPtr;
00068       typedef typename Keypoint<PointT, PointT>::KdTreePtr KdTreePtr;
00069 
00070       SmoothedSurfacesKeypoint ()
00071         : Keypoint<PointT, PointT> (),
00072           neighborhood_constant_ (0.5f),
00073           clouds_ (),
00074           cloud_normals_ (),
00075           cloud_trees_ (),
00076           normals_ (),
00077           scales_ (),
00078           input_scale_ (0.0f),
00079           input_index_ ()
00080       {
00081         name_ = "SmoothedSurfacesKeypoint";
00082 
00083         // hack to pass the initCompute () check of Keypoint - although it is never used in SmoothedSurfacesKeypoint
00084         Keypoint<PointT, PointT>::search_radius_ = 0.1;
00085       }
00086 
00087       void
00088       addSmoothedPointCloud (const PointCloudTConstPtr &cloud,
00089                              const PointCloudNTConstPtr &normals,
00090                              KdTreePtr &kdtree,
00091                              float &scale);
00092 
00093 
00094       void
00095       resetClouds ();
00096 
00097       inline void
00098       setNeighborhoodConstant (float neighborhood_constant) { neighborhood_constant_ = neighborhood_constant; }
00099 
00100       inline float
00101       getNeighborhoodConstant () { return neighborhood_constant_; }
00102 
00103       inline void
00104       setInputNormals (const PointCloudNTConstPtr &normals) { normals_ = normals; }
00105 
00106       inline void
00107       setInputScale (float input_scale) { input_scale_ = input_scale; }
00108 
00109       void
00110       detectKeypoints (PointCloudT &output);
00111 
00112     protected:
00113       bool
00114       initCompute ();
00115 
00116     private:
00117       float neighborhood_constant_;
00118       std::vector<PointCloudTConstPtr> clouds_;
00119       std::vector<PointCloudNTConstPtr> cloud_normals_;
00120       std::vector<KdTreePtr> cloud_trees_;
00121       PointCloudNTConstPtr normals_;
00122       std::vector<std::pair<float, size_t> > scales_;
00123       float input_scale_;
00124       size_t input_index_;
00125 
00126       static bool
00127       compareScalesFunction (const std::pair<float, size_t> &a,
00128                              const std::pair<float, size_t> &b) { return a.first < b.first; }
00129   };
00130 }
00131 
00132 #endif /* PCL_SMOOTHEDSURFACESKEYPOINT_H_ */


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:17:58