Point Cloud Library (PCL)  1.11.1
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/search/search.h>
43 #include <pcl/point_cloud.h>
44 #include <pcl/point_types.h>
45 
46 namespace pcl
47 {
48  /** \brief
49  * Implements the Progressive Morphological Filter for segmentation of ground points.
50  * Description can be found in the article
51  * "A Progressive Morphological Filter for Removing Nonground Measurements from
52  * Airborne LIDAR Data"
53  * by K. Zhang, S. Chen, D. Whitman, M. Shyu, J. Yan, and C. Zhang.
54  */
55  template <typename PointT>
57  {
58  public:
59 
61 
66 
67  public:
68 
69  /** \brief Constructor that sets default values for member variables. */
71 
72 
74 
75  /** \brief Get the maximum window size to be used in filtering ground returns. */
76  inline int
77  getMaxWindowSize () const { return (max_window_size_); }
78 
79  /** \brief Set the maximum window size to be used in filtering ground returns. */
80  inline void
81  setMaxWindowSize (int max_window_size) { max_window_size_ = max_window_size; }
82 
83  /** \brief Get the slope value to be used in computing the height threshold. */
84  inline float
85  getSlope () const { return (slope_); }
86 
87  /** \brief Set the slope value to be used in computing the height threshold. */
88  inline void
89  setSlope (float slope) { slope_ = slope; }
90 
91  /** \brief Get the maximum height above the parameterized ground surface to be considered a ground return. */
92  inline float
93  getMaxDistance () const { return (max_distance_); }
94 
95  /** \brief Set the maximum height above the parameterized ground surface to be considered a ground return. */
96  inline void
97  setMaxDistance (float max_distance) { max_distance_ = max_distance; }
98 
99  /** \brief Get the initial height above the parameterized ground surface to be considered a ground return. */
100  inline float
101  getInitialDistance () const { return (initial_distance_); }
102 
103  /** \brief Set the initial height above the parameterized ground surface to be considered a ground return. */
104  inline void
105  setInitialDistance (float initial_distance) { initial_distance_ = initial_distance; }
106 
107  /** \brief Get the cell size. */
108  inline float
109  getCellSize () const { return (cell_size_); }
110 
111  /** \brief Set the cell size. */
112  inline void
113  setCellSize (float cell_size) { cell_size_ = cell_size; }
114 
115  /** \brief Get the base to be used in computing progressive window sizes. */
116  inline float
117  getBase () const { return (base_); }
118 
119  /** \brief Set the base to be used in computing progressive window sizes. */
120  inline void
121  setBase (float base) { base_ = base; }
122 
123  /** \brief Get flag indicating whether or not to exponentially grow window sizes? */
124  inline bool
125  getExponential () const { return (exponential_); }
126 
127  /** \brief Set flag indicating whether or not to exponentially grow window sizes? */
128  inline void
129  setExponential (bool exponential) { exponential_ = exponential; }
130 
131  /** \brief This method launches the segmentation algorithm and returns indices of
132  * points determined to be ground returns.
133  * \param[out] ground indices of points determined to be ground returns.
134  */
135  virtual void
136  extract (std::vector<int>& ground);
137 
138  protected:
139 
140  /** \brief Maximum window size to be used in filtering ground returns. */
142 
143  /** \brief Slope value to be used in computing the height threshold. */
144  float slope_;
145 
146  /** \brief Maximum height above the parameterized ground surface to be considered a ground return. */
148 
149  /** \brief Initial height above the parameterized ground surface to be considered a ground return. */
151 
152  /** \brief Cell size. */
153  float cell_size_;
154 
155  /** \brief Base to be used in computing progressive window sizes. */
156  float base_;
157 
158  /** \brief Exponentially grow window sizes? */
160  };
161 }
162 
163 #ifdef PCL_NO_PRECOMPILE
164 #include <pcl/segmentation/impl/progressive_morphological_filter.hpp>
165 #endif
PCL base class.
Definition: pcl_base.h:73
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: point_cloud.h:181
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 slope_
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 base_
Base to be used in computing progressive window sizes.
float max_distance_
Maximum height above the parameterized ground surface to be considered a ground return.
float initial_distance_
Initial height above the parameterized ground surface to be considered a ground return.
bool exponential_
Exponentially grow window sizes?
float getBase() const
Get the base to be used in computing progressive window sizes.
float getSlope() const
Get the slope value to be used in computing the height threshold.
int max_window_size_
Maximum window size to be used in filtering ground returns.
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.
#define PCL_EXPORTS
Definition: pcl_macros.h:328