The configuration of the Leap Motion C + + environment __c++

Source: Internet
Author: User

First to build a C + + Win32 Project
Then configure the project's include Directory and library directory

Include Add in Directory
C:\users\chengk\documents\leapdeveloperkit_2.3.0+31542_win\leapsdk\include
Of course, the path should be your own.

Then add the following in the Library directory:
C:\users\chengk\documents\leapdeveloperkit_2.3.0+31542_win\leapsdk\lib\x86

The next level can start writing code:

#include <iostream> #include <stdio.h> #include "opencv2/core.hpp" #include "opencv2/core/utility.hpp" Include "Opencv2/core/ocl.hpp" #include "opencv2/imgcodecs.hpp" #include "opencv2/highgui.hpp" #include "opencv2/ Features2d.hpp "#include" opencv2/calib3d.hpp "#include" opencv2/imgproc.hpp "#include" opencv2/flann.hpp "#include" Opencv2/xfeatures2d.hpp "#include" opencv2/ml.hpp "#include" Leap.h "#pragma comment (lib," Leap.lib ") using namespace C
V
using namespace Std;
using namespace cv::xfeatures2d;
using namespace cv::ml;

using namespace Leap;
    Class Samplelistener:public Listener {public:virtual void OnConnect (const controller&);
virtual void Onframe (const controller&);

};
void Samplelistener::onconnect (const controller& Controller) {std::cout << "Connected" << Std::endl; } void Samplelistener::onframe (const controller& Controller) {std::cout << "Frame available" << std
:: Endl; int main () {SampLelistener Listener;

    Controller Leap;
    Leap.addlistener (listener);
    Cin.get ();

Leap.removelistener (listener); }

This overrides the listener class so that when the leap motion is connected and the frame can be output. The
has to be paused in the middle to prevent the process from beginning to end.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.