본문 바로가기
프로그래밍/OpenNI

Windows에서 Kinect 이용하기[OpenNI + Sensor Kinect + NITE활용]

by choies1 2012. 11. 10.

최근에 MS에서 Windows용 Kinect를 출시했다. Windows용 Kinect SDK도 같이 제공되어 이용 가능하다. 하지만 이것은 상용으로 이용할 수가 없다. 

Windows에서 뿐만 아니라 Linux나 Mac OS에서도 Kinect를 이용할 수 있는 방법은 OpenNI를 이용하는 것이다.

아래는 Windows에서 OpenNI를 활용하여 Kinect(XBOX용 Windows용 모두)를 이용하기 위한 설정방법을 설명한다.

또한 OpenCV에서 OpenNI를 이용해서 Kinect의 영상처리가 가능하다. 이 방법은 다음에 설명한다.

아래의 방법을 이용하기 전에 주의할 것은 Kinect를 미리 PC에 연결했다면 Windows용 드라이버가 설정될 수도 있으니, Windows용 드라이버를 삭제해야 된다.


인터넷 검색을 해 보면 다양한 방법이 나오는데, 이런 저런 방법으로 설치해봤는데 잘 되지 않았다. 그러다가 아래의 사이트를 발견했고, 이 방법대로 하니까 설치가 잘 되었다.


출처: http://ramsrigoutham.com/2012/06/07/installation-of-kinect-on-windows-7-openni-sensor-kinect-and-nite/



 
 
 
 
 
 
Rate This


It took me sometime to get the installation done so just thought of making a little tutorial that would help other folks. I am assuming that you have Microsoft kinect and the adapter ready with you .

Two competing frameworks to work with Kinect are Microsoft Kinect’s sdk and Prime Sense OpenNI sdk . But since the Microsoft’s sdk is only  for non commercial use, many developers love to use  OpenNI sdk.

In this tutorial we would be installing  OpenNI, SensorKinect and NITE. In simple terms OpenNI and SensorKinect are the drivers that help to access RGB-D data [Depth & Color]  from Kinect . NITE is a skeleton tracking library that can be used by developers to create gesture interactions etc. Hence if you just want to work with depth images and pointclouds you wouldn’t necessarily need to install NITE. So, technically it is optional but most of them install it as it doesn’t take much extra effort.

I have installed 32 bit versions of openNI, sensorKinect and NITE on my 64 bit windows7 laptop. I shall walk you through the steps that I had followed  to install OpenNI drivers successfully.

Step1: Go to http://www.openni.org/Downloads/OpenNIModules.aspx . Select unstable and select windows 32 version. Download and install it.

Step 2: Go to https://github.com/avin2/SensorKinect  , download the zip file and extract it.  Navigate to the Binfolder , find SensorKinect093-Bin-Win32-v5.1.2.1.msi  and install it. Sample path where  the above sensor kinect installation file would be located is C:\Users\Sanmarino\Downloads\avin2-SensorKinect-v0.93-5.1.2.1-0-g15f1975\avin2-SensorKinect-15f1975\Bin.

Step 3:  Go to http://www.openni.org/Downloads/OpenNIModules.aspx. Select openNI compliant middleware binaries, unstable , windows 32  version then download and  install it.

Step 4: Now replace the file SamplesConfig.xml in C:\Program Files (x86)\OpenNI\Data  with theSamplesConfig.xml that is present in avin2-SensorKinect-15f1975\OpenNI\Data folder that you downloaded in step2.

Here you may get “access denied” when you try to replace in  C:\Program Files (x86)\OpenNI\Data  folder. So right click on the Data folder present in C:\Program Files (x86)\OpenNI\  , then select properties –> select security tab –>click edit. Under “Group or user names” select “users(your-computer_name\Users)” , eg: ”users(Sanmarino-THINK\Users)” in my case. Now under “Permissions for users” click to allow full control , then click apply and ok.  After this you can replace without any problem. See the picture below if you have any confusion.

Step5:  Download KinectXML’s.zip from https://www.dropbox.com/s/tpl9wtx96xbe6rr/KinectXMLs.zip  and navigate to the NITE folder inside the unzipped KinectXMLs folder. Copy the three files Sample-Scene,Sample-Tracking & Sample-user from the NITE  folder in KinectXMLS and replace the files in C:\Program Files (x86)\PrimeSense\NITE\Data  with these three files. If you encounter “access denied “ problem do the same procedure explained in the step4 to the Data folder inside NITE.

Now restart your system ,  plugin Kinect and wait for the drivers to be installed. Once the drivers are installed properly open device manager[Click windows icon and search for device manager]  in your system . You should be able to see Kinect Audio,Camera & Motor when you expand PrimeSense. If you are unable to see this then refer theErrors encountered section below.

Testing the installation:

 Try out some samples   to ensure that your installation is working perfectly. Double click on NiViewerin C:\Program Files (x86)\OpenNI\Samples\Bin\Release  to see the following output. Here is the output with my kinect -

Also try Sample-SceneAnalysis in C:\Program Files (x86)\PrimeSense\NITE\Samples\Bin\Release to see if the NITE installation is working properly. Here is the output with my kinect -

If everything is working properly then you are done with the installation. If you encountered errors refer to the  section below and see if it helps. Comment if you encounter any problems. I shall offer the help I can.

Errors Encountered:

1) The procedure entry point xnloggetfilename could not be located…..

2) Device: PrimeSense/SensorKinect/5.1.2.1: The device is not connected!

3) A blank screen appears and dissapears immediately when you try to run the samples in NITE or OpenNI.

In my case all the above errors have been caused because of the conflict between Microsoft driver and OpenNI driver.  When I first connected the Kinect to my laptop Microsoft driver has been automatically installed without my knowledge and it kept causing errors like the ones mentioned above. To remove,  open Device Manager  and findMicrosoft Kinect. Expand it to find Microsoft Kinect camera , right click and choose uninstall. A windows pops out and  make sure you check the box Delete the driver software for this device so that the Microsoft Driver is not installed again the next time when you unplug and plug in kinect. Then click ok to uninstall. Now uninstall the existing openNI drivers and install them newly again(i.e, Start from Step1 again). The problem should be solved. The following image clarifies the steps mentioned.