Point Cloud Library (PCL)  1.9.1-dev
local_maximum.h
1 /*
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2009-2012, Willow Garage, Inc.
6  * Copyright (c) 2012-, Open Perception, Inc.
8  *
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/pcl_search.h>
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 PointT>
60  class LocalMaximum: public FilterIndices<PointT>
61  {
62  protected:
65
66  public:
67  /** \brief Empty constructor. */
68  LocalMaximum (bool extract_removed_indices = false) :
69  FilterIndices<PointT>::FilterIndices (extract_removed_indices),
70  searcher_ (),
72  {
73  filter_name_ = "LocalMaximum";
74  }
75
76  /** \brief Set the radius to use to determine if a point is the local max.
77  * \param[in] radius The radius to use to determine if a point is the local max.
78  */
79  inline void
81
82  /** \brief Get the radius to use to determine if a point is the local max.
83  * \return The radius to use to determine if a point is the local max.
84  */
85  inline float
87
88  protected:
96
97  /** \brief Downsample a Point Cloud by eliminating points that are locally maximal in z
98  * \param[out] output the resultant point cloud message
99  */
100  void
101  applyFilter (PointCloud &output) override;
102
103  /** \brief Filtered results are indexed by an indices array.
104  * \param[out] indices The resultant indices.
105  */
106  void
107  applyFilter (std::vector<int> &indices) override
108  {
109  applyFilterIndices (indices);
110  }
111
112  /** \brief Filtered results are indexed by an indices array.
113  * \param[out] indices The resultant indices.
114  */
115  void
116  applyFilterIndices (std::vector<int> &indices);
117
118  private:
119  /** \brief A pointer to the spatial search object. */
120  SearcherPtr searcher_;
121
122  /** \brief The radius to use to determine if a point is the local max. */
124  };
125 }
126
127 #ifdef PCL_NO_PRECOMPILE
128 #include <pcl/filters/impl/local_maximum.hpp>
129 #endif
Set the radius to use to determine if a point is the local max.
Definition: local_maximum.h:80
FilterIndices< PointT >::PointCloud PointCloud
Definition: local_maximum.h:63
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:44
void applyFilter(PointCloud &output) override
Downsample a Point Cloud by eliminating points that are locally maximal in z.
LocalMaximum downsamples the cloud, by eliminating points that are locally maximal.
Definition: local_maximum.h:60
void applyFilter(std::vector< int > &indices) override
Filtered results are indexed by an indices array.
FilterIndices represents the base class for filters that are about binary point removal.
Filter represents the base filter class.
Definition: filter.h:83
boost::shared_ptr< pcl::search::Search< PointT > > Ptr
Definition: search.h:80
void applyFilterIndices(std::vector< int > &indices)
Filtered results are indexed by an indices array.
PCL base class.
Definition: pcl_base.h:68
pcl::search::Search< PointT >::Ptr SearcherPtr
Definition: local_maximum.h:64
PointCloud represents the base class in PCL for storing collections of 3D points. ...
std::string filter_name_
The filter name.
Definition: filter.h:165
A point structure representing Euclidean xyz coordinates, and the RGB color.
LocalMaximum(bool extract_removed_indices=false)
Empty constructor.
Definition: local_maximum.h:68