Qt 加载Leap motion 手势识别软件 二次开发 hello world

来源:互联网 发布:cst仿真软件介绍 编辑:程序博客网 时间:2024/04/19 10:23

研发需要对收拾是被进行精确定位,实现收拾的识别,和在虚拟现实中精确的显示手势在实际世界中的位置。




开始使用的Qt mingw的版本开发,总是函数没有定义,最后发现是leap sdk中需要代育vs的库文件,所以猜测需要使用vs版本的Qt 编译,顺利通过







以下是源代码,有需要的,借鉴一下下

Pro文件

QT += coreQT -= guiCONFIG += c++11TARGET = Leap_testCONFIG += consoleCONFIG -= app_bundle#INCLUDEPATH += C:\Dev\LeapSDK\include#LIBS += -L E:\WorkSpace\Leap_test -l LeapLIBS += $$PWD\Leap.libTEMPLATE = appSOURCES += main.cpp



cpp文件


#include <QCoreApplication>#include <QDebug>#include "Leap.h"using namespace Leap;class SampleListener:public Listener{public:    virtual void onConnect(const Controller& controller);    virtual void onFrame(const Controller& controller);};int main(int argc, char *argv[]){    QCoreApplication a(argc, argv);    qDebug()<<"Leap Motion Testing ...";    SampleListener listenertest;   Controller controllertest;   controllertest.addListener(listenertest);    std::cin.get();    controllertest.removeListener(listenertest);    return a.exec();}void SampleListener::onConnect(const Controller& controller){    qDebug()<<"Connected";    controller.enableGesture(Gesture::TYPE_SWIPE);}void SampleListener::onFrame(const Controller& controller){    qDebug()<<"Fram available";    const Frame frame = controller.frame();    qDebug()<< "Frame id: " << frame.id()            << ", timestamp: " << frame.timestamp()            << ", hands: " << frame.hands().count()            << ", fingers: " << frame.fingers().count()            << ", tools: " << frame.tools().count()            << ", gestures: " << frame.gestures().count();}


欢迎交流




1 0
原创粉丝点击