Ask Your Question
0

Openni 2.2 Kinect V2 driver

asked 2016-01-27 07:26:03 -0600

ANirudh_Nandavar gravatar image

I am trying to work on kinect v2 for object recognition using SURF and Flannbased Matcher. To obtain the RGB stream of Kinect 2 directly to opencv Mat, OpenNI does this directly through VideoCapture method.

I found a driver for Kinect V2 for OpennI2 on occipital's github repo here: https://github.com/occipital/OpenNI2/...

Is anybody acquainted how to set this OpenNI 2 libraries up to use Kinect 2 with OpenCV through OpenNI2?

I have built the OpenNI project with Kinect2 driver and linked these directories while building OpenCV on camke with "WITH_OPENNI2" flag.

I am not succeeding in opening Kinect V2 anyway.

Please Help, Thanks in advance Anirudh

edit retag flag offensive close merge delete

Comments

1
Eduardo gravatar imageEduardo ( 2016-01-27 08:28:42 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-01-27 10:39:48 -0600

kbarni gravatar image

I agree Eduardo, it's better to use directly the Kinect2 libraries (Kinect 2 SDK or libFreenect2) to acquire the images and convert them manually to openCV Mat.

The Kinect2 is quite "dumb", you start it and read the images in a loop. You can't set image or depth resolution, format, luminosity, etc, so no real need for OpenNI. Starting the streams is quite simple with the libraries. The only advantage of OpenNI is that it's device-independent; but anyway, the data provided by Kinect2 is different from the Kinect1/Primesense sensors.

If you are not using Windows 8/10, you must use the libFreenect2. It's quite stable and complete. Build the library and test if it works using the Protonect utility.

On Windows 8 or 10 you can also use the Kinect 2 SDK. Install it and test the examples to see if it's working.

Then, start with an example project to capture the frames. When you get the image buffer, just convert it to Mat. Something like this (not real code, juts to get the idea):

float *data;
data = captureDepthFrame();
Mat depthframe(512,424,CV_32F,data);

In the case of using LibFreenect2, it should look like:

...
listener.waitForNewFrame(frames);
Frame *rgb = frames[Frame::Color];
Frame *depth = frames[Frame::Depth];
Mat rgbMat(rgb.height,rgb.width,CV_8UC4,rgb.data); //RGB image, HD resolution
Mat depthMat(depth.height,depth.width,CV_32F,depth.data); //depth image in mm, 512x424
...
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-01-27 07:26:03 -0600

Seen: 4,931 times

Last updated: Jan 27 '16