可以自己定义数据结构,然后用PCL里面的函数运行了!
2017-08-18 17:38
651 查看
参考:
Then, you need to make sure your code includes the template header implementation of the specific class/algorithm in PCL that you want your new point type MyPointType to
work with. For example, say you want to use pcl::PassThrough. All you would have to do is:
If your code is part of the library, which gets used by others, it might also make sense to try to use explicit instantiations for your
4000
MyPointType types,
for any classes that you expose (from PCL our outside PCL).
Note
Starting with PCL-1.7 you need to define PCL_NO_PRECOMPILE before you include any PCL headers to include the templated algorithms as well.
How to add a new PointT type
To add a new point type, you first have to define it. For example:1 2 3 4 | struct MyPointType { float test; }; |
work with. For example, say you want to use pcl::PassThrough. All you would have to do is:
#define PCL_NO_PRECOMPILE #include <pcl/filters/passthrough.h> #include <pcl/filters/impl/passthrough.hpp> // the rest of the code goes here
If your code is part of the library, which gets used by others, it might also make sense to try to use explicit instantiations for your
4000
MyPointType types,
for any classes that you expose (from PCL our outside PCL).
Note
Starting with PCL-1.7 you need to define PCL_NO_PRECOMPILE before you include any PCL headers to include the templated algorithms as well.
Example
The following code snippet example creates a new point type that contains XYZ data (SSE padded), together with a test float.1 2 3 4 | #define PCL_NO_PRECOMPILE #include <pcl/point_types.h> #include <pcl/point_cloud.h> #include <pcl/io/pcd_io.h> struct MyPointType { PCL_ADD_POINT4D; // preferred way of adding a XYZ+padding float test; EIGEN_MAKE_ALIGNED_OPERATOR_NEW // make sure our new allocators are aligned } EIGEN_ALIGN16; // enforce SSE padding for correct memory alignment POINT_CLOUD_REGISTER_POINT_STRUCT (MyPointType, // here we assume a XYZ + "test" (as fields) (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); } |
相关文章推荐
- C++:对于class来说,什么函数可以在class里面定义,什么函数最好在class外面定义(我的理解)
- 有一个函数int getNum(),每运行一次可以从一个数组V[N]里面取出一个数,N未知,当数取完的时候,函数返回NULL。现在要求写一个函数int get(),这个函数运行一次可以从V[N]里随机
- 阿里巴巴面试算法题:有一个函数int getNum(),每运行一次可以从一个数组V[N]里面取出一个数,N未知,当数取完的时候,函数返回NULL。现在要求写一个函数int get(),这个函数运行一次可以从V[N]里随机取出一个数,而这个数必须是符合1/N
- cmd 如何进入d盘,然后执行编译 这样就可以省去每次自己动手运行,直接脚本一次性搞定
- 怎么把修改APK把它变成自己的APK只想改个引导页然后要可以运行
- 理解Linux环境变量及配置文件执行顺序 博客分类: Linux 每个用户都有自己专属的运行环境,这个环境是由一组变量所定义,这些变量称之为环境变量。用户可以修改环境变量以满足自己的要求。
- 函数可以定义在函数里面吗?
- 【郝斌数据结构自学笔记】49-52_递归的定义和不同函数之间相互调程序举例_一个函数自己调自己程序举例
- c++中函数只声明,不定义(不调用该函数)可以通过编译并运行
- 【郝斌数据结构自学笔记】53-56_一个函数为什么可以自己调用自己_递归必须满足三个条件_循环和递归的比较
- 在PHP中,通过filesize函数可以取得文件的大小,文件大小是以字节数表示的。如果要转换文件大小的单位,可以自己定义函数来实现。
- MFC 添加C++类,别的类不通过C++类的定义的对象就可以直接调用C++类里面的成员函数;
- 现代事件模型可以定义多个处理函数的原因
- 查看进程使用端口号及结束进程 使用命令 sudo netstat -ntlp,可以查看到目前系统网络服务器的运行情况,然后使用 sudo kill -9 pid,结束进程。
- 基类中定义的虚函数在派生类中重新定义时,其函数原型,包括返回类型、函数名、参数个数、参数类型及参数的先后顺序,都必须与基类中的原型完全相同 but------> 可以返回派生类对象的引用或指针
- Qt 自定义事件(三种方法:继承QEvent,然后Send Post就都可以了,也可以覆盖customEvent函数,也可覆盖event()函数)
- 可以通过定义js函数,将jsp变量值作为参数传递给该函数
- 牛腩新闻视频 14讲 重构SQLHelper 助手类 将SQLhelper里面的每个函数 改成可以使用存储过程 //TODO 注释
- 在form中调用另一个form的方法,函数:fnd_function.execute 如何在form1中调用form2呢?可以使用函数fnd_function.execute。其函数定义如下: fn
- 标签的属性值,可以自己任意定义如