在 PCL 中,可以使用 pcl::transformPointCloud 函数来计算点云经过矩阵变换后的结果。

pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_input(new pcl::PointCloud<pcl::PointXYZ>);
// 读取点云数据到 cloud_input 中

Eigen::Matrix4f transform_matrix;
// 初始化变换矩阵

pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_transformed(new pcl::PointCloud<pcl::PointXYZ>);
pcl::transformPointCloud(*cloud_input, *cloud_transformed, transform_matrix);
// 将变换矩阵应用到点云中,得到变换后的结果保存在 cloud_transformed 中

其中,pcl::transformPointCloud 函数接受三个参数:输入点云、输出点云和变换矩阵。在上述代码中,通过将输入点云 *cloud_input 和变换矩阵 transform_matrix 作为参数传递给 pcl::transformPointCloud 函数,得到了变换后的结果保存在 *cloud_transformed 中。

PCL 点云变换:使用矩阵进行点云坐标转换