首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PCL ICP出现致命错误

PCL ICP出现致命错误
EN

Stack Overflow用户
提问于 2012-08-21 08:27:26
回答 1查看 849关注 0票数 0

我是PCL (点云库)的新手,我只想将ICP应用于两组点。然而,当我尝试在64位Visual Studio 2010中运行ICP的在线代码示例时,它抛出了一个致命错误。我尝试了创建点云的不同方法,但没有成功。在icp.setInputTarget内部的target_ = target.makeShared ();行发生致命错误

这就是我创建这两个云点的方法

代码语言:javascript
复制
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_in (new pcl::PointCloud<pcl::PointXYZ>);
cloud_in->width    = _head_width+1;
cloud_in->height   = _head_height+1;
cloud_in->is_dense = true;
for(int x=0; x<=width; x++) {
        for(int y=0; y<=height; y++)    {
            float z = depths[x][y];
            pcl::PointXYZ curr_point;
            curr_point.x = x;
            curr_point.y = y;
            curr_point.z = z;
            cloud_in->points.push_back(curr_point);
        }
    }

这就是错误发生的地方

代码语言:javascript
复制
pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
icp_dummy.setInputCloud(cloud_in);
icp_dummy.setInputTarget(cloud_out); /* This throws a fatal error */

任何帮助我们都将不胜感激。

EN

回答 1

Stack Overflow用户

发布于 2015-09-28 16:40:15

我有几个问题,在我看来是不正确的:-The地图不正确,x,y的值不是真实世界的坐标。

代码语言:javascript
复制
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
cloud->points.reserve(depthmap.rows*depthmap.cols);//for speeding up code, whitout it cost more time

cloud->is_dense = true;
//Don't know how it'd defined but try something like this by the depthmap
for(int x=0; x<depthmap.rows; x++) {
        for(int y=0; y<depthmap.cols; y++)    {
            float z = depths[x][y];
            pcl::PointXYZ curr_point;
            curr_point.x = (x - cx) * z / fx; //for speedup calculate inverse of fx and multiply this 
            curr_point.y = (y - cy) * z / fy;//for speedup calculate inverse of fy and multiply this 
            curr_point.z = z;
            cloud->points.push_back(curr_point);
        }
    }

  • 还用于加速使用PTR (智能指针)

代码语言:javascript
复制
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_out;

pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp; //hereyou have to define icp

icp.setInputCloud(cloud_in);//so here icp_dummy needs to be icp

icp.setInputTarget(cloud_out); //so here icp_dummy needs to be icp

// The fatal error must be gone, otherwise change cloud_in to same type
// as cloud_out
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12046990

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档