无法在Mac Mojave上使用opencv访问摄像机 [英] Cannot access camera with opencv on Mac Mojave

查看:119
本文介绍了无法在Mac Mojave上使用opencv访问摄像机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从OpenCV运行一些基本代码来打开摄像头.在更新到Mac Mojave之前,我已经能够运行此代码,但是随后在构建和运行时出现此错误.

I tried running some basic code from OpenCV that opens the webcam. I was able to run this code before I updated to Mac Mojave, but afterwards I get this error when I build and run.

`[access] This app has crashed because it attempted to access privacy- 
 sensitive data without a usage description.  The app's Info.plist must 
 contain an NSCameraUsageDescription key with a string value explaining 
 to the user how the app uses this data.`

我按照其他帖子的步骤操作,并在项目(与main.cpp相同的目录)中创建了Info.plist,但是它说在解析Info.plist上的内容时遇到了问题.

I followed steps on other posts and created the Info.plist in the project(same directory as main.cpp) , however it says it has a problem parsing the contents on the Info.plist.

Info.plist:

Info.plist:

   <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>NSCameraUsageDescription</key>
    <string>uses camera to see vision targets</string>
</dict>

如何解决此问题并让其阅读Info.plist?

How can I fix this problem and have it read the Info.plist?

推荐答案

您缺少结束</plist>标记.只需将其添加为文件的最后一行,它就可以正常工作.

You're missing the closing </plist> tag. Just add that as the last line of the file and it should work.

这篇关于无法在Mac Mojave上使用opencv访问摄像机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆