Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef PCL_GAUSSIAN_KERNEL_IMPL
00041 #define PCL_GAUSSIAN_KERNEL_IMPL
00042
00043 #include <pcl/exceptions.h>
00044
00045 template <typename PointT> void
00046 pcl::GaussianKernel::convolveRows(const pcl::PointCloud<PointT> &input,
00047 boost::function <float (const PointT& p)> field_accessor,
00048 const Eigen::VectorXf& kernel,
00049 pcl::PointCloud<float> &output) const
00050 {
00051 assert(kernel.size () % 2 == 1);
00052 int kernel_width = kernel.size () -1;
00053 int radius = kernel.size () / 2.0;
00054 if(output.height < input.height || output.width < input.width)
00055 {
00056 output.width = input.width;
00057 output.height = input.height;
00058 output.points.resize (input.height * input.width);
00059 }
00060
00061 int i;
00062 for(int j = 0; j < input.height; j++)
00063 {
00064 for (i = 0 ; i < radius ; i++)
00065 output (i,j) = 0;
00066
00067 for ( ; i < input.width - radius ; i++) {
00068 output (i,j) = 0;
00069 for (int k = kernel_width, l = i - radius; k >= 0 ; k--, l++)
00070 output (i,j) += field_accessor (input (l,j)) * kernel[k];
00071 }
00072
00073 for ( ; i < input.width ; i++)
00074 output (i,j) = 0;
00075 }
00076 }
00077
00078 template <typename PointT> void
00079 pcl::GaussianKernel::convolveCols(const pcl::PointCloud<PointT> &input,
00080 boost::function <float (const PointT& p)> field_accessor,
00081 const Eigen::VectorXf& kernel,
00082 pcl::PointCloud<float> &output) const
00083 {
00084 assert(kernel.size () % 2 == 1);
00085 int kernel_width = kernel.size () -1;
00086 int radius = kernel.size () / 2.0;
00087 if(output.height < input.height || output.width < input.width)
00088 {
00089 output.width = input.width;
00090 output.height = input.height;
00091 output.points.resize (input.height * input.width);
00092 }
00093
00094 int j;
00095 for(int i = 0; i < input.width; i++)
00096 {
00097 for (j = 0 ; j < radius ; j++)
00098 output (i,j) = 0;
00099
00100 for ( ; j < input.height - radius ; j++) {
00101 output (i,j) = 0;
00102 for (int k = kernel_width, l = j - radius ; k >= 0 ; k--, l++)
00103 {
00104 output (i,j) += field_accessor (input (i,l)) * kernel[k];
00105 }
00106 }
00107
00108 for ( ; j < input.height ; j++)
00109 output (i,j) = 0;
00110 }
00111 }
00112
00113 #endif