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