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
00038 #include <gtest/gtest.h>
00039 #include <pcl/common/gaussian.h>
00040
00041 TEST(PCL, GaussianKernel)
00042 {
00043 Eigen::VectorXf kernel(31);
00044 kernel << 0.000888059f, 0.00158611f, 0.00272177f, 0.00448744f, 0.00710844f, 0.0108188f, 0.0158201f, 0.0222264f, 0.0300025f, 0.0389112f, 0.0484864f, 0.0580487f, 0.0667719f, 0.0737944f, 0.0783576f, 0.0799405f, 0.0783576f, 0.0737944f, 0.0667719f, 0.0580487f, 0.0484864f, 0.0389112f, 0.0300025f, 0.0222264f, 0.0158201f, 0.0108188f, 0.00710844f, 0.00448744f, 0.00272177f, 0.00158611f, 0.000888059f;
00045
00046 Eigen::VectorXf derivative(35);
00047 derivative << 0.000168673f, 0.000307151f, 0.000535285f, 0.000892304f, 0.00142183f, 0.00216388f, 0.00314209f, 0.00434741f, 0.00572143f, 0.00714516f, 0.00843934f, 0.00938163f, 0.00974186f, 0.0093305f, 0.00804947f, 0.0059307f, 0.00314871f, 0.0f, -0.00314871f, -0.0059307f, -0.00804947f, -0.0093305f, -0.00974186f, -0.00938163f, -0.00843934f, -0.00714516f, -0.00572143f, -0.00434741f, -0.00314209f, -0.00216388f, -0.00142183f, -0.000892304f, -0.000535285f, -0.000307151f, -0.000168673f;
00048 pcl::GaussianKernel gk;
00049 Eigen::VectorXf computed_kernel, computed_derivative;
00050
00051
00052 gk.compute(5, computed_kernel);
00053 EXPECT_EQ(kernel.size (), computed_kernel.size ());
00054 for(int i = 0; i < kernel.size (); i++)
00055 EXPECT_NEAR(kernel[i], computed_kernel[i], 1e-4);
00056
00057
00058 gk.compute(5, computed_kernel, computed_derivative);
00059 EXPECT_EQ(kernel.size (), computed_kernel.size ());
00060 for(int i = 0; i < kernel.size (); i++)
00061 EXPECT_NEAR(kernel[i], computed_kernel[i], 1e-4);
00062 EXPECT_EQ(derivative.size (), computed_derivative.size ());
00063 for(int i = 0; i < derivative.size (); i++)
00064 EXPECT_NEAR(derivative[i], computed_derivative[i], 1e-4);
00065 }
00066
00067 int main (int argc, char** argv)
00068 {
00069 testing::InitGoogleTest (&argc, argv);
00070 return (RUN_ALL_TESTS ());
00071 }