以编程方式从内置 Mac 网络摄像头捕获图像
我正在为我的 imac 开发网络摄像头。当有人打开网页时,我想每隔 5 秒左右从网络摄像头向该页面发送一个新的快照。我有
因此页面每 5 秒重新加载一次。 以下是我迄今为止的尝试历史:
- 尝试使用
isightcapture
。当我在终端中运行它时,它工作正常,但在其他情况下则不然。 - 尝试使用
imagesnap
。这在终端上再次运行良好,但几乎总是生成纯绿色图像。 - 尝试使用
qt-capture
。同样,在终端上工作正常,但在其他情况下则不然。 - 尝试将这些命令放入脚本中,然后运行该脚本。没有区别。
据我所知,出于“安全原因”,苹果一直在使以编程方式操作相机变得越来越困难,这可能会导致这些问题。有人有解决办法吗?
I'm working on a webcam for my imac. When someone has the web page open, I want to send the page a new snap shot from the web cam every 5 seconds or so. I have <head><title>Live Webcam page</title><meta http-equiv="refresh" content="5" /><meta http-equiv="expires" content="0" /></head>
so the page is reloaded every 5 seconds.
Here is a history of my attempts so far:
- tried using
isightcapture
. This works fine when I run it in the terminal, but not otherwise. - tried using
imagesnap
. This, again works fine from the terminal, but almost always generates a solid green image otherwise. - tried using
qt-capture
. Again, works fine from the terminal, but not otherwise. - tried putting these commands in a script, then running the script. No difference.
I understand apple has been making it progressively more difficult to programatically operate the camera, for "security reasons", possibly causing these problems. Anyone have a solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您没有说明如何尝试调用图像捕获以供网页使用。
你能更详细地解释一下你在做什么吗?
网页的全部内容是什么?
您是直接从文件系统在浏览器中打开它,还是使用 Web 服务器和某种服务器端语言/框架来提供页面和图像?
You don't say how you are attempting to invoke the image capture for use by the web page.
Can you explain what you are doing in more detail?
What is the entire content of the web page?
Are you opening it in the browser directly from the file system, or are you using a web server and some sort of server-side language/framework to serve the page and the image?
好的,我发现苹果希望网络摄像头由“当前用户”操作,因此这些工具需要从当前用户打开的外壳运行。我可以将它们放入脚本中,然后自己运行该脚本,它们就可以工作。但是我无法从网页运行该脚本。
OK, I found that apple wants the web cam to be operated by the "current user", so these tools need to be run from a shell, opened by the current user. I can put them in a script, then run the script myself, and they work. I can't run the script from a webpage however.