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();
    
    }



    欢迎交流

  • 相关阅读:
    高性能MySQL学习总结二----常见数据类型选择及优化
    springboot admin图文+视频教程
    xxl-job图文教程+视频讲解
    mybatis-plus视频教程
    springcloud视频教程
    springcloud系统化学习图文+视频教程
    docker系统化学习图文+视频教程
    【分享】docker全套视频教程
    是用Git还是SVN?
    NOIP知识点汇总
  • 原文地址:https://www.cnblogs.com/DreamDog/p/9160118.html
Copyright © 2011-2022 走看看