C++遍历std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr>指针的各个点

以下是遍历std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr> clouds内指针的各个点的C++代码示例:

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

int main()
{
    std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr> clouds;

    // 假设已经将点云指针添加到了clouds中

    // 遍历每个点云指针
    for (const auto& cloud : clouds)
    {
        // 遍历当前点云中的每个点
        for (const auto& point : *cloud)
        {
            // 访问当前点的坐标和颜色
            float x = point.x;
            float y = point.y;
            float z = point.z;
            uint8_t r = point.r;
            uint8_t g = point.g;
            uint8_t b = point.b;

            // 在这里进行你的操作
            // ...
        }
    }

    return 0;
}

在这个示例中,我们假设已经将点云指针添加到了clouds向量中。然后,我们使用for循环遍历每个点云指针。在每个点云指针的循环中,我们使用另一个for循环遍历当前点云中的每个点。在每个点的循环中,我们可以访问点的坐标和颜色,并在需要时进行操作。

C++遍历std::vector<pcl::PointCloud<pcl::PointXYZRGB>::Ptr> 指针的各个点

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

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