Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
filters
grid_minimum.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
* $Id$
39
*
40
*/
41
42
#pragma once
43
44
#include <pcl/filters/filter.h>
45
#include <pcl/filters/filter_indices.h>
46
47
namespace
pcl
48
{
49
/** \brief GridMinimum assembles a local 2D grid over a given PointCloud, and downsamples the data.
50
*
51
* The GridMinimum class creates a *2D grid* over the input point cloud
52
* data. Then, in each *cell* (i.e., 2D grid element), all the points
53
* present will be *downsampled* with the minimum z value. This grid minimum
54
* can be useful in a number of topographic processing tasks such as crudely
55
* estimating ground returns, especially under foliage.
56
*
57
* \author Bradley J Chambers
58
* \ingroup filters
59
*/
60
template
<
typename
Po
int
T>
61
class
GridMinimum
:
public
FilterIndices
<PointT>
62
{
63
protected
:
64
using
Filter
<PointT>
::filter_name_
;
65
using
Filter
<PointT>
::getClassName
;
66
using
Filter
<PointT>
::input_
;
67
using
Filter
<PointT>
::indices_
;
68
69
using
PointCloud
=
typename
FilterIndices<PointT>::PointCloud
;
70
71
public
:
72
/** \brief Empty constructor. */
73
GridMinimum
(
const
float
resolution)
74
{
75
setResolution
(resolution);
76
filter_name_
=
"GridMinimum"
;
77
}
78
79
/** \brief Destructor. */
80
~GridMinimum
()
override
=
default
;
81
82
/** \brief Set the grid resolution.
83
* \param[in] resolution the grid resolution
84
*/
85
inline
void
86
setResolution
(
const
float
resolution)
87
{
88
resolution_
= resolution;
89
// Use multiplications instead of divisions
90
inverse_resolution_
= 1.0f /
resolution_
;
91
}
92
93
/** \brief Get the grid resolution. */
94
inline
float
95
getResolution
() {
return
(
resolution_
); }
96
97
protected
:
98
/** \brief The resolution. */
99
float
resolution_
;
100
101
/** \brief Internal resolution stored as 1/resolution_ for efficiency reasons. */
102
float
inverse_resolution_
;
103
104
/** \brief Downsample a Point Cloud using a 2D grid approach
105
* \param[out] output the resultant point cloud message
106
*/
107
void
108
applyFilter
(
PointCloud
&output)
override
;
109
110
/** \brief Filtered results are indexed by an indices array.
111
* \param[out] indices The resultant indices.
112
*/
113
void
114
applyFilter
(
Indices
&indices)
override
115
{
116
applyFilterIndices
(indices);
117
}
118
119
/** \brief Filtered results are indexed by an indices array.
120
* \param[out] indices The resultant indices.
121
*/
122
void
123
applyFilterIndices
(
Indices
&indices);
124
125
};
126
}
127
128
#ifdef PCL_NO_PRECOMPILE
129
#include <pcl/filters/impl/grid_minimum.hpp>
130
#endif
pcl::Filter
Filter represents the base filter class.
Definition
filter.h:81
pcl::Filter::getClassName
const std::string & getClassName() const
Get a string representation of the name of this class.
Definition
filter.h:174
pcl::Filter::filter_name_
std::string filter_name_
The filter name.
Definition
filter.h:158
pcl::FilterIndices::FilterIndices
FilterIndices(bool extract_removed_indices=false)
Constructor.
Definition
filter_indices.h:87
pcl::FilterIndices::PointCloud
pcl::PointCloud< PointT > PointCloud
Definition
filter_indices.h:78
pcl::GridMinimum::PointCloud
typename FilterIndices< PointT >::PointCloud PointCloud
Definition
grid_minimum.h:69
pcl::GridMinimum::setResolution
void setResolution(const float resolution)
Set the grid resolution.
Definition
grid_minimum.h:86
pcl::GridMinimum::GridMinimum
GridMinimum(const float resolution)
Empty constructor.
Definition
grid_minimum.h:73
pcl::GridMinimum::resolution_
float resolution_
The resolution.
Definition
grid_minimum.h:99
pcl::GridMinimum::applyFilterIndices
void applyFilterIndices(Indices &indices)
Filtered results are indexed by an indices array.
Definition
grid_minimum.hpp:81
pcl::GridMinimum::applyFilter
void applyFilter(Indices &indices) override
Filtered results are indexed by an indices array.
Definition
grid_minimum.h:114
pcl::GridMinimum::inverse_resolution_
float inverse_resolution_
Internal resolution stored as 1/resolution_ for efficiency reasons.
Definition
grid_minimum.h:102
pcl::GridMinimum::~GridMinimum
~GridMinimum() override=default
Destructor.
pcl::GridMinimum::applyFilter
void applyFilter(PointCloud &output) override
Downsample a Point Cloud using a 2D grid approach.
Definition
grid_minimum.hpp:61
pcl::GridMinimum::getResolution
float getResolution()
Get the grid resolution.
Definition
grid_minimum.h:95
pcl::PCLBase::input_
PointCloudConstPtr input_
The input point cloud dataset.
Definition
pcl_base.h:147
pcl::PCLBase::indices_
IndicesPtr indices_
A pointer to the vector of point indices to use.
Definition
pcl_base.h:150
pcl
Definition
convolution.h:46
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition
types.h:133