Point Cloud Library (PCL)  1.7.2
surfel_smoothing.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 #ifndef PCL_SURFEL_SMOOTHING_H_
39 #define PCL_SURFEL_SMOOTHING_H_
40 
41 #include <pcl/pcl_base.h>
42 #include <pcl/search/pcl_search.h>
43 
44 namespace pcl
45 {
46  template <typename PointT, typename PointNT>
47  class SurfelSmoothing : public PCLBase<PointT>
48  {
51 
52  public:
53  typedef boost::shared_ptr<SurfelSmoothing<PointT, PointNT> > Ptr;
54  typedef boost::shared_ptr<const SurfelSmoothing<PointT, PointNT> > ConstPtr;
55 
62 
63  SurfelSmoothing (float a_scale = 0.01)
64  : PCLBase<PointT> ()
65  , scale_ (a_scale)
66  , scale_squared_ (a_scale * a_scale)
67  , normals_ ()
68  , interm_cloud_ ()
69  , interm_normals_ ()
70  , tree_ ()
71  {
72  }
73 
74  void
75  setInputNormals (NormalCloudPtr &a_normals) { normals_ = a_normals; };
76 
77  void
78  setSearchMethod (const CloudKdTreePtr &a_tree) { tree_ = a_tree; };
79 
80  bool
81  initCompute ();
82 
83  float
84  smoothCloudIteration (PointCloudInPtr &output_positions,
85  NormalCloudPtr &output_normals);
86 
87  void
88  computeSmoothedCloud (PointCloudInPtr &output_positions,
89  NormalCloudPtr &output_normals);
90 
91 
92  void
93  smoothPoint (size_t &point_index,
94  PointT &output_point,
95  PointNT &output_normal);
96 
97  void
98  extractSalientFeaturesBetweenScales (PointCloudInPtr &cloud2,
99  NormalCloudPtr &cloud2_normals,
100  boost::shared_ptr<std::vector<int> > &output_features);
101 
102  private:
103  float scale_, scale_squared_;
104  NormalCloudPtr normals_;
105 
106  PointCloudInPtr interm_cloud_;
107  NormalCloudPtr interm_normals_;
108 
109  CloudKdTreePtr tree_;
110 
111  };
112 }
113 
114 #ifdef PCL_NO_PRECOMPILE
115 #include <pcl/surface/impl/surfel_smoothing.hpp>
116 #endif
117 
118 #endif // PCL_SURFEL_SMOOTHING_H_
SurfelSmoothing(float a_scale=0.01)
void smoothPoint(size_t &point_index, PointT &output_point, PointNT &output_normal)
void setInputNormals(NormalCloudPtr &a_normals)
pcl::PointCloud< PointT > PointCloudIn
void computeSmoothedCloud(PointCloudInPtr &output_positions, NormalCloudPtr &output_normals)
boost::shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:428
pcl::search::Search< PointT >::Ptr CloudKdTreePtr
float smoothCloudIteration(PointCloudInPtr &output_positions, NormalCloudPtr &output_normals)
boost::shared_ptr< pcl::search::Search< PointT > > Ptr
Definition: search.h:81
boost::shared_ptr< SurfelSmoothing< PointT, PointNT > > Ptr
PCL base class.
Definition: pcl_base.h:68
PointCloud represents the base class in PCL for storing collections of 3D points. ...
pcl::PointCloud< PointT >::Ptr PointCloudInPtr
void extractSalientFeaturesBetweenScales(PointCloudInPtr &cloud2, NormalCloudPtr &cloud2_normals, boost::shared_ptr< std::vector< int > > &output_features)
pcl::PointCloud< PointNT > NormalCloud
boost::shared_ptr< const SurfelSmoothing< PointT, PointNT > > ConstPtr
A point structure representing Euclidean xyz coordinates, and the RGB color.
void setSearchMethod(const CloudKdTreePtr &a_tree)
pcl::PointCloud< PointNT >::Ptr NormalCloudPtr
pcl::search::Search< PointT > CloudKdTree
Generic search class.
Definition: search.h:74