TEST (PCL, GFPFH) { PointCloud<PointXYZL>::Ptr cloud (new PointCloud<PointXYZL>()); const unsigned num_classes = 3; // Build a cubic shape with a hole and changing labels. for (int z = -10; z < 10; ++z) for (int y = -10; y < 10; ++y) for (int x = -10; x < 10; ++x) { if (x >= -9 && x < 9 && y >= -9 && y < 9 && z >= -9 && z < 9) continue; unsigned label = 1 + (std::abs (x+y+z) % num_classes); PointXYZL p; p.label = label; p.x = static_cast<float> (x); p.y = static_cast<float> (y); p.z = static_cast<float> (z); cloud->points.push_back (p); } cloud->width = static_cast<uint32_t> (cloud->points.size ()); cloud->height = 1; GFPFHEstimation<PointXYZL, PointXYZL, GFPFHSignature16> gfpfh; gfpfh.setNumberOfClasses (num_classes); gfpfh.setOctreeLeafSize (2); gfpfh.setInputCloud (cloud); gfpfh.setInputLabels (cloud); PointCloud<GFPFHSignature16> descriptor; gfpfh.compute (descriptor); const float ref_values[] = { 1877, 6375, 5361, 14393, 6674, 2471, 2248, 2753, 3117, 4585, 14388, 32407, 15122, 3061, 3202, 794 }; EXPECT_EQ (descriptor.points.size (), 1); for (size_t i = 0; i < size_t (descriptor.points[0].descriptorSize ()); ++i) { EXPECT_EQ (descriptor.points[0].histogram[i], ref_values[i]); } }
TEST (PCL, GFPFH) { PointCloud<PointXYZL>::Ptr cloud (new PointCloud<PointXYZL>()); const unsigned num_classes = 3; // Build a cubic shape with a hole and changing labels. for (int z = -10; z < 10; ++z) for (int y = -10; y < 10; ++y) for (int x = -10; x < 10; ++x) { if (x >= -9 && x < 9 && y >= -9 && y < 9 && z >= -9 && z < 9) continue; unsigned label = 1 + (std::abs (x+y+z) % num_classes); PointXYZL p; p.label = label; p.x = static_cast<float> (x); p.y = static_cast<float> (y); p.z = static_cast<float> (z); cloud->points.push_back (p); } cloud->width = static_cast<uint32_t> (cloud->points.size ()); cloud->height = 1; GFPFHEstimation<PointXYZL, PointXYZL, GFPFHSignature16> gfpfh; gfpfh.setNumberOfClasses (num_classes); gfpfh.setOctreeLeafSize (2); gfpfh.setInputCloud (cloud); gfpfh.setInputLabels (cloud); PointCloud<GFPFHSignature16> descriptor; gfpfh.compute (descriptor); const float ref_values[] = { 3216, 7760, 8740, 26584, 4645, 2995, 3029, 4349, 6192, 5440, 9514, 47563, 21814, 22073, 5734, 1253 }; EXPECT_EQ (descriptor.points.size (), 1); for (size_t i = 0; i < size_t (descriptor.points[0].descriptorSize ()); ++i) { EXPECT_EQ (descriptor.points[0].histogram[i], ref_values[i]); } }