用pcl读取xtion点云
2016-07-07 11:13
387 查看
用的是openni2graber,多了个2.。。
注意,这里的interface1 变量。为什么多了个1呢,原因是interface1是windows系统的保留字。。
#include "stdafx.h"
#include <pcl/io/openni2_grabber.h>
#include <pcl/visualization/cloud_viewer.h>
class SimpleOpenNIViewer
{
public:
SimpleOpenNIViewer() : viewer("PCL OpenNI Viewer") {}
void cloud_cb_(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &cloud)
{
if (!viewer.wasStopped())
viewer.showCloud(cloud);
}
void run()
{
pcl::Grabber* interface1 = new pcl::io::OpenNI2Grabber();
boost::function<void(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr&)> f =
boost::bind(&SimpleOpenNIViewer::cloud_cb_, this, _1);
interface1->registerCallback(f);
interface1->start();
while (!viewer.wasStopped())
{
boost::this_thread::sleep(boost::posix_time::seconds(1));
}
interface1->stop();
}
pcl::visualization::CloudViewer viewer;
};
int main()
{
SimpleOpenNIViewer v;
v.run();
return 0;
}
注意,这里的interface1 变量。为什么多了个1呢,原因是interface1是windows系统的保留字。。
#include "stdafx.h"
#include <pcl/io/openni2_grabber.h>
#include <pcl/visualization/cloud_viewer.h>
class SimpleOpenNIViewer
{
public:
SimpleOpenNIViewer() : viewer("PCL OpenNI Viewer") {}
void cloud_cb_(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &cloud)
{
if (!viewer.wasStopped())
viewer.showCloud(cloud);
}
void run()
{
pcl::Grabber* interface1 = new pcl::io::OpenNI2Grabber();
boost::function<void(const pcl::PointCloud<pcl::PointXYZ>::ConstPtr&)> f =
boost::bind(&SimpleOpenNIViewer::cloud_cb_, this, _1);
interface1->registerCallback(f);
interface1->start();
while (!viewer.wasStopped())
{
boost::this_thread::sleep(boost::posix_time::seconds(1));
}
interface1->stop();
}
pcl::visualization::CloudViewer viewer;
};
int main()
{
SimpleOpenNIViewer v;
v.run();
return 0;
}
相关文章推荐
- 从写博客开始
- spring-session
- 【机器学习】常见算法分类汇总
- ViewPager+RadioGroup实现微信UI界面
- PHP第一站,反思复习之路
- hdu 1075 What Are You Talking About STL的使用
- vim速查手册(随时更新)
- sql 在将 nvarchar 值 转换成数据类型 int 时失败。
- 背光亮度调节
- (C)理解 #define write(b,addr) (void)((*(volatile unsigned int *) (addr)) = (b))
- 大数据对象
- gradle 各类问题汇总
- 有一段时间没来了,总结一下
- linux Makefile
- linux快速安装rabbitMQ
- android udp文件断点续传
- 【zabbix入门基础】zabbix安装
- 简单好用的文本编辑器《Simditor》插件快速入门实例
- Linux开发工具(gcc,gdb,make,shell)——linux中静态库和动态库的区别(三)(2)
- java并发之原子性与可见性