当前位置:网站首页>PCL1.12 解决memory.h中EIGEN处中断问题
PCL1.12 解决memory.h中EIGEN处中断问题
2022-08-04 05:29:00 【视觉菜鸟Leonardo】
废话不多说,上大佬的文章
PCL中Ptr释放问题 aligned_free_winka9587的博客-CSDN博客
/** \internal Frees memory allocated with aligned_malloc. */
EIGEN_DEVICE_FUNC inline void aligned_free(void *ptr)
{
#if (EIGEN_DEFAULT_ALIGN_BYTES==0) || EIGEN_MALLOC_ALREADY_ALIGNED
EIGEN_USING_STD(free)
free(ptr);
#else
handmade_aligned_free(ptr);
#endif
}
解决办法:
VS:通过项目属性->C/C++->代码生成->启用增强指令集->选择AVX
解决办法:
VS:通过项目属性->C/C++->代码生成->启用增强指令集->选择AVX
事情的起因是这样的
我用的是PCL1.12.1版本,创建了一个函数,用来计算法向,然后我发现计算出的法向中有值为NaN的点,所以我想要看看这些点是哪些,pcl中有函数removeNaNNormalsFromPointCloud可以直接将这些点剔除,并且还能够返回这些点的下标。总之,因为以上的种种原因,我写出了下面的代码
xxx func(pcl::PointCloud<pcl::PointXYZ>::ConstPtr input_cloud)
{
pcl::PointCloud<pcl::Normal>::Ptr cloud_with_normals(new pcl::PointCloud<pcl::Normal>);
/*
计算法向
*/
pcl::PointCloud<pcl::Normal>::Ptr cloud_removeNan(new pcl::PointCloud<pcl::Normal>);
pcl::removeNaNNormalsFromPointCloud(*cloud_with_normals, *cloud_removeNan, indices);
return;
}
然后在 return的时候函数报错如下:
debug后发现问题出在 cloud_removeNan上,
如果替换为原始指针就能成功返回
pcl::PointCloud<pcl::Normal>::Ptr cloud_removeNan(new pcl::PointCloud<pcl::Normal>);
事情到这里就解决了,但是代码写的太多太长了,如果全部替换为原始指针能累死。
还有一个原因是因为PCL中很多函数的参数类型是Ptr
继续找,肯定有人跟我有一样的问题
https://github.com/PointCloudLibrary/pcl/issues/4859
上面的链接中提到通过启用AVX可以解决这个问题
提到CMake时添加选项来启用AVX:https://github.com/PointCloudLibrary/pcl/pull/4698
但是我的PCL是all in one安装的,不想再去CMake了。于是继续找VS有没有方法能够直接解决
/arch (x86) | Microsoft Docs
VS:通过项目属性->C/C++->代码生成->启用增强指令集->选择AVX
边栏推荐
- TensorFlow2 study notes: 5. Common activation functions
- (十三)二叉排序树
- postgres recursive query
- Introduction of linear regression 01 - API use cases
- Transformer
- Simple and clear, the three paradigms of database design
- fill_between in Matplotlib; np.argsort() function
- The pipeline mechanism in sklearn
- Thread 、Handler和IntentService的用法
- SQL练习 2022/7/2
猜你喜欢
随机推荐
动手学深度学习_多层感知机
The use of the attribute of the use of the animation and ButterKnife
剑指 Offer 20226/30
图像合并水平拼接
npm install dependency error npm ERR! code ENOTFOUNDnpm ERR! syscall getaddrinfonpm ERR! errno ENOTFOUND
Kubernetes集群安装
(六)递归
Redis持久化方式RDB和AOF详解
Kubernetes基本入门-元数据资源(四)
简单说Q-Q图;stats.probplot(QQ图)
动手学深度学习_softmax回归
剑指 Offer 2022/7/9
剑指 Offer 2022/7/5
超详细MySQL总结
剑指 Offer 2022/7/8
with recursive用法
Attention Is All You Need(Transformer)
Matplotlib中的fill_between;np.argsort()函数
oracle临时表与pg临时表的区别
(十四)平衡二叉树