VFH和堆损坏

时间:2014-05-28 08:00:52

标签: c++ point-cloud-library heap-corruption

我目前正在研究点云,我尝试创建一个VFH直方图。因此,我从相机收集数据,填充点云,然后创建法线,我最终计算我的vfh。
所有这一切都在一个循环中,一切正常,但只有一次。一旦我第二次进入循环,我会遇到以下错误消息:

“Windows在Showimage1_2.exe中触发了断点。 这可能是由于堆的损坏,这表明Showimage1_2.exe或它已加载的任何DLL中存在错误。“

要解决它我试图使用一个应用程序来检测那些错误“应用程序验证程序”,我得到以下输出: “VERIFIER STOP 00000006:pid 0x1958:堆指针损坏或使用错误的堆。

0CC41000 : Heap handle used in the call.
176F7AF0 : Heap block involved in the operation.
0000050B : Size of the heap block.
0B891000 : Heap where block was originally allocated.

是否可以使用此输出找到错误,以及如何?

提前致谢, 最好的问候,

辛克尔

PS:这是循环的一部分,显然是在破坏堆:

    // Process to get the normals
    //----------------------------------------------------------------------------------------------
    // Create the normal estimation class, and pass the input dataset to it

    pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
    ne.setInputCloud (cloud);

    // Create an empty kdtree representation, and pass it to the normal estimation object.
    // Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).

    pcl::search::KdTree<pcl::PointXYZ>::Ptr tree ; 
    ne.setSearchMethod (tree);

    // Output datasets

    pcl::PointCloud<pcl::Normal>::Ptr cloud_normals (new pcl::PointCloud<pcl::Normal>);

    // Use all neighbors in a sphere of radius 1cm

    ne.setRadiusSearch (0.01);
    std::cout << "cloud_normals starts to be created..." << std::endl;

    // Compute the features

    ne.compute (*cloud_normals);



    std::cout << "cloud_normals created..." << std::endl;


    //--------------------------------------------------------------------------------------------------


    // Process to get VFH

    // Create the VFH estimation class, and pass the input dataset+normals to it

    pcl::VFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::VFHSignature308> vfh;
    vfh.setInputCloud (cloud);
    vfh.setInputNormals (cloud_normals);

    // alternatively, if cloud is of type PointNormal, do vfh.setInputNormals (cloud);

    // Create an empty kdtree representation, and pass it to the FPFH estimation object.
    // Its content will be filled inside the object, based on the given input dataset (as no other search surface is given).

    vfh.setSearchMethod (tree);

    // Output datasets

    pcl::PointCloud<pcl::VFHSignature308>::Ptr vfhs (new pcl::PointCloud<pcl::VFHSignature308> ());

    std::cout << "vfh starts to be created..." << std::endl;
    // Compute the features

    vfh.compute (*vfhs);

    std::cout << "vfh created..." << std::endl;

1 个答案:

答案 0 :(得分:0)

我自己解决了这个问题。

编译PCL时,请确保具有cmake选项:

PCL_NO_PRECOMPILE

PCL_ONLY_CORE_POINT_TYPES

已启用。

默认情况下它们不是,并且使用VFH模块以这种方式进行编译会产生堆损坏。

还要禁用MSVC_CODE_LINK_OPTIMIZATION,否则您的库将很大。