我想设置一个简单的程序来使用OpenKinect连接Kinect,并以某种方式测试通信到我的笔记本电脑。我可以运行的演示很好,但我想通过代码来测试它,以确保我知道发生了什么事情。到目前为止,我仍然无法连接它。该代码的现在 -OpenKinect - FreenectDevice摘要?
#include "/usr/local/include/libfreenect.hpp"
#include <iostream>
using namespace std;
Freenect::FreenectDevice::FreenectDevice* device;
int main(int argc, char** argv) {
Freenect::Freenect k;
device = &k.createDevice<Freenect::FreenectDevice>(0); //line 8
cout<<"\ndeviceCount:"<<k.deviceCount();
return 0;
}
当我编译,它告诉我
In member function ‘ConcreteDevice& Freenect::Freenect::createDevice(int) [with ConcreteDevice = Freenect::FreenectDevice]’:
test_kinect.cpp:8: instantiated from here
libfreenect.hpp:196: error: cannot allocate an object of abstract type ‘Freenect::FreenectDevice’
所以FreenectDevice是一个抽象类...好,我应该如何创建一个设备呢?我希望编写自己的类,只要我想使用OpenKinect,就继承这个类。我很困惑如何真正使用这个库提供的代码。我一直在寻找某种基本的教程,但一无所获。如果有人知道一个好的教程,那现在对我来说是最好的。任何帮助表示赞赏,谢谢。