当前位置:网站首页>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
边栏推荐
猜你喜欢
![[Introduction to go language] 12. Pointer](/img/c8/4489993e66f1ef383ce49c95d78b1f.png)
[Introduction to go language] 12. Pointer

(十二)树--哈夫曼树
![[Go language entry notes] 13. Structure (struct)](/img/0e/44601d02a1c47726d26f0ae5085cc9.png)
[Go language entry notes] 13. Structure (struct)

【CV-Learning】卷积神经网络

(十五)B-Tree树(B-树)与B+树
![[Deep Learning 21 Days Learning Challenge] Memo: What does our neural network model look like? - detailed explanation of model.summary()](/img/99/819ccbfed599ffd52307235309cdc9.png)
[Deep Learning 21 Days Learning Challenge] Memo: What does our neural network model look like? - detailed explanation of model.summary()

动手学深度学习__数据操作

(十四)平衡二叉树

flink onTimer定时器实现定时需求

AIDL communication between two APPs
随机推荐
图像形变(插值方法)
[CV-Learning] Convolutional Neural Network Preliminary Knowledge
【CV-Learning】图像分类
WARNING: sql version 9.2, server version 11.0.Some psql features might not work.
【CV-Learning】语义分割
Kubernetes基本入门-名称空间资源(三)
TensorFlow: tf.ConfigProto() and Session
剑指 Offer 2022/7/5
Briefly say Q-Q map; stats.probplot (QQ map)
属性动画的用法 以及ButterKnife的用法
双重指针的使用
【深度学习21天学习挑战赛】0、搭建学习环境
Logistic Regression --- Introduction, API Introduction, Case: Cancer Classification Prediction, Classification Evaluation, and ROC Curve and AUC Metrics
动手学深度学习_softmax回归
Redis持久化方式RDB和AOF详解
【CV-Learning】目标检测&实例分割
(十四)平衡二叉树
postgresql 游标(cursor)的使用
flink-sql查询配置与性能优化参数详解
SQL练习 2022/7/1