TEST(PCA, projection) { pcl::PointXYZ projected, reconstructed; for(size_t i = 0; i < cloud.size(); i++) { pca.project (cloud[i], projected); pca.reconstruct (projected, reconstructed); EXPECT_NEAR_VECTORS (reconstructed.getVector3fMap (), cloud[i].getVector3fMap (), 2.5e-4); } }
TEST(PCA, projection) { pcl::PointXYZ projected, reconstructed; for(const auto &point : cloud) { pca.project (point, projected); pca.reconstruct (projected, reconstructed); EXPECT_NEAR_VECTORS (reconstructed.getVector3fMap (), point.getVector3fMap (), 2.5e-4); } }
TEST(PCA, cloud_projection) { pcl::PointCloud<pcl::PointXYZ> cloud_projected, cloud_reconstructed; try { pca.project (cloud, cloud_projected); EXPECT_EQ (cloud.size (), cloud_projected.size ()); pca.reconstruct (cloud_projected, cloud_reconstructed); EXPECT_EQ (cloud_reconstructed.size (), cloud_projected.size ()); for(size_t i = 0; i < cloud.size(); i++) EXPECT_NEAR_VECTORS (cloud[i].getVector3fMap (), cloud_reconstructed[i].getVector3fMap (), 2.5e-4); } catch (pcl::InitFailedException &e) { std::cerr << "something wrong" << std::endl; } }