Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
surfel_smoothing.h
Go to the documentation of this file.
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: surfel_smoothing.h 5060 2012-03-14 02:19:39Z rusu $
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:
59 
60  SurfelSmoothing (float a_scale = 0.01)
61  : PCLBase<PointT> ()
62  , scale_ (a_scale)
63  , scale_squared_ (a_scale * a_scale)
64  , normals_ ()
65  , interm_cloud_ ()
66  , interm_normals_ ()
67  , tree_ ()
68  {
69  }
70 
71  void
72  setInputNormals (NormalCloudPtr &a_normals) { normals_ = a_normals; };
73 
74  void
75  setSearchMethod (const CloudKdTreePtr &a_tree) { tree_ = a_tree; };
76 
77  bool
78  initCompute ();
79 
80  float
81  smoothCloudIteration (PointCloudInPtr &output_positions,
82  NormalCloudPtr &output_normals);
83 
84  void
85  computeSmoothedCloud (PointCloudInPtr &output_positions,
86  NormalCloudPtr &output_normals);
87 
88 
89  void
90  smoothPoint (size_t &point_index,
91  PointT &output_point,
92  PointNT &output_normal);
93 
94  void
96  NormalCloudPtr &cloud2_normals,
97  boost::shared_ptr<std::vector<int> > &output_features);
98 
99  private:
100  float scale_, scale_squared_;
101  NormalCloudPtr normals_;
102 
103  PointCloudInPtr interm_cloud_;
104  NormalCloudPtr interm_normals_;
105 
106  CloudKdTreePtr tree_;
107 
108  };
109 }
110 
111 #endif /* PCL_SURFEL_SMOOTHING_H_ */