下面是对应的C++代码示例:

#include <pcl/point_cloud.h>
#include <pcl/point_types.h>

int main()
{
    // 定义存储叶尖点和叶节点的点云指针
    pcl::PointCloud<pcl::PointXYZRGB>::Ptr yejian(new pcl::PointCloud<pcl::PointXYZRGB>);
    pcl::PointCloud<pcl::PointXYZRGB>::Ptr jie(new pcl::PointCloud<pcl::PointXYZRGB>);

    // 输出叶尖点的所有点坐标
    for (const auto& point : yejian->points)
    {
        std::cout << "x: " << point.x << ", y: " << point.y << ", z: " << point.z << std::endl;
    }

    // 输出叶节点的所有点坐标
    for (const auto& point : jie->points)
    {
        std::cout << "x: " << point.x << ", y: " << point.y << ", z: " << point.z << std::endl;
    }

    return 0;
}

请注意,以上代码仅演示了如何输出点云中所有点的坐标,实际使用时需要先为点云添加点数据

分别输出pclPointCloudpclPointXYZRGBPtr yejiannew pclPointCloudpclPointXYZRGB;存储叶尖点pclPointCloudpclPointXYZRGBPtr jienew pclPointCloudpclPointXYZRGB;存储叶节点内的所有点的坐标的c++代码

原文地址: https://www.cveoy.top/t/topic/iJtx 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录