点云特征值 (PCL)

问题描述 投票:0回答:1

我一直在关注教程http://pointclouds.org/documentation/tutorials/pcl_visualizer.php#pcl-visualizer并且可以让一个简单的查看器工作。

我查阅了文档,找到了函数

getMatrixXfMap
,它从
Eigen::MatrixXf
返回
PointCloud

// Get Eigen matrix
Eigen::MatrixXf M = basic_cloud_ptr->getMatrixXfMap();
cout << "(Eigen) #row :" << M.rows() << endl;
cout << "(Eigen) #col :" << M.cols() << endl;

接下来我处理

M
(基本上是旋转、平移和一些其他变换)。我如何有效地将
M
设置为
PointCloud
。还是我需要一次
pushback()
一点?

eigen point-cloud-library eigen3
1个回答
1
投票

您不需要将 pcl 云投射到

Eigen::MatrixXf
,进行转换并投射回来。您可以直接在输入云上简单地执行旋转和平移:

pcl::PointCloud<pcl::PointXYZ>::Ptr source_cloud (new pcl::PointCloud<pcl::PointXYZ> ());
// Fill the cloud
Eigen::Affine3f transform_2 = Eigen::Affine3f::Identity();
// Define a translation of 2.5 meters on the x axis.
transform_2.translation() << 2.5, 0.0, 0.0;
// The same rotation matrix as before; theta radians around Z axis
transform_2.rotate (Eigen::AngleAxisf (theta, Eigen::Vector3f::UnitZ()));
// Print the transformation
printf ("\nMethod #2: using an Affine3f\n");
std::cout << transform_2.matrix() << std::endl;
// Executing the transformation
pcl::PointCloud<pcl::PointXYZ>::Ptr transformed_cloud (new pcl::PointCloud<pcl::PointXYZ> ());
// You can either apply transform_1 or transform_2; they are the same
pcl::transformPointCloud (*source_cloud, *transformed_cloud, transform_2);

取自pcl转换教程

© www.soinside.com 2019 - 2024. All rights reserved.