Point Cloud Library (PCL)
1.15.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
2d
morphology.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2012-, Open Perception, Inc.
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of the copyright holder(s) nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
*/
37
38
#pragma once
39
40
#include <pcl/pcl_base.h>
41
42
namespace
pcl
{
43
44
template
<
typename
Po
int
T>
45
class
Morphology
:
public
PCLBase
<PointT> {
46
private
:
47
using
PointCloudIn =
pcl::PointCloud<PointT>
;
48
using
PointCloudInPtr =
typename
PointCloudIn::Ptr
;
49
50
PointCloudInPtr structuring_element_;
51
52
public
:
53
using
PCLBase
<PointT>
::input_
;
54
55
Morphology
() =
default
;
56
57
/** \brief This function performs erosion followed by dilation.
58
* It is useful for removing noise in the form of small blobs and patches.
59
* \param[out] output Output point cloud passed by reference
60
*/
61
void
62
openingBinary
(
pcl::PointCloud<PointT>
& output);
63
64
/** \brief This function performs dilation followed by erosion.
65
* It is useful for filling up (holes/cracks/small discontinuities) in a binary
66
* segmented region
67
* \param[out] output Output point cloud passed by reference
68
*/
69
void
70
closingBinary
(
pcl::PointCloud<PointT>
& output);
71
72
/** \brief Binary dilation is similar to a logical disjunction of sets.
73
* At each pixel having value 1, if for all pixels in the structuring element having
74
* value 1, the corresponding pixels in the input image are also 1, the center pixel
75
* is set to 1. Otherwise, it is set to 0.
76
*
77
* \param[out] output Output point cloud passed by reference
78
*/
79
void
80
erosionBinary
(
pcl::PointCloud<PointT>
& output);
81
82
/** \brief Binary erosion is similar to a logical addition of sets.
83
* At each pixel having value 1, if at least one pixel in the structuring element is
84
* 1 and the corresponding point in the input image is 1, the center pixel is set
85
* to 1. Otherwise, it is set to 0.
86
*
87
* \param[out] output Output point cloud passed by reference
88
*/
89
void
90
dilationBinary
(
pcl::PointCloud<PointT>
& output);
91
92
/** \brief Grayscale erosion followed by dilation.
93
* This is used to remove small bright artifacts from the image. Large bright objects
94
* are relatively undisturbed.
95
*
96
* \param[out] output Output point cloud passed by reference
97
*/
98
void
99
openingGray
(
pcl::PointCloud<PointT>
& output);
100
101
/** \brief Grayscale dilation followed by erosion.
102
* This is used to remove small dark artifacts from the image. Bright features or
103
* large dark features are relatively undisturbed.
104
*
105
* \param[out] output Output point cloud passed by reference
106
*/
107
void
108
closingGray
(
pcl::PointCloud<PointT>
& output);
109
110
/** \brief Takes the min of the pixels where kernel is 1
111
* \param[out] output Output point cloud passed by reference
112
*/
113
void
114
erosionGray
(
pcl::PointCloud<PointT>
& output);
115
116
/** \brief Takes the max of the pixels where kernel is 1
117
* \param[out] output Output point cloud passed by reference
118
*/
119
void
120
dilationGray
(
pcl::PointCloud<PointT>
& output);
121
122
/** \brief Set operation
123
* output = input1 - input2
124
* \param[out] output Output point cloud passed by reference
125
* \param[in] input1
126
* \param[in] input2
127
*/
128
void
129
subtractionBinary
(
pcl::PointCloud<PointT>
& output,
130
const
pcl::PointCloud<PointT>
& input1,
131
const
pcl::PointCloud<PointT>
& input2);
132
133
/** \brief Set operation
134
* \f$output = input1 \cup input2\f$
135
* \param[out] output Output point cloud passed by reference
136
* \param[in] input1
137
* \param[in] input2
138
*/
139
void
140
unionBinary
(
pcl::PointCloud<PointT>
& output,
141
const
pcl::PointCloud<PointT>
& input1,
142
const
pcl::PointCloud<PointT>
& input2);
143
144
/** \brief Set operation \f$ output = input1 \cap input2 \f$
145
* \param[out] output Output point cloud passed by reference
146
* \param[in] input1
147
* \param[in] input2
148
*/
149
void
150
intersectionBinary
(
pcl::PointCloud<PointT>
& output,
151
const
pcl::PointCloud<PointT>
& input1,
152
const
pcl::PointCloud<PointT>
& input2);
153
154
/** \brief Creates a circular structing element. The size of the kernel created is
155
* 2*radius x 2*radius. Center of the structuring element is the center of the circle.
156
* All values lying on the circle are 1 and the others are 0.
157
*
158
* \param[out] kernel structuring element kernel passed by reference
159
* \param[in] radius Radius of the circular structuring element.
160
*/
161
void
162
structuringElementCircular
(
pcl::PointCloud<PointT>
&
kernel
,
const
int
radius);
163
164
/** \brief Creates a rectangular structing element of size height x width. *
165
* All values are 1.
166
*
167
* \param[out] kernel structuring element kernel passed by reference
168
* \param[in] height height number of rows in the structuring element
169
* \param[in] width number of columns in the structuring element
170
*
171
*/
172
void
173
structuringElementRectangle
(
pcl::PointCloud<PointT>
&
kernel
,
174
const
int
height,
175
const
int
width);
176
177
enum
MORPHOLOGICAL_OPERATOR_TYPE
{
178
EROSION_GRAY
,
179
DILATION_GRAY
,
180
OPENING_GRAY
,
181
CLOSING_GRAY
,
182
EROSION_BINARY
,
183
DILATION_BINARY
,
184
OPENING_BINARY
,
185
CLOSING_BINARY
186
};
187
188
MORPHOLOGICAL_OPERATOR_TYPE
operator_type
;
189
190
/**
191
* \param[out] output Output point cloud passed by reference
192
*/
193
void
194
applyMorphologicalOperation
(
pcl::PointCloud<PointT>
& output);
195
196
/**
197
* \param[in] structuring_element The structuring element to be used for the
198
* morphological operation
199
*/
200
void
201
setStructuringElement
(
const
PointCloudInPtr& structuring_element);
202
};
203
204
}
// namespace pcl
205
206
#include <pcl/2d/impl/morphology.hpp>
pcl::Morphology::dilationBinary
void dilationBinary(pcl::PointCloud< PointT > &output)
Binary erosion is similar to a logical addition of sets.
Definition
morphology.hpp:98
pcl::Morphology::subtractionBinary
void subtractionBinary(pcl::PointCloud< PointT > &output, const pcl::PointCloud< PointT > &input1, const pcl::PointCloud< PointT > &input2)
Set operation output = input1 - input2.
Definition
morphology.hpp:269
pcl::Morphology::Morphology
Morphology()=default
pcl::Morphology::erosionGray
void erosionGray(pcl::PointCloud< PointT > &output)
Takes the min of the pixels where kernel is 1.
Definition
morphology.hpp:164
pcl::Morphology::openingBinary
void openingBinary(pcl::PointCloud< PointT > &output)
This function performs erosion followed by dilation.
Definition
morphology.hpp:143
pcl::Morphology::erosionBinary
void erosionBinary(pcl::PointCloud< PointT > &output)
Binary dilation is similar to a logical disjunction of sets.
Definition
morphology.hpp:47
pcl::Morphology::setStructuringElement
void setStructuringElement(const PointCloudInPtr &structuring_element)
Definition
morphology.hpp:362
pcl::Morphology::closingGray
void closingGray(pcl::PointCloud< PointT > &output)
Grayscale dilation followed by erosion.
Definition
morphology.hpp:259
pcl::Morphology::closingBinary
void closingBinary(pcl::PointCloud< PointT > &output)
This function performs dilation followed by erosion.
Definition
morphology.hpp:154
pcl::Morphology::intersectionBinary
void intersectionBinary(pcl::PointCloud< PointT > &output, const pcl::PointCloud< PointT > &input1, const pcl::PointCloud< PointT > &input2)
Set operation .
Definition
morphology.hpp:309
pcl::Morphology::unionBinary
void unionBinary(pcl::PointCloud< PointT > &output, const pcl::PointCloud< PointT > &input1, const pcl::PointCloud< PointT > &input2)
Set operation .
Definition
morphology.hpp:289
pcl::Morphology::structuringElementRectangle
void structuringElementRectangle(pcl::PointCloud< PointT > &kernel, const int height, const int width)
Creates a rectangular structing element of size height x width.
Definition
morphology.hpp:349
pcl::Morphology::applyMorphologicalOperation
void applyMorphologicalOperation(pcl::PointCloud< PointT > &output)
pcl::Morphology::openingGray
void openingGray(pcl::PointCloud< PointT > &output)
Grayscale erosion followed by dilation.
Definition
morphology.hpp:249
pcl::Morphology::MORPHOLOGICAL_OPERATOR_TYPE
MORPHOLOGICAL_OPERATOR_TYPE
Definition
morphology.h:177
pcl::Morphology::CLOSING_GRAY
@ CLOSING_GRAY
Definition
morphology.h:181
pcl::Morphology::EROSION_BINARY
@ EROSION_BINARY
Definition
morphology.h:182
pcl::Morphology::OPENING_GRAY
@ OPENING_GRAY
Definition
morphology.h:180
pcl::Morphology::DILATION_GRAY
@ DILATION_GRAY
Definition
morphology.h:179
pcl::Morphology::DILATION_BINARY
@ DILATION_BINARY
Definition
morphology.h:183
pcl::Morphology::EROSION_GRAY
@ EROSION_GRAY
Definition
morphology.h:178
pcl::Morphology::CLOSING_BINARY
@ CLOSING_BINARY
Definition
morphology.h:185
pcl::Morphology::OPENING_BINARY
@ OPENING_BINARY
Definition
morphology.h:184
pcl::Morphology::structuringElementCircular
void structuringElementCircular(pcl::PointCloud< PointT > &kernel, const int radius)
Creates a circular structing element.
Definition
morphology.hpp:329
pcl::Morphology::operator_type
MORPHOLOGICAL_OPERATOR_TYPE operator_type
Definition
morphology.h:188
pcl::Morphology::dilationGray
void dilationGray(pcl::PointCloud< PointT > &output)
Takes the max of the pixels where kernel is 1.
Definition
morphology.hpp:206
pcl::PCLBase::input_
PointCloudConstPtr input_
The input point cloud dataset.
Definition
pcl_base.h:147
pcl::PCLBase::PCLBase
PCLBase()
Empty constructor.
Definition
pcl_base.hpp:46
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition
point_cloud.h:174
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition
point_cloud.h:414
pcl::kernel
Definition
kernel.h:46
pcl
Definition
convolution.h:46