Point Cloud Library (PCL)  1.7.2
approximate_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_APPROXIMATE_PROGRESSIVE_MORPHOLOGICAL_FILTER_H_
40 #define PCL_APPROXIMATE_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 ApproximateProgressiveMorphologicalFilter : 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 Initialize the scheduler and set the number of threads to use.
133  * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
134  */
135  inline void
136  setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
137 
138  /** \brief This method launches the segmentation algorithm and returns indices of
139  * points determined to be ground returns.
140  * \param[out] ground indices of points determined to be ground returns.
141  */
142  virtual void
143  extract (std::vector<int>& ground);
144 
145  protected:
146 
147  /** \brief Maximum window size to be used in filtering ground returns. */
149 
150  /** \brief Slope value to be used in computing the height threshold. */
151  float slope_;
152 
153  /** \brief Maximum height above the parameterized ground surface to be considered a ground return. */
155 
156  /** \brief Initial height above the parameterized ground surface to be considered a ground return. */
158 
159  /** \brief Cell size. */
160  float cell_size_;
161 
162  /** \brief Base to be used in computing progressive window sizes. */
163  float base_;
164 
165  /** \brief Exponentially grow window sizes? */
167 
168  /** \brief Number of threads to be used. */
169  unsigned int threads_;
170  };
171 }
172 
173 #ifdef PCL_NO_PRECOMPILE
174 #include <pcl/segmentation/impl/approximate_progressive_morphological_filter.hpp>
175 #endif
176 
177 #endif
178 
float getInitialDistance() const
Get the initial height above the parameterized ground surface to be considered a ground return...
float max_distance_
Maximum height above the parameterized ground surface to be considered a ground return.
float getBase() const
Get the base to be used in computing progressive window sizes.
void setInitialDistance(float initial_distance)
Set the initial height above the parameterized ground surface to be considered a ground return...
bool getExponential() const
Get flag indicating whether or not to exponentially grow window sizes?
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
float slope_
Slope value to be used in computing the height threshold.
void setMaxDistance(float max_distance)
Set the maximum height above the parameterized ground surface to be considered a ground return...
int max_window_size_
Maximum window size to be used in filtering ground returns.
float initial_distance_
Initial height above the parameterized ground surface to be considered a ground return.
float getMaxDistance() const
Get the maximum height above the parameterized ground surface to be considered a ground return...
PCL base class.
Definition: pcl_base.h:68
void setSlope(float slope)
Set the slope value to be used in computing the height threshold.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
void setMaxWindowSize(int max_window_size)
Set the 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.
float base_
Base to be used in computing progressive window sizes.
float getSlope() const
Get the slope value to be used in computing the height threshold.
void setExponential(bool exponential)
Set flag indicating whether or not to exponentially grow window sizes?
Implements the Progressive Morphological Filter for segmentation of ground points.
int getMaxWindowSize() const
Get the maximum window size to be used in filtering ground returns.