38 #ifndef PCL_2D_CONVOLUTION_IMPL_HPP 39 #define PCL_2D_CONVOLUTION_IMPL_HPP 42 template <
typename Po
intT>
void 50 int iw = static_cast<int> (input_->width),
51 ih = static_cast<int> (input_->height),
52 kw = static_cast<int> (kernel_.width),
53 kh = static_cast<int> (kernel_.height);
54 switch (boundary_options_)
57 case BOUNDARY_OPTION_CLAMP:
59 for (
int i = 0; i < ih; i++)
61 for (
int j = 0; j < iw; j++)
64 for (
int k = 0; k < kh; k++)
66 for (
int l = 0; l < kw; l++)
68 int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2;
83 intensity += kernel_ (l, k).intensity * (*input_)(input_col, input_row).intensity;
86 output (j, i).intensity = intensity;
92 case BOUNDARY_OPTION_MIRROR:
94 for (
int i = 0; i < ih; i++)
96 for (
int j = 0; j < iw; j++)
99 for (
int k = 0; k < kh; k++)
101 for (
int l = 0; l < kw; l++)
103 int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2;
105 input_row = -ikkh - 1;
107 input_row = 2 * ih - 1 - ikkh;
112 input_col = -jlkw - 1;
114 input_col = 2 * iw - 1 - jlkw;
118 intensity += kernel_ (l, k).intensity * ((*input_)(input_col, input_row).intensity);
121 output (j, i).intensity = intensity;
127 case BOUNDARY_OPTION_ZERO_PADDING:
129 for (
int i = 0; i < ih; i++)
131 for (
int j = 0; j < iw; j++)
134 for (
int k = 0; k < kh; k++)
136 for (
int l = 0; l < kw; l++)
138 int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2;
139 if (ikkh < 0 || ikkh >= ih || jlkw < 0 || jlkw >= iw)
142 intensity += kernel_ (l, k).intensity * ((*input_)(jlkw, ikkh).intensity);
145 output (j, i).intensity = intensity;
PointCloud represents the base class in PCL for storing collections of 3D points.
void filter(pcl::PointCloud< PointT > &output)
Performs 2D convolution of the input point cloud with the kernel.