【问题标题】:How to get covariance matrix from point cloud data using PCL library?如何使用 PCL 库从点云数据中获取协方差矩阵?
【发布时间】:2013-12-09 15:59:46
【问题描述】:

我想要一个可以使用 PCL 从点云数据中获取协方差矩阵的示例代码。

我查看了 PCL 文档,发现了这段代码来计算协方差:

// Placeholder for the 3x3 covariance matrix at each surface patch
Eigen::Matrix3f covariance_matrix;

// 16-bytes aligned placeholder for the XYZ centroid of a surface patch
Eigen::Vector4f xyz_centroid;

// Estimate the XYZ centroid
compute3DCentroid (cloud, xyz_centroid);

// Compute the 3x3 covariance matrix
computeCovarianceMatrix (cloud, xyz_centroid, covariance_matrix); 

【问题讨论】:

  • 对于我不清楚的问题,我很抱歉。实际上我的问题是我有点云数据,我想从该数据中计算协方差矩阵。我是计算机视觉专业的新生,我不知道如何得到它,这就是为什么我问这个问题只是为了从你们那里得到一些指导。对于我的问题,我再次感到抱歉。
  • 我查看了 PCL 文档,发现了这些代码来估计协方差:pointclouds.org/documentation/tutorials/normal_estimation.php 但我不知道如何开始,比如我应该在代码中包含哪个头文件等。
  • 我认为你需要从早期的教程开始:pointclouds.org/documentation/tutorials
  • 非常感谢您的指导。

标签: computer-vision covariance point-cloud-library point-clouds


【解决方案1】:

这是直截了当的,但我想您需要更多阅读文档/教程:)

1-加载PCD文件,例如:

pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ> ());
pcl::io::loadPCDFile("c:\path\pcdfile.pcd",*cloud)

2- 计算质心:

Eigen::Vector4f xyz_centroid;
compute3DCentroid (cloud, xyz_centroid);

3- 计算协方差

Eigen::Matrix3f covariance_matrix;
computeCovarianceMatrix (cloud, xyz_centroid, covariance_matrix); 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-20
    • 2021-05-21
    • 2016-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-04
    相关资源
    最近更新 更多