Неустранимая ошибка с PCL ICP

Я новичок в PCL (библиотека облаков точек) и просто хочу применить ICP к двум наборам точек. Однако онлайн-образец кода для ICP выдает фатальную ошибку, когда я пытаюсь запустить его с 64-разрядной версией Visual Studio 2010. Я пробовал разные способы создания облака точек, но безуспешно. Неустранимая ошибка происходит внутри icp.setInputTarget в строке target_ = target.makeShared ();

Вот как я создаю обе свои облачные точки

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);
        }
    }

И вот тут возникает ошибка

pcl::IterativeClosestPoint<pcl::PointXYZ, pcl::PointXYZ> icp;
icp_dummy.setInputCloud(cloud_in);
icp_dummy.setInputTarget(cloud_out); /* This throws a fatal error */

Любая помощь будет оценена по достоинству


person Ege Akpinar    schedule 21.08.2012    source источник
comment
Как вы объявляете / создаете cloud_out? Если вы запустите пример на странице pointclouds.org/documentation/tutorials/, это сработает?   -  person Sassa    schedule 21.08.2012
comment
Не совсем, это код, который я пытался использовать: / Я подозреваю, что это может быть проблема с 64-битной   -  person Ege Akpinar    schedule 23.08.2012


Ответы (1)


У меня есть несколько вопросов, что мне не нравится: -Неверная карта depht, значения x, y не являются координатами реального мира

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 (умные указатели)

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
person Martijn van Wezel    schedule 28.09.2015