zoukankan      html  css  js  c++  java
  • PCL点云库增加自定义数据类型

    #include <pcl/filters/passthrough.h>
    #include <pcl/filters/impl/passthrough.hpp>
    // the rest of the code goes here
    如果你的代码是库的一部分,可以被他人使用,需要为你自己的MyPointType类型进行显示实例化。
    实例
    下面的代码段创建了包含XYZ数据的新point类型,连同一个的test的浮点型数据,这样满足存储对齐。
    #include <pcl/point_types.h>
     #include <pcl/point_cloud.h>
     #include <pcl/io/pcd_io.h>
     
    struct MyPointType              //定义点类型结构
    {
    PCL_ADD_POINT4D;                // 该点类型有4个元素
    float test;
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW// 确保new操作符对齐操作
    }EIGEN_ALIGN16;// 强制SSE对齐
     
    POINT_CLOUD_REGISTER_POINT_STRUCT(MyPointType,// 注册点类型宏
    (float,x,x)
    (float,y,y)
    (float,z,z)
    (float,test,test)
    )
    int
    main(int argc,char** argv)
    {
    pcl::PointCloud<MyPointType> cloud;
    cloud.points.resize(2);
    cloud.width=2;
    cloud.height=1;
     
    cloud.points[0].test=1;
    cloud.points[1].test=2;
    cloud.points[0].x=cloud.points[0].y=cloud.points[0].z=0;
    cloud.points[1].x=cloud.points[1].y=cloud.points[1].z=3;
     
    pcl::io::savePCDFile("test.pcd",cloud);
    }

    转:   http://www.pclcn.org/study/shownews.php?lang=cn&id=286

  • 相关阅读:
    循环获取数据
    implode
    获取二维数组中的值
    根据id获取某一类的最大最小值
    array_column的作用
    用curl模拟夹带cookie的http请求
    phpunit——执行测试文件和测试文件中的某一个函数
    call_user_func
    9 [面向对象]-内置方法
    8 [面向对象]-反射
  • 原文地址:https://www.cnblogs.com/lwngreat/p/4364156.html
Copyright © 2011-2022 走看看