zoukankan      html  css  js  c++  java
  • pcl点云的创建、访问与转换

    一、点云的创建与访问

    第一种,是一种vector的赋值方式,将point数据push_back到pcl::PointXYZ类型的模板中。
    1 pcl::PointCloud<pcl::PointXYZ> pointCloud;
    2 pcl::PointXYZ point;
    3       point.x = 2.0f - y;
    4       point.y = y;
    5       point.z = z;
    6       pointCloud.points.push_back(point);

    访问:PointXYZ 成员:float x,y,z;表示了xyz3D信息,可以通过points[i].data[0]或points[i].x访问点X的坐标值。

    第二种,指针型类模板,采用“->points[i]”方式赋值。

    1 pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
    2 for (int i = 0; i < cloud->points.size (); ++i)
    3   {
    4     cloud->points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
    5     cloud->points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
    6     cloud->points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
    7   }

    二、点云的转换

    //创建
    pcl::PointCloud<pcl::PointXYZ> cloud;//点云对象
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloudPtr
    		(new pcl::PointCloud<pcl::PointXYZ>);//点云指针对象
    

      

    //转换
    cloud = * cloudPtr;
    cloudPtr = cloud.makeShared();
  • 相关阅读:
    spring Pom jar包版本管理
    Liunx 命令整理
    Centos&Nginx
    docker-compose
    .net core MemoryCache缓存
    .net core 程序集帮助类
    .NET CORE API Swagger
    Spring Boot (1)
    SQL Server生成实体
    1、认识和安装MongoDB
  • 原文地址:https://www.cnblogs.com/hsy1941/p/11980775.html
Copyright © 2011-2022 走看看