Vous êtes sur la page 1sur 7

Introduction

Playing Kinect games is a really great experience. Programming for Kinect is even greater! Browsing the web, you can find many cool "hacks" (CLNUI, OpenKinect) which allow Kinect be used by a PC rather than an XBOX. Via these hacks, we gain access to Kinect's cameras (color and depth), LED, accelerometer and motor. Obtaining both the raw and the depth image, it is easier to build Machine Vision applications. But the main problem remains: Kinect magic is its software and the device simply cannot give us all those body-tracking algorithms by itself. Fortunately, PrimeSense, the company behind Kinect, released OpenNI framework and NITE middleware. This means that we can now have access to features such as real-time skeleton tracking, gesture recognition, wave detection and much more! OpenNI and NITE installation can be painful if not done properly. Let's do it step by step:

Step 0
Uninstall any previews drivers, such as CLNUI. Look at the end of this post if you want to see how you can have multiple drivers installed.

Step 1
Download and install the latest stable or unstable OpenNI Binaries from OpenNI website.

Step 2

Download Kinect Drivers and unzip

. Run the precompiled SensorKinect-Win-OpenSource32-5.0.1.exe file from the ..\avin2-SensorKinect-28738dc\Bin Directory

Drivers are now installed in your PC.

Step 3
Download and install the latest stable or unstable OpenNI Compliant Middleware Binaries (NITE) from OpenNI website. During installation, provide the following (free) PrimeSense key: 0KOIk2JeIBYClPWVnMoRKn5cdY4=

Step 5

Plug in your Kinect device and connect its USB port with your PC. Wait until the driver software is found and applied. Navigate to the Device Manager (Control Panel). You should see something like the following:

Step 6
Copy the XML files from " avin2-SensorKinect-28738dc\OpenNI\Data" into " c:\Program Files\OpenNI \Data " (overwrite files)

Step 7
Navigate to C:\Program Files\OpenNI\Samples\Bin\Release (or C:\Program Files (x86)\OpenNI\Samples\Bin\Release) and try out the existing demo applications. Try the demos found in C:\Program Files\Prime Sense\NITE\Samples\Bin\Release (or C:\Program Files (x86)\Prime Sense\NITE\Samples\Bin\Release), too. If they work properly, then you are done! Congratulations!
Test #1: Run the NiViewer sample to make sure depth & image streams are working. Test #2: Run the OpenNI/NiUserTracker sample play with the skeleton. Don't forget to start with the calibration pose! (Explained in the PDFs) Test #3: Try the NITE/Sample-PointViewer sample for the hand tracking demo.

If they do not work, make sure that you have replaced the XML files I mentioned in step 5 with the ones I provided you. If the demos still do not work, try installing the stable version of OpenNI, middleware and hardware binaries. Personally, I have successfully installed OpenNI and NITE (both stable and unstable releases) in a 32-bit desktop and a 64-bit laptop following the methodology I described.

Step 8
You have successfully installed Kinect in your Windows PC! Read the documentation and familiarize yourself with the OpenNI and NITE API.

Visual Studio User Make sure you set the path for compilation, go to Control Panel\System and Security\System->Advance system settings-> advanced tab-> Environment Variables under variable for users select NEW 1. Variable name : OPEN_NI_INCLUDE Variable value : C:\Program Files (x86)\OpenNI\Include 2. Variable name : OPEN_NI_LIB Variable value : C:\Program Files (x86)\OpenNI\Lib 3. Variable name : PRIME_SENSOR_INCLUDE Variable value : C:\Program Files (x86)\Prime Sense\NITE\Include 4. Variable name : PRIME_SENSOR_LIB Variable value : C:\Program Files (x86)\Prime Sense\NITE\LIB Under system variable find Path click edit.. Make sure you have added the path under your Variable value ( this is my computer which 64bits, 32-bits users path might different) C:\Program Files\OpenNI\bin64; C:\Program Files\PrimeSense\NITE\bin64; C:\Program Files (x86)\OpenNI\bin; C:\Program Files (x86)\PrimeSense\NITE\bin;

Creating an empty project that uses OpenNI in Visual Studio


1. Open a new project or an existing one with which you want to use OpenNI. 2. In the Visual Studio menu, open the Project menu and choose Project properties. 3. In the C/C++ section, under the General node, select =>Additional Include Directories and add "$(OPEN_NI_INCLUDE)". This is an environment variable that points to the location of the OpenNI Include directory. (The default location is: C:\Program files\OpenNI\Include.) 4. In the Linker section, under the General node, select Additional Library Directories and add "$(OPEN_NI_LIB)". This is an environment variable that points to the location of the OpenNI include directory. (The default location is: C:\Program files\OpenNI\Lib.) 5. In the Linker section, under the Input node, select Additional Dependencies and add OpenNI.lib. 6. If you wish to use an XML file to configure OpenNI, you can start from the basic XML file that can be found in the OpenNI Data folder. (The default location is: C:\Program files\OpenNI\Data.) For further information about OpenNI xml scripts, see Xml Scripts. 7. Ensure that you add the Additional Include and Library directories to both your Release and Debug configurations.

8. Your code files should include XnOpenNI.h if using the C interface, or XnCppWrapper.h if using the C++ interface.

Installing Multiple Drivers


Here's how to achieve this:

Open Device Manager Right click Kinect Camera under PrimeSensor. Select "Update driver software" Select "Browse my computer for driver software" and "Let me pick from a list of device drivers on my computer". Select the driver of your preference (e.g. CLNUI). You are done!

Vous aimerez peut-être aussi