Ask Your Question
0

I want to connect Kinect v2 with OpenCV

asked 2020-04-24 03:18:11 -0600

googooboo gravatar image

First, sorry for my English.

As you see the title, I want to connect Kinect v2 with OpenCV and get color data & depth data.

I got win10, visual studio2017, Kinect SDK2.0, OpenCV4.3.0 and cmake etc..

but finally, I can't connect Kinect with OpenCV

when I googling, there are just old data so I can't adjust 2020years

Is there somebody helps me? Thank you

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-04-24 08:58:13 -0600

kbarni gravatar image

OpenCV can use OpenNI for accessing 3D cameras, but KinectV2 doesn't have a good OpenNI integration (however it's possible to do it).

The best solution (this is true for every kind of camera that isn't directly supported by OpenCV) is to use the official API that comes with the camera and convert the buffer to OpenCV Mat (pseudocode):

float *data;
camera.open();
while(1) {
    data = camera.captureFrame();
    Mat depthframe(512,424,CV_32F,data);
    result = process(depthframe);
    imshow("Result",result);
}
edit flag offensive delete link more

Comments

I am really thank you for your comment.

Actually I can't understand what is official API. ( Is it different with Microsoft Kinect SDK2.0?)

And my major problem is I don't know how connect both of them T.T (kinect and OpenCV.. like project property setting)

Could I get more information about this? Thank you!!

googooboo gravatar imagegoogooboo ( 2020-04-26 09:20:13 -0600 )edit
1

official API = Kinect SDK

You can add Kinect SDK and OpenCV to the same project. You need to add the LIBs to the project linker, and include both libraries in your cpp file:

#include <opencv2/opencv.hpp>
#include <Kinect.h>

Refer to the numerous samples on internet how to grab a frame from Kinect, then use the algorithm above to transform the frame to OpenCV Mat.

kbarni gravatar imagekbarni ( 2020-04-26 15:07:14 -0600 )edit
1

Deer kbarni I am really thank you again. Actually I found so much time in internet, but I can't find the information what I want. Could I have one more thing? When I link two things (Kinect.h and opencv2), Should I link triple files? I mean .h file and .lib file and .dll file.

googooboo gravatar imagegoogooboo ( 2020-04-27 06:39:45 -0600 )edit
1

This isn't really OpenCV related..and I'm not really using Visual Studio. Anyway, from memory: in project settings, Include folders you need to add the include folders of OpenCV and Kinect SDK. Add the Lib files to the link section. Finally be sure that the EXE file has access to the DLL files (best solution is to add them to PATH. There are lots of resources on internet about setting up a Visual Studio project...

kbarni gravatar imagekbarni ( 2020-04-27 09:30:16 -0600 )edit

Thank you.

Actually I did project setting and failed. (eventhough I set project link path and include .h .dll .lib all of them)

I should search again.. Thank you sir

googooboo gravatar imagegoogooboo ( 2020-04-27 10:07:39 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-04-24 03:18:11 -0600

Seen: 1,917 times

Last updated: Apr 24 '20