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