|
Point Cloud Library (PCL)
1.5.1
|
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 */ 00037 00038 #ifndef PCL_HARRIS_KEYPOINT_3D_H_ 00039 #define PCL_HARRIS_KEYPOINT_3D_H_ 00040 00041 #include <pcl/keypoints/keypoint.h> 00042 00043 namespace pcl 00044 { 00051 template <typename PointInT, typename PointOutT, typename NormalT = pcl::Normal> 00052 class HarrisKeypoint3D : public Keypoint<PointInT, PointOutT> 00053 { 00054 public: 00055 typedef typename Keypoint<PointInT, PointOutT>::PointCloudIn PointCloudIn; 00056 typedef typename Keypoint<PointInT, PointOutT>::PointCloudOut PointCloudOut; 00057 typedef typename Keypoint<PointInT, PointOutT>::KdTree KdTree; 00058 typedef typename PointCloudIn::ConstPtr PointCloudInConstPtr; 00059 00060 using Keypoint<PointInT, PointOutT>::name_; 00061 using Keypoint<PointInT, PointOutT>::input_; 00062 using Keypoint<PointInT, PointOutT>::indices_; 00063 using Keypoint<PointInT, PointOutT>::surface_; 00064 using Keypoint<PointInT, PointOutT>::tree_; 00065 using Keypoint<PointInT, PointOutT>::k_; 00066 using Keypoint<PointInT, PointOutT>::search_radius_; 00067 using Keypoint<PointInT, PointOutT>::search_parameter_; 00068 00069 00070 typedef enum {HARRIS = 1, NOBLE, LOWE, TOMASI, CURVATURE} ResponseMethod; 00071 00077 HarrisKeypoint3D (ResponseMethod method = HARRIS, float radius = 0.01, float threshold = 0.0) 00078 : threshold_ (threshold) 00079 , refine_ (true) 00080 , nonmax_ (true) 00081 , method_ (method) 00082 , normals_ (new pcl::PointCloud<NormalT>) 00083 , threads_ (1) 00084 { 00085 name_ = "HarrisKeypoint3D"; 00086 search_radius_ = radius; 00087 } 00088 00092 void setMethod (ResponseMethod type); 00093 00097 void setRadius (float radius); 00098 00103 void setThreshold (float threshold); 00104 00109 void setNonMaxSupression (bool = false); 00110 00115 void setRefine (bool do_refine); 00116 00121 void setNormals (boost::shared_ptr<pcl::PointCloud<NormalT> > normals ) const; 00122 00123 00124 virtual void 00125 setSearchSurface (const PointCloudInConstPtr &cloud) { surface_ = cloud; normals_->clear (); } 00126 00130 inline void 00131 setNumberOfThreads (int nr_threads) 00132 { 00133 if (nr_threads == 0) 00134 nr_threads = 1; 00135 threads_ = nr_threads; 00136 } 00137 protected: 00138 void detectKeypoints (PointCloudOut &output); 00140 void responseHarris (PointCloudOut &output) const; 00141 void responseNoble (PointCloudOut &output) const; 00142 void responseLowe (PointCloudOut &output) const; 00143 void responseTomasi (PointCloudOut &output) const; 00144 void responseCurvature (PointCloudOut &output) const; 00145 void refineCorners (PointCloudOut &corners) const; 00147 void calculateNormalCovar (const std::vector<int>& neighbors, float* coefficients) const; 00148 private: 00149 float threshold_; 00150 bool refine_; 00151 bool nonmax_; 00152 ResponseMethod method_; 00153 boost::shared_ptr<pcl::PointCloud<NormalT> > normals_; 00154 int threads_; 00155 }; 00156 } 00157 00158 #include "pcl/keypoints/impl/harris_keypoint3D.hpp" 00159 00160 #endif // #ifndef PCL_HARRIS_KEYPOINT_3D_H_ 00161
1.8.0