首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从pcl::PointCloud<pcl::PointXYZ>到pcl::PointCloud<pcl::PointXYZ>::Ptr (隐点云到ptr)

从pcl::PointCloud<pcl::PointXYZ>到pcl::PointCloud<pcl::PointXYZ>::Ptr (隐点云到ptr)
EN

Stack Overflow用户
提问于 2020-12-02 18:06:25
回答 2查看 2.8K关注 0票数 0

我正在使用PCL1.3。是否有任何函数可以将切入点云转换为切入点云::ptr。我是PCL图书馆的新手。我有一个ROS节点订阅了传感器_msgs/Poincloud 2主题,然后我将它转换为pcl::Poincloud,现在我想做pcl::StatisticalOutlierRemoval。孤立点删除函数接受指针,而不是Poincloud本身(这就是我所理解的)。因此,为了这个目的,我想知道如何在它们之间转换的解决方案?

代码语言:javascript
复制
pcl::PointCloud<pcl::PointXYZ> point_cloud
pcl::fromPCLPointCloud2(cloud_filtered, point_cloud);


pcl::removeNaNFromPointCloud(point_cloud, point_cloud, nan_idx);

pcl::StatisticalOutlierRemoval<pcl::PointXYZ> sor;
sor.setInputCloud (point_cloud);
sor.setMeanK (50);
sor.setStddevMulThresh (1.0);
sor.filter (*point_cloud);

错误:对‘pcl::StatisticalOutlierRemovalpcl::PointXYZ::setInputCloud(**pcl::PointCloudpcl::PointXYZ**&)’的调用无匹配函数

注: pcl::PCLBase::setInputCloud(const候选人:void PointCloudConstPtr&( PointT = pcl::PointXYZ;pcl::PCLBase::PointCloudConstPtr = boost::shared_ptr )

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-12-03 20:03:11

pcl::PointCloud<pcl::PointXYZ>::Ptr是一个shared_ptr -所以简单地说,它是一个管理它的生命周期的指针的包装器(在我们的例子中,它是一个指向pcl::PointCloud<pcl::PointXYZ>指针的包装器)。

通过传递一个指针(例如来自newpcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud(new pcl::PointCloud< pcl::PointXYZ>);的指针)来安装它。

因为pcl::fromPCLPointCloud2需要一个pcl::PointCloud<pcl::PointXYZ>,所以您需要dereferencingpcl::fromPCLPointCloud2(cloud_filtered, *point_cloud);

票数 0
EN

Stack Overflow用户

发布于 2022-05-10 09:39:50

值得注意的是,使用ros_pcl,您可以直接拥有直接订阅以下内容的订阅者:

const pcl::PointCloud<pcl::PointXYZ>::ConstPtr& message

当在订阅的主题上发布sensor_msgs::PointCloud2消息时,这将立即生效,您不必调用:

pcl::fromPCLPointCloud2(cloud_filtered, point_cloud);

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65113723

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档