Point Cloud Library (PCL) 1.15.1-dev
Loading...
Searching...
No Matches
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
45namespace 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>
55 class PCL_EXPORTS ProgressiveMorphologicalFilter : public pcl::PCLBase<PointT>
56 {
57 public:
58
60
61 using PCLBase <PointT>::input_;
62 using PCLBase <PointT>::indices_;
63 using PCLBase <PointT>::initCompute;
64 using PCLBase <PointT>::deinitCompute;
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 * \return the maximum window size in the same units as the input cloud
76 * coordinates
77 */
78 inline float
79 getMaxWindowSize () const { return (max_window_size_); }
80
81 /** \brief Set the maximum window size to be used in filtering ground returns.
82 * \param[in] max_window_size the maximum window size in the same units as the
83 * input cloud coordinates
84 */
85 inline void
86 setMaxWindowSize (float max_window_size) { max_window_size_ = max_window_size; }
87
88 /** \brief Get the slope value to be used in computing the height threshold. */
89 inline float
90 getSlope () const { return (slope_); }
91
92 /** \brief Set the slope value to be used in computing the height threshold. */
93 inline void
94 setSlope (float slope) { slope_ = slope; }
95
96 /** \brief Get the maximum height above the parameterized ground surface to be considered a ground return. */
97 inline float
98 getMaxDistance () const { return (max_distance_); }
99
100 /** \brief Set the maximum height above the parameterized ground surface to be considered a ground return. */
101 inline void
102 setMaxDistance (float max_distance) { max_distance_ = max_distance; }
103
104 /** \brief Get the initial height above the parameterized ground surface to be considered a ground return. */
105 inline float
106 getInitialDistance () const { return (initial_distance_); }
107
108 /** \brief Set the initial height above the parameterized ground surface to be considered a ground return. */
109 inline void
110 setInitialDistance (float initial_distance) { initial_distance_ = initial_distance; }
111
112 /** \brief Get the cell size. */
113 inline float
114 getCellSize () const { return (cell_size_); }
115
116 /** \brief Set the cell size. */
117 inline void
118 setCellSize (float cell_size) { cell_size_ = cell_size; }
119
120 /** \brief Get the base to be used in computing progressive window sizes. */
121 inline float
122 getBase () const { return (base_); }
123
124 /** \brief Set the base to be used in computing progressive window sizes. */
125 inline void
126 setBase (float base) { base_ = base; }
127
128 /** \brief Get flag indicating whether or not to exponentially grow window sizes? */
129 inline bool
130 getExponential () const { return (exponential_); }
131
132 /** \brief Set flag indicating whether or not to exponentially grow window sizes? */
133 inline void
134 setExponential (bool exponential) { exponential_ = exponential; }
135
136 /** \brief This method launches the segmentation algorithm and returns indices of
137 * points determined to be ground returns.
138 * \param[out] ground indices of points determined to be ground returns.
139 */
140 virtual void
141 extract (Indices& ground);
142
143 protected:
144
145 /** \brief Maximum window size to be used in filtering ground returns, in the
146 * same units as the input cloud coordinates. */
147 float max_window_size_{33.0f};
148
149 /** \brief Slope value to be used in computing the height threshold. */
150 float slope_{0.7f};
151
152 /** \brief Maximum height above the parameterized ground surface to be considered a ground return. */
153 float max_distance_{10.0f};
154
155 /** \brief Initial height above the parameterized ground surface to be considered a ground return. */
156 float initial_distance_{0.15f};
157
158 /** \brief Cell size. */
159 float cell_size_{1.0f};
160
161 /** \brief Base to be used in computing progressive window sizes. */
162 float base_{2.0f};
163
164 /** \brief Exponentially grow window sizes? */
165 bool exponential_{true};
166 };
167}
168
169#ifdef PCL_NO_PRECOMPILE
170#include <pcl/segmentation/impl/progressive_morphological_filter.hpp>
171#endif
PCL base class.
Definition pcl_base.h:70
PointCloud represents the base class in PCL for storing collections of 3D points.
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(float max_window_size)
Set the maximum window size to be used in filtering ground returns.
float getMaxWindowSize() const
Get 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.
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
A point structure representing Euclidean xyz coordinates, and the RGB color.