Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
filters
local_maximum.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_indices.h>
45
#include <pcl/search/search.h>
// for Search
46
47
namespace
pcl
48
{
49
/** \brief LocalMaximum downsamples the cloud, by eliminating points that are locally maximal.
50
*
51
* The LocalMaximum class analyzes each point and removes those that are
52
* found to be locally maximal with respect to their neighbors (found via
53
* radius search). The comparison is made in the z dimension only at this
54
* time.
55
*
56
* \author Bradley J Chambers
57
* \ingroup filters
58
*/
59
template
<
typename
Po
int
T>
60
class
LocalMaximum
:
public
FilterIndices
<PointT>
61
{
62
protected
:
63
using
PointCloud
=
typename
FilterIndices<PointT>::PointCloud
;
64
using
SearcherPtr
=
typename
pcl::search::Search<PointT>::Ptr
;
65
66
public
:
67
/** \brief Empty constructor. */
68
LocalMaximum
(
bool
extract_removed_indices =
false
) :
69
FilterIndices
<PointT>::
FilterIndices
(extract_removed_indices),
70
searcher_ ()
71
{
72
filter_name_
=
"LocalMaximum"
;
73
}
74
75
/** \brief Set the radius to use to determine if a point is the local max.
76
* \param[in] radius The radius to use to determine if a point is the local max.
77
*/
78
inline
void
79
setRadius
(
float
radius) { radius_ = radius; }
80
81
/** \brief Get the radius to use to determine if a point is the local max.
82
* \return The radius to use to determine if a point is the local max.
83
*/
84
inline
float
85
getRadius
()
const
{
return
(radius_); }
86
87
/** \brief Provide a pointer to the search object.
88
* Calling this is optional. If not called, the search method will be chosen automatically.
89
* \param[in] searcher a pointer to the spatial search object.
90
*/
91
inline
void
92
setSearchMethod
(
const
SearcherPtr
&searcher) { searcher_ = searcher; }
93
protected
:
94
using
PCLBase
<PointT>
::input_
;
95
using
PCLBase
<PointT>
::indices_
;
96
using
Filter
<PointT>
::filter_name_
;
97
using
Filter
<PointT>
::getClassName
;
98
using
FilterIndices
<PointT>
::negative_
;
99
using
FilterIndices
<PointT>
::extract_removed_indices_
;
100
using
FilterIndices
<PointT>
::removed_indices_
;
101
102
/** \brief Downsample a Point Cloud by eliminating points that are locally maximal in z
103
* \param[out] output the resultant point cloud message
104
*/
105
void
106
applyFilter
(
PointCloud
&output)
override
;
107
108
/** \brief Filtered results are indexed by an indices array.
109
* \param[out] indices The resultant indices.
110
*/
111
void
112
applyFilter
(
Indices
&indices)
override
113
{
114
applyFilterIndices
(indices);
115
}
116
117
/** \brief Filtered results are indexed by an indices array.
118
* \param[out] indices The resultant indices.
119
*/
120
void
121
applyFilterIndices
(
Indices
&indices);
122
123
private
:
124
/** \brief A pointer to the spatial search object. */
125
SearcherPtr
searcher_;
126
127
/** \brief The radius to use to determine if a point is the local max. */
128
float
radius_{1.0f};
129
};
130
}
131
132
#ifdef PCL_NO_PRECOMPILE
133
#include <pcl/filters/impl/local_maximum.hpp>
134
#endif
pcl::Filter
Filter represents the base filter class.
Definition
filter.h:81
pcl::Filter::extract_removed_indices_
bool extract_removed_indices_
Set to true if we want to return the indices of the removed points.
Definition
filter.h:161
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::Filter::removed_indices_
IndicesPtr removed_indices_
Indices of the points that are removed.
Definition
filter.h:155
pcl::FilterIndices
FilterIndices represents the base class for filters that are about binary point removal.
Definition
filter_indices.h:75
pcl::FilterIndices::FilterIndices
FilterIndices(bool extract_removed_indices=false)
Constructor.
Definition
filter_indices.h:87
pcl::FilterIndices::negative_
bool negative_
False = normal filter behavior (default), true = inverted behavior.
Definition
filter_indices.h:167
pcl::FilterIndices::PointCloud
pcl::PointCloud< PointT > PointCloud
Definition
filter_indices.h:78
pcl::LocalMaximum::LocalMaximum
LocalMaximum(bool extract_removed_indices=false)
Empty constructor.
Definition
local_maximum.h:68
pcl::LocalMaximum::setRadius
void setRadius(float radius)
Set the radius to use to determine if a point is the local max.
Definition
local_maximum.h:79
pcl::LocalMaximum::applyFilter
void applyFilter(PointCloud &output) override
Downsample a Point Cloud by eliminating points that are locally maximal in z.
Definition
local_maximum.hpp:54
pcl::LocalMaximum::getRadius
float getRadius() const
Get the radius to use to determine if a point is the local max.
Definition
local_maximum.h:85
pcl::LocalMaximum::SearcherPtr
typename pcl::search::Search< PointT >::Ptr SearcherPtr
Definition
local_maximum.h:64
pcl::LocalMaximum::applyFilterIndices
void applyFilterIndices(Indices &indices)
Filtered results are indexed by an indices array.
Definition
local_maximum.hpp:74
pcl::LocalMaximum::setSearchMethod
void setSearchMethod(const SearcherPtr &searcher)
Provide a pointer to the search object.
Definition
local_maximum.h:92
pcl::LocalMaximum::applyFilter
void applyFilter(Indices &indices) override
Filtered results are indexed by an indices array.
Definition
local_maximum.h:112
pcl::LocalMaximum::PointCloud
typename FilterIndices< PointT >::PointCloud PointCloud
Definition
local_maximum.h:63
pcl::PCLBase
PCL base class.
Definition
pcl_base.h:70
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::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition
point_cloud.h:174
pcl::search::Search::Ptr
shared_ptr< pcl::search::Search< PointT > > Ptr
Definition
search.h:81
pcl
Definition
convolution.h:46
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition
types.h:133