【问题标题】:Initialize a PCL PointCloud::Ptr?初始化 PCL PointCloud::Ptr?
【发布时间】:2017-10-09 15:31:28
【问题描述】:

这很可能是一件简单的事情,但我被卡住了。我正在尝试在头文件中初始化点云库点云,以便我可以跨函数共享它。

我正在尝试:

//.h

typedef pcl::PointCloud<pcl::POINT_TYPE> PointCloud;

PointCloud::Ptr currCloud;

//.cpp

currCloud= new pcl::PointCloud<pcl::PointXYZI>;

但这给了我

no operator '=' matches these operands

如何初始化这个类型?

谢谢。

【问题讨论】:

    标签: c++ pointers point-cloud-library


    【解决方案1】:

    在 PCL 中,点类型必须在声明和定义之间匹配。

    改变

    typedef pcl::PointCloud<pcl::POINT_TYPE> PointCloud;
    

    typedef pcl::PointCloud<pcl::PointXYZI> PointCloud;
    

    在您的标题中。

    【讨论】:

    • 谢谢!我做了这个改变,现在得到:Severity Code Description Project File Line Suppression State Error (active) no suitable user-defined conversion from "pcl::PointCloud&lt;pcl::PointXYZI&gt;" to "boost::shared_ptr&lt;pcl::PointCloud&lt;pcl::PointXYZI&gt;&gt;" exist
    • 我也试过:currCloud= new PointCloud::Ptr;,同样的错误
    • 这是因为您正尝试使用“new”来初始化 boost 共享指针。尝试使用:currCloud= pcl::PointCloud<:pointxyzi>::Ptr(new pcl::PointCloud<:pointxyzi>);
    猜你喜欢
    • 2012-05-25
    • 1970-01-01
    • 1970-01-01
    • 2021-03-12
    • 1970-01-01
    • 2020-07-31
    • 2021-12-30
    • 1970-01-01
    • 2017-12-08
    相关资源
    最近更新 更多