Ask Your Question
4

How to use Kinect with OpenCV?

asked 2012-07-29 00:44:34 -0600

Kirill Kornyakov gravatar image

I want to get depth and color images from Kinect, how can I do this? Is there any tutorial or code sample?

edit retag flag offensive close merge delete

Comments

There is the Kinect SDK versions 1.x and 2.x. It comes with C# and C++ code, I believe. This way you control the Kinect yourself, and don't have to build OpenCV with OpenNI support.

sjhalayka gravatar imagesjhalayka ( 2017-11-16 13:27:38 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
5

answered 2012-07-30 03:37:53 -0600

updated 2012-07-30 05:51:47 -0600

You can enable OpenNI when building OpenCV from sources, by checking the WITH_OPENNI CMake option. Then, in your code :

cv::VideoCapture capture(CV_CAP_OPENNI);
for(;;)
{
    cv::Mat depthMap;
    cv::Mat rgbImage

    capture.grab();

    capture.retrieve( depthMap, OPENNI_DEPTH_MAP );
    capture.retrieve( bgrImage, OPENNI_BGR_IMAGE );

    if( cv::waitKey( 30 ) >= 0 )
       break;
}

You can find more information here.

edit flag offensive delete link more

Comments

3

There is also a sample 'samples/cpp/openni_capture.cpp'

Maria Dimashova gravatar imageMaria Dimashova ( 2012-07-30 05:35:14 -0600 )edit

Question Tools

Stats

Asked: 2012-07-29 00:44:34 -0600

Seen: 2,633 times

Last updated: Jul 30 '12