Point Cloud Library (PCL)  1.9.1-dev
smoothed_surfaces_keypoint.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, Alexandru-Eugen Ichim
5  * Willow Garage, Inc
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Willow Garage, Inc. nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *
35  * $Id$
36  */
37 
38 #pragma once
39 
40 #include <pcl/keypoints/keypoint.h>
41 
42 namespace pcl
43 {
44  /** \brief
45  * Based on the paper:
46  * Xinju Li and Igor Guskov
47  * Multi-scale features for approximate alignment of point-based surfaces
48  * Proceedings of the third Eurographics symposium on Geometry processing
49  * July 2005, Vienna, Austria
50  *
51  * \author Alexandru-Eugen Ichim
52  */
53  template <typename PointT, typename PointNT>
54  class SmoothedSurfacesKeypoint : public Keypoint <PointT, PointT>
55  {
56  public:
57  using Ptr = boost::shared_ptr<SmoothedSurfacesKeypoint<PointT, PointNT> >;
58  using ConstPtr = boost::shared_ptr<const SmoothedSurfacesKeypoint<PointT, PointNT> >;
59 
65 
70  using PointCloudTPtr = typename PointCloudT::Ptr;
72 
74  : Keypoint<PointT, PointT> (),
75  neighborhood_constant_ (0.5f),
76  clouds_ (),
77  cloud_normals_ (),
78  cloud_trees_ (),
79  normals_ (),
80  input_scale_ (0.0f),
81  input_index_ ()
82  {
83  name_ = "SmoothedSurfacesKeypoint";
84 
85  // hack to pass the initCompute () check of Keypoint - although it is never used in SmoothedSurfacesKeypoint
87  }
88 
89  void
91  const PointCloudNTConstPtr &normals,
92  KdTreePtr &kdtree,
93  float &scale);
94 
95 
96  void
97  resetClouds ();
98 
99  inline void
100  setNeighborhoodConstant (float neighborhood_constant) { neighborhood_constant_ = neighborhood_constant; }
101 
102  inline float
103  getNeighborhoodConstant () { return neighborhood_constant_; }
104 
105  inline void
106  setInputNormals (const PointCloudNTConstPtr &normals) { normals_ = normals; }
107 
108  inline void
109  setInputScale (float input_scale) { input_scale_ = input_scale; }
110 
111  void
112  detectKeypoints (PointCloudT &output) override;
113 
114  protected:
115  bool
116  initCompute () override;
117 
118  private:
119  float neighborhood_constant_;
120  std::vector<PointCloudTConstPtr> clouds_;
121  std::vector<PointCloudNTConstPtr> cloud_normals_;
122  std::vector<KdTreePtr> cloud_trees_;
123  PointCloudNTConstPtr normals_;
124  std::vector<std::pair<float, std::size_t> > scales_;
125  float input_scale_;
126  std::size_t input_index_;
127 
128  static bool
129  compareScalesFunction (const std::pair<float, std::size_t> &a,
130  const std::pair<float, std::size_t> &b) { return a.first < b.first; }
131  };
132 }
std::string name_
The key point detection method&#39;s name.
Definition: keypoint.h:169
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
void setNeighborhoodConstant(float neighborhood_constant)
Based on the paper: Xinju Li and Igor Guskov Multi-scale features for approximate alignment of point-...
typename Keypoint< PointT, PointT >::KdTreePtr KdTreePtr
typename PointCloudNT::ConstPtr PointCloudNTConstPtr
void addSmoothedPointCloud(const PointCloudTConstPtr &cloud, const PointCloudNTConstPtr &normals, KdTreePtr &kdtree, float &scale)
Keypoint represents the base class for key points.
Definition: keypoint.h:48
typename PointCloudT::Ptr PointCloudTPtr
void setInputNormals(const PointCloudNTConstPtr &normals)
PCL base class.
Definition: pcl_base.h:69
boost::shared_ptr< const SmoothedSurfacesKeypoint< PointT, PointNT > > ConstPtr
boost::shared_ptr< SmoothedSurfacesKeypoint< PointT, PointNT > > Ptr
boost::shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:411
PointCloud represents the base class in PCL for storing collections of 3D points. ...
boost::shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:412
void detectKeypoints(PointCloudT &output) override
Abstract key point detection method.
A point structure representing Euclidean xyz coordinates, and the RGB color.
typename PointCloudT::ConstPtr PointCloudTConstPtr