【问题标题】:Processing Raw data from kinect in matlab在matlab中处理来自kinect的原始数据
【发布时间】:2019-10-14 15:15:26
【问题描述】:

我在 MATLAB 中使用 Microsoft kinect v1,并希望获取以米为单位的每个像素的深度数据。

我不确定如何获取该数据,因为我正在获取 uint16,据我所知,它仅提供 13 位的深度,那么我如何获取这 13 位并进行一些转换以准确获取深度以米为单位。

我已经搜索了很多关于它但无法得出任何结论。


    Kinectinfo = imaqhwinfo('kinect');
    colorinfo = Kinectinfo.DeviceInfo(1);
    depthinfo = Kinectinfo.DeviceInfo(2);
    colorvid = videoinput('kinect',1);
    depthvid = videoinput('kinect',2);
    srcDepth = getselectedsource(depthvid);

    % Set the frames per trigger for both devices to 1.

    colorvid.FramesPerTrigger = 1;
    depthvid.FramesPerTrigger = 1;

    % Set the trigger repeat for both devices to 200, in order to acquire 201 frames from both the color sensor and the depth sensor.

    colorvid.TriggerRepeat = 200;
    depthvid.TriggerRepeat = 200;
    %Configure the camera for manual triggering for both sensors.

    triggerconfig([colorvid depthvid],'manual');
    % Start both video objects.

    start([colorvid depthvid]);

    %Trigger the devices, then get the acquired data.

    % Trigger 200 times to get the frames.

    for i = 1:200
        % Trigger both objects.
        trigger([colorvid depthvid])
        % Get the acquired frames and metadata.
        [imgColor, ts_color, metaData_Color] = getdata(colorvid);
        [imgDepth, ts_depth, metaData_Depth] = getdata(depthvid);
    end

[NYU Depth and RGB image][1]
[Histogram of swaped Raw Depth image][2]
[Histogram of Raw Depth Image][3]

我想要一些用于转换的代码或任何在 matlab 中为我提供仪表的 SDK。

非常感谢。

【问题讨论】:

    标签: matlab image-processing computer-vision kinect


    【解决方案1】:
    1. 根据几篇文章,例如。例如herehere,前三位是设备已识别的玩家的代码,但只有在启用骨骼跟踪时才会激活。 如果您不启用骨骼跟踪,则这三位设置为零

    1. 如果您使用的是 matlab,深度图像是 16 位双图像,并且包含已经从 13 位提取的数据(很可能是因为已经禁用了骨架跟踪,因此 3 MSB 为零。)因此您不要需要在 matlab 或 libfreenect 等中转换/提取 13 位数据,因为这些位已经为零。

    2. 根据Matlab help page,matlab ImAq工具箱需要安装Kinect for Windows Runtime;因为它使用 Kinect SDK Kinect 驱动程序来获取数据。根据SO answer,“使用 Microsoft SDK,因此从 kinect 传感器返回的值已经是以毫米为单位的真实距离。”

    因此,您实际上并不需要在 matlab 中对数据进行移位。您需要这样做的唯一原因是,如果您从 C++/C# 中的 kinect 驱动程序 (?) 获取原始深度流,并且 16 位数据将包括 3 个 LSB 位。

    【讨论】:

    • 非常感谢您非常详尽的回答,实际上我必须使用 NYU Matlab 工具箱here 来填充我从原始数据集中获得的图像的原始深度并进行进一步处理。
    • 实际上我必须根据他们的数据对齐我的数据集,以便我使用相同的工具箱,我不想弄乱工具箱,因为它在他们的原始数据集上运行完美。在进一步处理之前,他们调用 swapbytes.m 函数将其转换为 11 位,我猜是因为它们的最大值是 2047。
    • 我现在有两个选择,要么使用 16 位信息并像他们一样使用交换字节,要么我应该只使用 11 位数据。
    • 我使用过 libfreenect 并阅读了这篇文章,我知道有一些选项 available 但我不知道如何调用它。
    • 您是否尝试过在工具箱中同时使用这两种类型的图像(16 位和 11 位使用交换字节)?根据我的回答,我认为 16 位应该直接工作,而不需要 11 位。由于时间限制和我缺乏 kinect,我无法检查工具箱。至于lib​​renect,你链接的答案是6岁,所以现在可能已经改变了。不幸的是,我并不精通它,所以我无法对此发表评论。但我建议使用 16 位双图像进行测试/实验……希望它们能正常工作。
    猜你喜欢
    • 2014-11-03
    • 1970-01-01
    • 1970-01-01
    • 2014-09-08
    • 2012-01-18
    • 1970-01-01
    • 2016-10-01
    • 1970-01-01
    • 2014-11-16
    相关资源
    最近更新 更多