Point Cloud Library (PCL)  1.14.1-dev
progressive_morphological_filter.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2009-2012, Willow Garage, Inc.
6  * Copyright (c) 2012-, Open Perception, Inc.
7  * Copyright (c) 2014, RadiantBlue Technologies, Inc.
8  *
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  *
15  * * Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  * * Redistributions in binary form must reproduce the above
18  * copyright notice, this list of conditions and the following
19  * disclaimer in the documentation and/or other materials provided
20  * with the distribution.
21  * * Neither the name of the copyright holder(s) nor the names of its
22  * contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #pragma once
40 
41 #include <pcl/pcl_base.h>
42 #include <pcl/point_cloud.h>
43 #include <pcl/point_types.h>
44 
45 namespace pcl
46 {
47  /** \brief
48  * Implements the Progressive Morphological Filter for segmentation of ground points.
49  * Description can be found in the article
50  * "A Progressive Morphological Filter for Removing Nonground Measurements from
51  * Airborne LIDAR Data"
52  * by K. Zhang, S. Chen, D. Whitman, M. Shyu, J. Yan, and C. Zhang.
53  */
54  template <typename PointT>
56  {
57  public:
58 
60 
65 
66  public:
67 
68  /** \brief Constructor that sets default values for member variables. */
70 
71 
73 
74  /** \brief Get the maximum window size to be used in filtering ground returns. */
75  inline int
76  getMaxWindowSize () const { return (max_window_size_); }
77 
78  /** \brief Set the maximum window size to be used in filtering ground returns. */
79  inline void
80  setMaxWindowSize (int max_window_size) { max_window_size_ = max_window_size; }
81 
82  /** \brief Get the slope value to be used in computing the height threshold. */
83  inline float
84  getSlope () const { return (slope_); }
85 
86  /** \brief Set the slope value to be used in computing the height threshold. */
87  inline void
88  setSlope (float slope) { slope_ = slope; }
89 
90  /** \brief Get the maximum height above the parameterized ground surface to be considered a ground return. */
91  inline float
92  getMaxDistance () const { return (max_distance_); }
93 
94  /** \brief Set the maximum height above the parameterized ground surface to be considered a ground return. */
95  inline void
96  setMaxDistance (float max_distance) { max_distance_ = max_distance; }
97 
98  /** \brief Get the initial height above the parameterized ground surface to be considered a ground return. */
99  inline float
100  getInitialDistance () const { return (initial_distance_); }
101 
102  /** \brief Set the initial height above the parameterized ground surface to be considered a ground return. */
103  inline void
104  setInitialDistance (float initial_distance) { initial_distance_ = initial_distance; }
105 
106  /** \brief Get the cell size. */
107  inline float
108  getCellSize () const { return (cell_size_); }
109 
110  /** \brief Set the cell size. */
111  inline void
112  setCellSize (float cell_size) { cell_size_ = cell_size; }
113 
114  /** \brief Get the base to be used in computing progressive window sizes. */
115  inline float
116  getBase () const { return (base_); }
117 
118  /** \brief Set the base to be used in computing progressive window sizes. */
119  inline void
120  setBase (float base) { base_ = base; }
121 
122  /** \brief Get flag indicating whether or not to exponentially grow window sizes? */
123  inline bool
124  getExponential () const { return (exponential_); }
125 
126  /** \brief Set flag indicating whether or not to exponentially grow window sizes? */
127  inline void
128  setExponential (bool exponential) { exponential_ = exponential; }
129 
130  /** \brief This method launches the segmentation algorithm and returns indices of
131  * points determined to be ground returns.
132  * \param[out] ground indices of points determined to be ground returns.
133  */
134  virtual void
135  extract (Indices& ground);
136 
137  protected:
138 
139  /** \brief Maximum window size to be used in filtering ground returns. */
140  int max_window_size_{33};
141 
142  /** \brief Slope value to be used in computing the height threshold. */
143  float slope_{0.7f};
144 
145  /** \brief Maximum height above the parameterized ground surface to be considered a ground return. */
146  float max_distance_{10.0f};
147 
148  /** \brief Initial height above the parameterized ground surface to be considered a ground return. */
149  float initial_distance_{0.15f};
150 
151  /** \brief Cell size. */
152  float cell_size_{1.0f};
153 
154  /** \brief Base to be used in computing progressive window sizes. */
155  float base_{2.0f};
156 
157  /** \brief Exponentially grow window sizes? */
158  bool exponential_{true};
159  };
160 }
161 
162 #ifdef PCL_NO_PRECOMPILE
163 #include <pcl/segmentation/impl/progressive_morphological_filter.hpp>
164 #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
Implements the Progressive Morphological Filter for segmentation of ground points.
void setExponential(bool exponential)
Set flag indicating whether or not to exponentially grow window sizes?
bool getExponential() const
Get flag indicating whether or not to exponentially grow window sizes?
void setMaxWindowSize(int max_window_size)
Set the maximum window size to be used in filtering ground returns.
void setSlope(float slope)
Set the slope value to be used in computing the height threshold.
float getMaxDistance() const
Get the maximum height above the parameterized ground surface to be considered a ground return.
void setCellSize(float cell_size)
Set the cell size.
float getBase() const
Get the base to be used in computing progressive window sizes.
ProgressiveMorphologicalFilter()
Constructor that sets default values for member variables.
float getSlope() const
Get the slope value to be used in computing the height threshold.
void setBase(float base)
Set the base to be used in computing progressive window sizes.
int getMaxWindowSize() const
Get the maximum window size to be used in filtering ground returns.
void setMaxDistance(float max_distance)
Set the maximum height above the parameterized ground surface to be considered a ground return.
float getInitialDistance() const
Get the initial height above the parameterized ground surface to be considered a ground return.
void setInitialDistance(float initial_distance)
Set the initial height above the parameterized ground surface to be considered a ground return.
Defines all the PCL implemented PointT point type structures.
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition: types.h:133
#define PCL_EXPORTS
Definition: pcl_macros.h:323