首页 > 解决方案 > SensorStreamViewer,HoloLensForCV:“初始化媒体捕获失败:访问被拒绝。”

问题描述

我试图从 获取传感器流HoloLens,所以我使用了HoloLensForCV. (https://github.com/Microsoft/HoloLensForCV

首先,我检查了该SensorStreamViewer项目是否有效,但几天后,我更新HoloLens了它然后它不起作用。我收到的错误是Access is Denied

HoloLens 相机视图捕获

HoloLens 隐私摄像头捕获

VS 捕获中的网络摄像头功能

而且,我猜错误发生在这部分(SensorStreamViewer.xaml.cpp)。

// Initialize MediaCapture with the specified group.
// This must occur on the UI thread because some device families
// (such as Xbox) will prompt the user to grant consent for the
// app to access cameras.
// This can raise an exception if the source no longer exists,
// or if the source could not be initialized.
return create_task(m_mediaCapture->InitializeAsync(settings))
    .then([this](task<void> initializeMediaCaptureTask)
{
    try
    {
        // Get the result of the initialization. This call will throw if initialization failed
        // This pattern is docuemnted at https://msdn.microsoft.com/en-us/library/dd997692.aspx
        initializeMediaCaptureTask.get();
        m_logger->Log("MediaCapture is successfully initialized in shared mode.");
        return true;
    }
    catch (Exception^ exception)
    {
        m_logger->Log("Failed to initialize media capture: " + exception->Message);
        return false;
    }
});

当我启动“ComputeOnDevice”等其他项目时,我可以看到一个警告消息窗口,询问我是否允许访问相机。但是,当我启动“SensorStreamViewer”时,我没有看到任何询问相机访问权限的警报消息。

我开始调试,并遇到此错误消息。

在 SensorStreamViewer.exe 中的 0x772C3332 处引发异常:Microsoft C++ 异常:Platform::AccessDeniedException ^ 在内存位置 0x0180E680。HRESULT:0x80070005 访问被拒绝。WinRT 信息:所需的设备功能尚未在清单中声明。

我怎么解决这个问题?

标签: augmented-realityhololenswindows-mixed-reality

解决方案


在您的 Package.appxmanifest 文件中,您需要添加以下功能。

<rescap:Capability Name="perceptionSensorsExperimental" />

推荐阅读