PCL 1.8.1 在统计异常值删除后在云删除时崩溃



我有一个使用多个DLL文件构建的应用程序。 我正在尝试使用以下代码执行 PCL 的统计异常值删除:

PointCloudWithRGBNormalsPtr pclCloud(new PointCloudWithRGBNormals());
ConvertPointCloudToPCL(in_out_cloud /*my own structure which includes xyz, rgb, nx ny nz*/, *pclCloud);
pcl::StatisticalOutlierRemoval<PointXYZRGBNormal> sor;
sor.setInputCloud(pclCloud);
sor.setMeanK(10);
sor.setStddevMulThresh(1.0);
sor.filter(*pclCloud);

ConvertPointCloudToPCL

static void ConvertPointCloudToPCL(const std::vector<Cloud3DrgbN> &in, PointCloudWithRGBNormals &output)
{
for (auto it = in.begin(); it != in.end(); it++)
{
const Cloud3DrgbN &p3d = *it;;
PointXYZRGBNormal p;
p.x = p3d.x;
p.y = p3d.y;
p.z = p3d.z;
p.normal_x = p3d.nX;
p.normal_y = p3d.nY;
p.normal_z = p3d.nZ;
p.r = p3d.r;
p.g = p3d.g;
p.b = p3d.b;
output.push_back(p);
}
}

出于某种原因,如果我从我的 1 个 dll 调用此函数,它会正常工作。但是,有 1 个 dll 如果我从中调用它,当pclCloud超出范围时,我会在handmade_aligned_free函数中从EigenMemory.h文件中收到异常

我使用的是 Windows 10 64 位、pcl 1.8.1 和特征 3.3(尝试 3.3.4,同样的事情(

更新

经过进一步挖掘,我发现EIGEN_MALLOC_ALREADY_ALIGNED设置为 0,因为我在"有问题"的 DLL 中使用了AVX2。我仍然不确定为什么使用 Eigen 的"手工制作"对齐的 malloc/free 会导致这种崩溃。

Eigen,PCL和AVX似乎有一个已知问题(见此(

好吧,我找到了问题以及如何解决它。

似乎Windows的"多合一安装程序"附带的DLL没有AVX/AVX2支持下编译。

将这些库与我自己的DLL(使用AVX编译的DLL(链接时,这种不匹配导致Eigen使用不同类型的分配并释放内存导致崩溃。

我使用AVX2从源代码编译 PCL 并链接这些库,一切正常。

值得一提的是,以前工作的DLL现在有问题,因为它现在没有AVX和PCL。

最新更新