zoukankan      html  css  js  c++  java
  • Qt 加载Leap motion 手势识别软件 二次开发 hello world

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

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

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

    Pro文件

    QT += core
    QT -= gui
    
    CONFIG += c++11
    
    TARGET = Leap_test
    CONFIG += console
    CONFIG -= app_bundle
    
    #INCLUDEPATH += C:DevLeapSDKinclude
    
    #LIBS += -L E:WorkSpaceLeap_test -l Leap
    
    LIBS += $$PWDLeap.lib
    
    TEMPLATE = app
    
    SOURCES += 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();
    
    }



    欢迎交流

  • 相关阅读:
    二分多重匹配(HDU5093)
    2-sat(and,or,xor)poj3678
    某个点到其他点的曼哈顿距离之和最小(HDU4311)
    第k最短路A*启发式搜索
    求树的直径和中心(ZOJ3820)
    并查集hdu4424
    map容器结构体离散化
    二维坐标系极角排序的应用(POJ1696)
    【进阶3-3期】深度广度解析 call 和 apply 原理、使用场景及实现(转)
    判断js数据类型的四种方法,以及各自的优缺点(转)
  • 原文地址:https://www.cnblogs.com/DreamDog/p/9160118.html
Copyright © 2011-2022 走看看