首页 文章

迭代最近点返回不正确的变换矩阵

提问于
浏览
0

我想通过移动和旋转我的深度传感器(结构传感器)来创建点 Cloud . 到目前为止我所拥有的是以下内容:

  • 创建两个相似的点 Cloud ,但第二个点 Cloud 已经移动了一点 .

  • 使用ICP获取转换矩阵(我已经切换了源和目标 Cloud ,因此我得到了反转) .

  • 使用变换矩阵转换源 Cloud (我创建的第二个点 Cloud ) .

  • 添加尚未包含在总点 Cloud 中的所有点 .

虽然我正在慢慢地移动传感器,但是在奇怪的位置添加了新点,因此我不确定我是否正确地执行此操作 . 我感觉转换矩阵是错误的,因为我在翻译向量中得到的值从真正的低(0,00008)到非常高(3,00000),这些值都是负数和正数 .

一些额外的信息:

  • 我使用NDK在Android上工作,所以我可以支持't use the kinfu example because CUDA isn' .

  • 我使用的是PCL 1.6版 .

有人可以帮助我吗?

Edit, added some code

过滤

pcl::VoxelGrid<pcl::PointXYZ> grid;

grid.setLeafSize (5.01, 5.01, 5.01);
grid.setInputCloud (cloud_in);
grid.filter (*in);

grid.setInputCloud (cloud_out);
grid.filter (*out);

点添加

pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
icp.setInputCloud(out);
icp.setInputTarget(in);
pcl::PointCloud<pcl::PointXYZ> Final;
pcl::PointCloud<pcl::PointXYZ> transformedCloud;
icp.setMaxCorrespondenceDistance(0.1);
icp.setRANSACIterations(5);
icp.setMaximumIterations(20);
icp.setTransformationEpsilon(1e-2);
icp.setEuclideanFitnessEpsilon(1e-5);

icp.align(Final);

if(icp.hasConverged()){
    Eigen::Matrix4f transformationMatrix = icp.getFinalTransformation();

    pcl::transformPointCloud(*cloud_out, *cloud_out, transformationMatrix);
    vtkSmartPointer<vtkCellArray> conn = vtkSmartPointer<vtkCellArray>::New();

    vtkPoints* oldPoints = totalPolyData->GetPoints();

    for(pcl::PointCloud<pcl::PointXYZ>::iterator it = cloud_out->begin(); it != cloud_out->end(); it++){
        if(!find((double) it->x, (double) it->y, (double) it->z)){
            oldPoints->InsertNextPoint((double) it->x, (double) it->y, (double) it->z);
        }
    }

    totalPolyData->SetPoints(oldPoints);
    for (int i = 0; i < oldPoints->GetNumberOfPoints(); i++)
        conn->InsertNextCell(1, &i);
    totalPolyData->SetVerts(conn);

1 回答

  • 0

    您可以尝试完全连接两个pointcloud(不仅添加不存在的点)并检查它是否良好 . 似乎有些不对劲,我怀疑它是PCL故障 . 你可以发布过滤和点添加你正在使用的代码吗?

相关问题