WordPress.com



IntroductionPlaying 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 0Uninstall 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 1Download and install the latest stable or unstable OpenNI Binaries from OpenNI website.Step 2Download Kinect Drivers and unzip.Run the precompiled SensorKinect-Win-OpenSource32-5.0.1.exe file fromthe “……..\avin2-SensorKinect-28738dc\Bin” DirectoryDrivers are now installed in your PC.Step 3Download 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 5Plug 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 6Copy the XML files from " avin2-SensorKinect-28738dc\OpenNI\Data" into " c:\Program Files\OpenNI \Data " (overwrite files) Step 7Navigate 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 8You have successfully installed Kinect in your Windows PC! Read the documentation and familiarize yourself with the OpenNI and NITE API. Visual Studio UserMake sure you set the path for compilation,go to Control Panel\System and Security\System->Advance system settings-> “advanced” tab-> Environment Variablesunder variable for “users” select “NEW…”Variable name : OPEN_NI_INCLUDE Variable value : C:\Program Files (x86)\OpenNI\IncludeVariable name : OPEN_NI_LIBVariable value : C:\Program Files (x86)\OpenNI\LibVariable name : PRIME_SENSOR_INCLUDEVariable value : C:\Program Files (x86)\Prime Sense\NITE\IncludeVariable name : PRIME_SENSOR_LIBVariable value : C:\Program Files (x86)\Prime Sense\NITE\LIBUnder system variable find “Path” click “edit..”Make sure you have added the path under your Variable value ( this is my computer which 64-bits, 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 Studio1. 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 ManagerRight 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! ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download