augmented-reality - SensorStreamViewer,HoloLensForCV:“初始化媒体捕获失败:访问被拒绝。”
问题描述
我试图从 获取传感器流HoloLens
,所以我使用了HoloLensForCV
. (https://github.com/Microsoft/HoloLensForCV)
首先,我检查了该SensorStreamViewer
项目是否有效,但几天后,我更新HoloLens
了它然后它不起作用。我收到的错误是Access is Denied
而且,我猜错误发生在这部分(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 信息:所需的设备功能尚未在清单中声明。
我怎么解决这个问题?
解决方案
在您的 Package.appxmanifest 文件中,您需要添加以下功能。
<rescap:Capability Name="perceptionSensorsExperimental" />
推荐阅读
- android - 膨胀类 com.nirhart.parallaxscroll.views.ParallaxScrollView 时出错
- c# - 将一个变量传递给多个用户控件 - WPF
- python - 如何绘制每年的不同统计数据
- django - 找不到“user_logout”的反向,尽管它配置得很好
- javascript - 使用 HTML 或 JavaScript 下载图像
- reactjs - Webpack 图像不加载 404
- javascript - VM118:1 未捕获的语法错误:JSON 中的意外令牌 < 位置
- r - R:来自字符串输出的“代码向量”
- python - 使用 boost.python,如何扩展类的 __dir__ 函数?
- graphql - Graphql 拉取数据进行分页