为 Xbox 360 kinect 开发应用程序的语言

Languages to develop applications for Xbox 360 kinect

我知道这听起来很愚蠢,我参加派对可能已经很晚了,但我想为 Xbox 360 Kinect 编写一个手势识别应用程序(类似于 Hand detection or this actual finger detection)。找到并安装了 SDK(1.8 版)并开始工作,初步研究已完成 - 我只是忘了查看用哪种语言编写代码。 link 从 SDK 到文档将是第一件事,但不幸的是,这是一个死胡同。
从提供的示例来看,它似乎是 C++ 或 C#,尽管一些旧帖子也声称 Java。我的问题是:是否有与 SDK 无关的文档以及在 C++/C#/Java 下的这种特定情况下进行开发时存在哪些缺陷? 2011 年的 post 勉强涵盖了开头。

附录:在进一步查看时,系统提示我从开发人员工具包中获取示例站点 - 可以访问该站点,但所有列出的示例和 linked 示例也是死胡同。

附录:作为参考,我使用了这个 instruction - 最终证明是徒劳的。

找到一个 NiTE 版本 here

我过去提供过this answer

就我个人而言,我最常将 Xbox360 传感器与 OpenNI 结合使用(因为它是跨平台的)。此外,与 OpenNI 一起使用的 NITE 中间件提供了一些基本的手部检测甚至手势检测(滑动、圆圈手势、“按钮”按下等)。

虽然 OpenNI 是开源的,但 NITE 不是,因此您只能使用它们提供的内容。

您共享的链接使用 OpenCV。您可以安装 OpenNI 并使用 OpenNI 支持从源代码编译 OpenCV。或者,您可以手动将 OpenNI 帧数据包装到 OpenCV cv::Mat 并从那里继续 OpenCV 操作。

这是一个使用 OpenNI 获取深度数据并将其传递给 OpenCV 的基本示例:

#include <OpenNI.h>

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/videoio/videoio.hpp"

#include <iostream>

using namespace cv;
using namespace std;

int main() {
    // setup OpenNI
    openni::Status rc = openni::STATUS_OK;
    openni::Device device;
    openni::VideoStream depth, color;
    const char* deviceURI = openni::ANY_DEVICE;
    rc = openni::OpenNI::initialize();

    printf("After initialization:\n%s\n", openni::OpenNI::getExtendedError());
    rc = device.open(deviceURI);
    if (rc != openni::STATUS_OK)
    {
        printf("Device open failed:\n%s\n", openni::OpenNI::getExtendedError());
        openni::OpenNI::shutdown();
        return 1;
    }

    rc = depth.create(device, openni::SENSOR_DEPTH);
    if (rc == openni::STATUS_OK)
    {
        rc = depth.start();
        if (rc != openni::STATUS_OK)
        {
            printf("Couldn't start depth stream:\n%s\n", openni::OpenNI::getExtendedError());
            depth.destroy();
        }
    }
    else
    {
        printf("Couldn't find depth stream:\n%s\n", openni::OpenNI::getExtendedError());
    }

    if (!depth.isValid())
    {
        printf("No valid depth stream. Exiting\n");
        openni::OpenNI::shutdown();
        return 2;
    }

    openni::VideoMode vm = depth.getVideoMode();
    int cols, rows;
    cols = vm.getResolutionX();
    rows = vm.getResolutionY();

    openni::VideoFrameRef frame;
    depth.start();
    // main loop
    for (;;) {
        // read OpenNI frame
        depth.readFrame(&frame);
        // get depth pixel data
        openni::DepthPixel* dData = (openni::DepthPixel*)frame.getData();
        // wrap the data in an OpenCV Mat
        Mat depthMat(rows, cols, CV_16UC1, dData);
        // for visualisation only remap depth values
        Mat depthShow;
        const float scaleFactor = 0.05f;
        depthMat.convertTo(depthShow, CV_8UC1, scaleFactor);
        if(!depthShow.empty())
        {
            imshow("depth", depthShow);
        }
        
        if (waitKey(30) == 27)   break;

    }
    // OpenNI exit cleanup
    depth.stop();
    openni::OpenNI::shutdown();
}

您链接到的其中一个教程 (https://github.com/royshil/OpenHPE) 使用 libfreenect,这是与旧 Kinect 交互的另一个很棒的跨平台选项。

FWIW,XBox One 的 Kinect 具有更好的深度数据,更好地处理直射阳光,并且 SDK 支持自定义手势识别(参见 this tutorial 示例)。