Point Cloud Library (PCL) 1.12.1
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#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
46namespace 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
62 using PCLBase <PointT>::input_;
63 using PCLBase <PointT>::indices_;
64 using PCLBase <PointT>::initCompute;
65 using PCLBase <PointT>::deinitCompute;
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 Initialize the scheduler and set the number of threads to use.
132 * \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
133 */
134 inline void
135 setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
136
137 /** \brief This method launches the segmentation algorithm and returns indices of
138 * points determined to be ground returns.
139 * \param[out] ground indices of points determined to be ground returns.
140 */
141 virtual void
142 extract (Indices& ground);
143
144 protected:
145
146 /** \brief Maximum window size to be used in filtering ground returns. */
148
149 /** \brief Slope value to be used in computing the height threshold. */
150 float slope_;
151
152 /** \brief Maximum height above the parameterized ground surface to be considered a ground return. */
154
155 /** \brief Initial height above the parameterized ground surface to be considered a ground return. */
157
158 /** \brief Cell size. */
160
161 /** \brief Base to be used in computing progressive window sizes. */
162 float base_;
163
164 /** \brief Exponentially grow window sizes? */
166
167 /** \brief Number of threads to be used. */
168 unsigned int threads_;
169 };
170}
171
172#ifdef PCL_NO_PRECOMPILE
173#include <pcl/segmentation/impl/approximate_progressive_morphological_filter.hpp>
174#endif
Implements the Progressive Morphological Filter for segmentation of ground points.
void setMaxDistance(float max_distance)
Set the maximum 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.
int getMaxWindowSize() const
Get 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 getBase() const
Get the base to be used in computing progressive window sizes.
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
void setSlope(float slope)
Set the slope value to be used in computing the height threshold.
float initial_distance_
Initial 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 slope_
Slope value to be used in computing the height threshold.
float max_distance_
Maximum 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?
float getInitialDistance() const
Get the initial height above the parameterized ground surface to be considered a ground return.
void setMaxWindowSize(int max_window_size)
Set the maximum window size to be used in filtering ground returns.
void setInitialDistance(float initial_distance)
Set the initial height above the parameterized ground surface to be considered a ground return.
float getSlope() const
Get the slope value to be used in computing the height threshold.
float base_
Base to be used in computing progressive window sizes.
void setExponential(bool exponential)
Set flag indicating whether or not to exponentially grow window sizes?
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
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
A point structure representing Euclidean xyz coordinates, and the RGB color.