How to take kinect video image and depth image with openCV c++?

后端 未结 3 656
谎友^
谎友^ 2020-12-29 12:47

I\'m new about opencv(c++) and kinect. I try to take a video image with c++ from kinect. I search everywhere but I didn\'t find anything. Because people are made using openN

3条回答
  •  庸人自扰
    2020-12-29 13:27

    OpenCV does not offer the ability to connect to and process data from the Kinect sensor; unless you treat the Kinect as a regular webcam. You will want to fetch the data using one of the APIs and send it to OpenCV. To get the data from the Kinect you can use:

    • Microsoft Kinect for Windows SDK
    • OpenKinect's libfreenect API
    • OpenNI + OpenKinect

    If your employer has a problem with one of the APIs, that is there choice. But the use of OpenCV does not eliminate your need to use one of them.

    A quick search on MSDN reveals multiple threads on the the subject. The most straight forward approach I've read about is using cvSetData to import the data, after converting the image:

    RGB

    IplImage * ovImage = NULL;
    ovImage = cvCreateImage(cvSize(640, 480), 8, 4);
    cvSetData(ovImage, pBuffer, ovImage->widthStep);
    

    Depth

    ovImage = cvCreateImage(cvSize(640, 480), 8, 1);
    

    I also found the freenomad_vision project on GitHub that provides libfreenect support with OpenCV and OpenGL. If you dislike using libfreenect, the code can easily serve as reference since the incoming data is all the same and (likely) would be converted the same.

提交回复
热议问题