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

  • 相关阅读:
    spring日记(三)
    spring日记(二)
    spring框架日记(一)
    springMVC日记(四)
    springMVC日记(三),文件上传,拦截器,数据校验
    springMVC日记(二)
    springMVC日记(一)
    Mybatis总结
    优化Dalvik虚拟机的内存分配
    简单对App进行单元测试
  • 原文地址:https://www.cnblogs.com/lwngreat/p/4364156.html
Copyright © 2011-2022 走看看