【问题标题】:PyArray_SimpleNewFromData from uint8_t to NPY_UINT16. Works on linux but not on windowsPyArray_SimpleNewFromData 从 uint8_t 到 NPY_UINT16。适用于linux但不适用于windows
【发布时间】:2019-10-15 00:39:47
【问题描述】:

我正在使用带有 k4a python 包装器的 kinect 4 azure sdk。 深度的 dtype 是 uint16。它适用于 Linux,但不适用于 Windows。 在 Windows 上,生成的图像似乎有别名。两个像素中有一个是黑色的。

什么会使这段代码在 linux 和 windows 上表现不同?

这是包装器中的相关代码:

    uint8_t* buffer = k4a_image_get_buffer(depth_image);
    npy_intp dims[2];
    dims[0] = k4a_image_get_height_pixels(depth_image);
    dims[1] = k4a_image_get_width_pixels(depth_image);
    PyArrayObject* np_depth_image = (PyArrayObject*) 
    PyArray_SimpleNewFromData(2, (npy_intp*) dims, NPY_UINT16, buffer);
    return PyArray_Return(np_depth_image);

https://github.com/etiennedub/pyk4a/blob/master/pyk4a/pyk4a.cpp#L161

我尝试像我们在 kinect 4 azure sdk 中看到的那样更改第一行

    uint16_t* buffer = (uint16_t*)(void*) k4a_image_get_buffer(depth_image);

https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/82b850ba3c6c5fcebb3e74679896546029379dc5/examples/undistort/main.cpp#L237

这可能可以通过位移或类似方法解决,但我更愿意了解为什么 Windows 上的行为不同。

有什么想法吗?

【问题讨论】:

    标签: python c++ numpy kinect


    【解决方案1】:

    必须更新 Surface Pro 设备的 gpu 驱动程序。 https://github.com/microsoft/Azure-Kinect-Sensor-SDK/issues/840

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-27
      • 1970-01-01
      • 2016-03-01
      • 2021-05-02
      • 2017-06-14
      • 2011-06-15
      相关资源
      最近更新 更多