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

  • 相关阅读:
    colock
    ToggleButton 和 Switch
    radioButon的使用
    kotlin中val和var的区别
    textEdit
    c++ 网络编程基础
    网格布局 GridLayout
    数组、指针和引用
    Hello Word
    Win7-U盘安装出现"We were unable to copy your files. "
  • 原文地址:https://www.cnblogs.com/lwngreat/p/4364156.html
Copyright © 2011-2022 走看看