illegal hardware instruction when attempting to make a polygon mesh out of point cloud

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

illegal hardware instruction when attempting to make a polygon mesh out of point cloud

dgrzech
hi!

i'm trying to construct a polygon mesh out of a point cloud. i have both the
vertices and the normals, which i'm passing to pcl's greedy projection
triangulation. however, when calling gp3.reconstruct(), i get the following
error: [1] 1466017 illegal hardware instruction  ./build/bin/app

here is my code:

void initCanonicalMesh(std::vector<cv::Vec3f> &vertices,
std::vector<cv::Vec3f> &normals) {
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloudVertices(new
pcl::PointCloud<pcl::PointXYZ>);
    pcl::PointCloud<pcl::Normal>::Ptr cloudNormals(new
pcl::PointCloud<pcl::Normal>);

    (*cloudVertices).width  = vertices.size();
    (*cloudVertices).height = 1;
    (*cloudVertices).points.resize((*cloudVertices).width *
(*cloudVertices).height);

    (*cloudNormals).width  = normals.size();
    (*cloudNormals).height = 1;
    (*cloudNormals).points.resize((*cloudNormals).width *
(*cloudNormals).height);

    for (size_t i = 0; i < vertices.size(); i++) {
        auto ptVertices            = vertices[i];
        pcl::PointXYZ pointVertex  = pcl::PointXYZ(ptVertices[0],
ptVertices[1], ptVertices[2]);
        (*cloudVertices).points[i] = pointVertex;

        auto ptNormals            = normals[i];
        pcl::Normal pointNormal   = pcl::Normal(ptNormals[0], ptNormals[1],
ptNormals[2]);
        (*cloudNormals).points[i] = pointNormal;
    }

    pcl::PointCloud<pcl::PointNormal>::Ptr cloudWithNormals(new
pcl::PointCloud<pcl::PointNormal>);
    pcl::concatenateFields(*cloudVertices, *cloudNormals,
*cloudWithNormals);

    pcl::search::KdTree<pcl::PointNormal>::Ptr tree2(new
pcl::search::KdTree<pcl::PointNormal>);
    tree2->setInputCloud(cloudWithNormals);

    pcl::GreedyProjectionTriangulation<pcl::PointNormal> gp3;
    pcl::PolygonMesh triangles;

    gp3.setSearchRadius(0.025);

    gp3.setMu(2.5);
    gp3.setMaximumNearestNeighbors(128);
    gp3.setMaximumSurfaceAngle(M_PI / 4);  // 45 degrees
    gp3.setMinimumAngle(M_PI / 18);        // 10 degrees
    gp3.setMaximumAngle(2 * M_PI / 3);     // 120 degrees
    gp3.setNormalConsistency(false);

    gp3.setInputCloud(*cloudWithNormals);
    gp3.setSearchMethod(tree2);
    gp3.reconstruct(triangles);

}

it is copied almost word-to-word from  pcl documentation
<http://pointclouds.org/documentation/tutorials/greedy_projection.php>   i
get the same error when instead of passing the normals, i attempt to
calculate them from a kd-tree, like in the example in the documentation.

gdb gives a bit more information but nothing that let me fix the problem:
Thread 1 "app" received signal SIGILL, Illegal instruction.
0x00007ffff15e8d6d in std::_Bit_iterator::operator*() const () from
/vol/project/2017/362/g1736211/lib/libpcl_segmentation.so.1.8

what am i doing wrong? thanks in advance!



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users