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$
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       typedef boost::shared_ptr<SmoothedSurfacesKeypoint<PointT, PointNT> > Ptr;
00059       typedef boost::shared_ptr<const SmoothedSurfacesKeypoint<PointT, PointNT> > ConstPtr;
00060 
00061       using PCLBase<PointT>::input_;
00062       using Keypoint<PointT, PointT>::name_;
00063       using Keypoint<PointT, PointT>::tree_;
00064       using Keypoint<PointT, PointT>::initCompute;
00065 
00066       typedef pcl::PointCloud<PointT> PointCloudT;
00067       typedef typename PointCloudT::ConstPtr PointCloudTConstPtr;
00068       typedef pcl::PointCloud<PointNT> PointCloudNT;
00069       typedef typename PointCloudNT::ConstPtr PointCloudNTConstPtr;
00070       typedef typename PointCloudT::Ptr PointCloudTPtr;
00071       typedef typename Keypoint<PointT, PointT>::KdTreePtr KdTreePtr;
00072 
00073       SmoothedSurfacesKeypoint ()
00074         : Keypoint<PointT, PointT> (),
00075           neighborhood_constant_ (0.5f),
00076           clouds_ (),
00077           cloud_normals_ (),
00078           cloud_trees_ (),
00079           normals_ (),
00080           scales_ (),
00081           input_scale_ (0.0f),
00082           input_index_ ()
00083       {
00084         name_ = "SmoothedSurfacesKeypoint";
00085 
00086         // hack to pass the initCompute () check of Keypoint - although it is never used in SmoothedSurfacesKeypoint
00087         Keypoint<PointT, PointT>::search_radius_ = 0.1;
00088       }
00089 
00090       void
00091       addSmoothedPointCloud (const PointCloudTConstPtr &cloud,
00092                              const PointCloudNTConstPtr &normals,
00093                              KdTreePtr &kdtree,
00094                              float &scale);
00095 
00096 
00097       void
00098       resetClouds ();
00099 
00100       inline void
00101       setNeighborhoodConstant (float neighborhood_constant) { neighborhood_constant_ = neighborhood_constant; }
00102 
00103       inline float
00104       getNeighborhoodConstant () { return neighborhood_constant_; }
00105 
00106       inline void
00107       setInputNormals (const PointCloudNTConstPtr &normals) { normals_ = normals; }
00108 
00109       inline void
00110       setInputScale (float input_scale) { input_scale_ = input_scale; }
00111 
00112       void
00113       detectKeypoints (PointCloudT &output);
00114 
00115     protected:
00116       bool
00117       initCompute ();
00118 
00119     private:
00120       float neighborhood_constant_;
00121       std::vector<PointCloudTConstPtr> clouds_;
00122       std::vector<PointCloudNTConstPtr> cloud_normals_;
00123       std::vector<KdTreePtr> cloud_trees_;
00124       PointCloudNTConstPtr normals_;
00125       std::vector<std::pair<float, size_t> > scales_;
00126       float input_scale_;
00127       size_t input_index_;
00128 
00129       static bool
00130       compareScalesFunction (const std::pair<float, size_t> &a,
00131                              const std::pair<float, size_t> &b) { return a.first < b.first; }
00132   };
00133 }
00134 
00135 #endif /* PCL_SMOOTHEDSURFACESKEYPOINT_H_ */


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:33:37