我正在探索在(something like Continuous Gesture Basics project https://github.com/angelaHillier/ContinuousGestureBasics-WPF)内部运行C#Kinect视觉手势程序Docker for Windows container.的可行性

  • 从理论上讲,这是否可能(在Docker for Windows容器中运行C#Kinect?)
  • 如果对1的回答为是,则这里有一些其他详细信息:

  • 我使用microsoft/dotnet-framework:4.7图像作为基础,我的初始Dockerfile如下所示:
    FROM microsoft/dotnet-framework:4.7
    ADD . /home/gesture
    WORKDIR /home/gesture
    

    构建图像:
    $ docker build -t kinect .
    

    打开容器:
    $ docker run -dit --name kinectContainer kinect
    

    附加到powershell session ,以了解以下情况:
    $ docker exec -it kinectContainer powershell
    

    当我尝试从Docker容器运行我的手势应用程序时,出现以下错误(这是预期的,因为在该容器中未安装Kinect SDK):
    Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Microsoft.Kinect, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependenc
    ies. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058) ---> System.BadImageFormatExcep
    tion: Cannot load a reference assembly for execution.                                           erable program. Check the spelling of the name, or if a path was included, verify that the path
       --- End of inner exception stack trace ---
       at GestureDetector.GestureDetectorApp..ctor()
    

    此时,最大的问题是如何在容器中安装Kinect v2 SDK [KinectSDK-v2.0_1409-Setup.exe]Kinect v2 runtime [KinectRuntime-v2.0_1409-Setup.exe]

    安装程序具有EULA,根据some clever University of Wisconsin folks,存在一种使用Wix的dark.exe反编译器(https://social.msdn.microsoft.com/Forums/en-US/a5b04520-e437-48e3-ba22-e2cdb46b4d62/silent-install-installation-instructions?forum=kinectsdk)提取安装程序的技术。

    前任。
    $ & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\dark.exe' C:\installerwork\KinectRuntime-v2.0_1409-Setup.exe -x c:\installerwork\kinect_sdk_installersfiles
    

    当我访问基础msi文件时遇到的问题是没有选择使用msiexec静默运行它们的选项。

    我发现运行时安装程序(从Kinect v2 SDK中提取的运行时安装程序(KinectRuntime-x64.msi))至少会对文件系统进行以下更改:

    在C:\Windows\System32中创建一个文件夹“Kinect”,并将3个文件添加到System 32中:

    k4wcll.dll

    kinect20.dll

    microsoft._kinect.dll

    System32中的最后三个文件应为64位版本(安装程序似乎具有这3个文件的x86和x64版本)

    手动复制这些更改不会在主机上取得成功,更不用说在容器中了。

    目前尚不清楚安装程序还会发生其他注册表/系统更改(以及是否会使我们超过Docker容器中的目标线)

    关于如何从这里继续的任何想法?

    最佳答案

    简而言之,没有。 Windows上的docker无法进行硬件隧道/映射。在Linux上,它是通过--device=选项完成的

    如@VonC所述,您将需要使用Windows VM(可能是Hyper-V),也可以使用Virtual Box,然后可以通过Tunneling方法(添加/连接设备)提供Kinect硬件,否则就没有办法。您的容器是该VM还是不使用Windows访问主机的硬件。

    关于c# - 是否可以在Docker容器中运行Kinect V2?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47797873/

    10-13 07:58
    查看更多