gpt4 book ai didi

c++ - PCL : SACSegmentationFromNormals not working

转载 作者:行者123 更新时间:2023-11-28 04:52:09 33 4
gpt4 key购买 nike

我对 PCL 结构 SACSegmentationFromNormals 有疑问。我想用 C++ 做一个圆柱体分割。类似的平面分割工作得很好,但在这里我收到错误消息:

“PCL::SACSegmentationFromNormals::initSACModell 未提供输入数据!无法继续。”

虽然我正在使用 PointXYZRGBA 和 pcl::Normals。有人有想法吗?到目前为止,这是我的代码:

 `pcl::ModelCoefficients::Ptr ProMaTFC::fitting() {

...

pcl::ModelCoefficients::Ptr coefficients(new pcl::ModelCoefficients);
pcl::SACSegmentationFromNormals<pcl::PointXYZRGBA, pcl::Normal> seg;
seg.setOptimizeCoefficients(true);
seg.setModelType(pcl::SACMODEL_CYLINDER);
seg.setMethodType(pcl::SAC_RANSAC);
seg.setDistanceThreshold(0.1);
seg.setInputCloud(cloud->makeShared());
seg.setRadiusLimits(0, 5);
pcl::PointIndices inlierIndices;
segmentation.segment(inlierIndices, *coefficients_cylinder);

...
return coefficients_cylinder;
}`

我使用以下库(如果你想知道的话):

`#include <pcl/ModelCoefficients.h> 
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/extract_indices.h>
#include <pcl/filters/passthrough.h>
#include <pcl/features/normal_3d.h>
#include <pcl/sample_consensus/method_types.h>
#include <pcl/sample_consensus/model_types.h>
#include <pcl/segmentation/sac_segmentation.h> `

最佳答案

如果您想使用正态信息来估计参数,您应该调用函数 setInputNormals()

关于c++ - PCL : SACSegmentationFromNormals not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47943586/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com