Monday, 14 July 2014

Microsoft Kinect + OpenNI2 +NiTE2+OpenCV

This blog takes you through the steps necessary for installing Microsoft Kinect SDK, OpenNI, NiTE and OpenCV library and also configuring it with Microsoft Visual Studio 2010.

Steps to install Microsoft Kinect SDK
1.      Download the latest Microsoft Kinect SDK and Kinect Developer Toolkit from the Microsoft Website which is available free of cost.
2.      First install the Microsoft Kinect SDK by double clicking it and then try installing Kinect Developer Toolkit, both of  which get installed in C:Program Files(x86) (for 32 bit machine) or C:/Program Files (for 64 bit machine)
3.      Microsoft Kinect SDK has drivers and library files required for application development with Kinect, whereas Kinect Developer Toolkit has certain application which are already built by Microsoft, which can be used to test the Kinect setup and driver installation.
4.      Once installation is done. Go to control panelàuninstall programàpress k. you should see the following figure, which confirms that SDK’s are setup and good to go.






5.      If you have plan for developing application of Kinect with Microsoft SDK, then start with some good textbooks and forum from Microsoft, or else if you want go for open source library, then go to the next steps.

Steps to install OpenNI2 library
6.      OpenNI library is one such library which allow us to take Kinect to any other platform instead of windows, like linux/mac. This library provides API for accessing Kinect Depth sensing and color camera. If you want access other peripherals like accelerometer, tilt motor and microphone array, well this is not the right choice. You need to continue with Microsoft Kinect SDK only.
7.      In this tutorial, I have installed the OpenNI version 2(or OpenNI2) in my windows 8 system.
8.      Download the library file from following website (choose library properly by appropriately choosing for 32 or 64 bit.)
Also you can download documentation from the same website.
One more link:
9.      Install OpenNI2 library.

Steps to install NiTE library
10.  Download NiTE2 library from following link
11.  Install the NiTE2 library.

Steps to install OpenCV library
12.  For windows, installation is very easy. The version that I used was OpenCV2.4.9.
13.  Download the file from following website.
14.  Once downloaded, double click it to install and choose your hard disk space to get it install.
15.  For Linux, see the following blog.(For Ubuntu and Fedora)
http://kinishri6.blogspot.in/


Steps to configure our famous IDE Microsoft Visual Studio(MVS)
16.  I have done this configuration using MVS2010.This configuration remains same for all future MVS’s.
17.  Choose Debug or Release mode and set up for either x64 or x86
18.  Go to Projectàyour_project_name propertiesàConfiguration Properties
19.  Choose dropdown of C/C++
a.       In General TabàAdditional Include Directoreis
Add path for all the header files
In my case:(separated by “;” for each header file)
1)      for OpenCV-2.4.9
      G:\OpenCVProjects\opencv\build\include
2)      for NiTE2
C:\Program Files\PrimeSense\NiTE2\Include
3)      for OpenNI2
C:\Program Files\OpenNI2\Include
20.  Now choose Linker.
a.       In General TabàAdditional Library Directories,
Add the following path (In my case) (separated by “;” for each library)
1)      C:\Program Files\OpenNI2\Lib
2)      C:\Program Files\PrimeSense\NiTE2\Lib
3)      G:\OpenCVProjects\opencv\build\x64\vc10\lib (for 64 bit) or G:\OpenCVProjects\opencv\build\x86\vc10\lib (for 32 bit)
4)      $(OutDir)
b.      In Library TabàAdditional Dependencies,
Add the following library(separated by “;” for each library)(for Release mode)
NiTE2.lib;OpenNI2.lib;opencv_core249.lib;opencv_imgproc249.lib;opencv_highgui249.lib;opencv_ml249.lib;opencv_video249.lib;opencv_features2d249.lib;opencv_calib3d249.lib;opencv_objdetect249.lib;opencv_contrib249.lib;opencv_legacy249.lib;opencv_flann249.lib;opencv_gpu249.lib;opencv_nonfree249.lib;opencv_ocl249.lib;opencv_photo249.lib;opencv_videostab249.lib;opencv_stitching249.lib;opencv_superres249.lib;opencv_ts249.lib

21.  This finishes the configuration.

4 comments:

  1. Hey there i am using OpenNi 2.0 and linking it with Visual Studio 2010, I did linked all the libraries and checked the issue of 32 and 64 bit application but i am still getting the following errors please help me out, i can't get to the bottom of this problem. I am trying to run the sample SimpleViewer in c++ but getting this :1>------ Build started: Project: openni_project, Configuration: Debug Win32 ------ 1>openni_project.obj : error LNK2019: unresolved external symbol "public: virtual enum openni::Status __thiscall SampleViewer::run(void)" (?run@SampleViewer@@UAE?AW4Status@openni@@XZ) referenced in function _main 1>openni_project.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall SampleViewer::~SampleViewer(void)" (??1SampleViewer@@UAE@XZ) referenced in function _main 1>openni_project.obj : error LNK2019: unresolved external symbol "public: virtual enum openni::Status __thiscall SampleViewer::init(int,char * *)" (?init@SampleViewer@@UAE?AW4Status@openni@@HPAPAD@Z) referenced in function _main 1>openni_project.obj : error LNK2019: unresolved external symbol "public: __thiscall SampleViewer::SampleViewer(char const *,class openni::Device &,class openni::VideoStream &,class openni::VideoStream &)" (??0SampleViewer@@QAE@PBDAAVDevice@openni@@AAVVideoStream@2@2@Z) referenced in function _main 1>D:\openCV\openni_project\Debug\openni_project.exe : fatal error LNK1120: 4 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    ReplyDelete
  2. Hello Admin,
    This technical post helps me to improve my skills set, thanks for this wonder article I expect your upcoming blog, so keep sharing.
    Regards,
    Angularjs training in chennai

    ReplyDelete
  3. Thank you.
    May you help me, I 'm searching about source code to test this configuration.

    ReplyDelete