Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup OpenNI 2.0 with OpenCV for a Kinect project?

I am working on my final year project. I need to work with Kinect to detect hand movements. I have tried a few ways and got some results, however, none was enough to meet the needs of the project. I saw this video long ago, and just got to know that they open sourced it recently. So I gave it a try.

My problem now is how to set things up.

The above awesome project uses OpenNI with Kinect. I tried to follow OpenCV tutorials to build it from source code, to let OpenCV work with OpenNI.

Problems:

  1. It says "For the OpenNI Framework you need to install both the development build and the PrimeSensor Module." but as I followed the links some of them were dead. Seems like OpenNI 2.0 doesn't use PrimeSensor any longer.

  2. It also says that in Cmake folders, one is OpenCV/Src, the other is /build. But the OpenCV I downloaded doesn't have anything as Src folder.

  3. Still I used the whole folder as Src, and built it to a build folder and checked WITH OPENNI. I used the Include and Lib folder in OpenNI2 I downloaded, but when I built the OpenCV solution (already generated from CMake) all builds failed.

  4. Also, while generating with Cmake, even if my future OpenCV solution had been successfully built (which wasn't the case), Cmake would have kept telling me how PrimeSense was not available, which made me feel so insecure. :(

  5. I am a bit confused about 32- and 64-bit. The above project I want to follow says it works on 64-bit. But I use MS C++ Express, all projects are 32-bit. So which PrimeSense drivers (given in OpenNI2) should I use?

Could anyone please tell me how to set all these things (OpenNI2.0, OpenCV 2.4.3, PrimeSense) together so I can work with Kinect?

like image 914
tnq177 Avatar asked Jan 24 '13 00:01

tnq177


2 Answers

A while back I wrote two tutorials on 1) how to set up OpenNI 1.5 with NITE 2) How to compile OpenCV with OpenNI support.

These can be found here and here

I know this is not what you asked for, but the process of compiling OpenCV with OpenNI 2.0 should be similar and might help you understand where you are going wrong.

I will try to write a newer tutorial, however since I currently do not have access to a sensor, I might not be able to test if it works out in the end.

EDIT: I have written some code to access Kinect data streams in OpenCV Mat format using OpenNI 2.x. The code github repo can be found here. Detailed guidance on how to set everything up can be found here.

like image 88
masad Avatar answered Oct 29 '22 07:10

masad


OpenNI 2.x is much advanced than the previous versions. You don't need to install primesense sensorkinect driver. You can use OpenNI 2.x along with the Microsoft Kinect SDK 1.x.

Install both 64 and 32-bit OpenNI 2.x if you have Windows 7 x64 otherwise only 32-bit. Configure it with Visual Studio 2010 or 12. You can follow this video:

http://www.youtube.com/watch?v=ACqPsV0R4to

Then configure OpenCV for visual Studio 2010 or 12. You can follow this link:

http://4someonehelp.blogspot.in/2013/04/install-opencv-245-using-visual-studio.html

Thanks

like image 1
Tonmoy Avatar answered Oct 29 '22 06:10

Tonmoy