segmentation-fault - 当我尝试进行平面模型分割时,pcl 代码中的“分割错误(核心转储)”
问题描述
当我尝试使用 pcl 进行平面模型分割时,出现“分割错误(核心转储)”。
这是一个在 ubuntu16.04、CMake、pcl-1.8 中运行的 .cpp 文件,
#include <pcl-1.8/pcl/filters/extract_indices.h>
#include <pcl-1.8/pcl/filters/impl/extract_indices.hpp>
#include <pcl-1.8/pcl/segmentation/sac_segmentation.h>
#include <pcl-1.8/pcl/segmentation/impl/sac_segmentation.hpp>
PCL_INSTANTIATE(SacSegmentationExtraction, PointXYZIT);
void remove_wake(pcl::PointCloud<PointXYZIT>::Ptr in_filtered, pcl::PointCloud<PointXYZIT>::Ptr out_filtered)
{
pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients);
pcl::PointIndices::Ptr inliers (new pcl::PointIndices);
pcl::SACSegmentation<PointXYZIT> seg;
seg.setOptimizeCoefficients (true);
seg.setModelType (pcl::SACMODEL_PLANE);
seg.setMethodType (pcl::SAC_RANSAC);
seg.setDistanceThreshold (0.2);
seg.setInputCloud (in_filtered);
seg.segment (*inliers, *coefficients);
std::cerr << "Model coefficients: " << coefficients->values[0] << " "
<< coefficients->values[1] << " "
<< coefficients->values[2] << " "
<< coefficients->values[3] << std::endl;
std::cerr << "Model inliers: " << inliers->indices.size () << std::endl;
pcl::ExtractIndices<PointXYZIT> extract;
extract.setInputCloud (in_filtered);
extract.setIndices (inliers);
extract.setNegative (true);
extract.filter (*out_filtered);
pcl::io::savePCDFileASCII<PointXYZIT>("remove_plane.pcd", *out_filtered);
}
这就是整个代码,当我 catkin_make 时它会好的,但是当我 rosrun 时,它显示错误:分段错误(核心转储)我认为定义中没有空 ptr,没有多线程,没有使用的字符串。我不知道该怎么做。
解决方案
推荐阅读
- python - 单元格中的 pandas 数据以引号开头但不结尾导致错误标记数据。C 错误
- python - 简单的猪拉丁语
- javascript - 如何使用 useCallback 来修复地图函数中无用的渲染?
- matplotlib - matplotlib 科学计数法整数 1e3
- node.js - 有没有办法在运行基于 Node.js 构建的应用程序的容器中记录 Kubernetes Pod 内存使用情况
- helidon - HELIDON 支持 DB2 和 SQL 服务器数据库
- sql - 如何在 SQL 中提取这两个字段之间的文本数据
- python - 用python制作稀疏矩阵和向量乘法程序的问题
- node.js - 给定 id 的 MongoDB 计数
- html - Bootstrap Typography:没有找到合适的大写和反向值的类属性