简体   繁体   English

以编程方式从内置的Mac网络摄像头捕获图像

[英]programatically capturing images from built in mac web cam

I'm working on a webcam for my imac. 我正在为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. 当有人打开网页时,我想每5秒钟左右从网络摄像头向该页面发送一次新快照。 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. 我有<head><title>Live Webcam page</title><meta http-equiv="refresh" content="5" /><meta http-equiv="expires" content="0" /></head>因此每5秒钟重新加载一次页面。 Here is a history of my attempts so far: 这是到目前为止我的尝试历史:

  1. tried using isightcapture . 尝试使用isightcapture This works fine when I run it in the terminal, but not otherwise. 当我在终端中运行它时,这可以正常工作,但不能运行。
  2. tried using imagesnap . 尝试使用imagesnap This, again works fine from the terminal, but almost always generates a solid green image otherwise. 从终端再次可以正常工作,但是几乎总是生成稳定的绿色图像。
  3. tried using qt-capture . 尝试使用qt-capture Again, works fine from the terminal, but not otherwise. 同样,从终端可以正常运行,但不能正常运行。
  4. 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? 有人有解决办法吗?

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? 您是在浏览器中直接从文件系统直接打开它,还是在使用Web服务器和某种服务器端语言/框架来提供页面和图像?

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. 好的,我发现Apple希望网络摄像头由“当前用户”操作,因此这些工具需要从当前用户打开的外壳中运行。 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. 但是,我无法从网页运行脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Safari 浏览器中关闭已连接的 mac book 网络摄像头和摄像头 LED 灯? - How to turn off connected mac book web cam and cam led light in safari browser? 如何在Mac OS的Node.js中读取流网络摄像头? - How read stream web cam in node.js for mac os? OpenCV:从cam编写视频,结果奇怪(Python和Mac) - OpenCV: Writing a video from a cam, strange results (Python and Mac) 将屏幕变为虚拟网络摄像头 - Turning a screen into a virtual web cam 无论如何要在 Mac OS 上使用 PHPmyadmin 和内置 web 服务器的 php 5.5? - Anyway to use PHPmyadmin with php 5.5 built in web server on Mac OS? 在 Cocoa 中从 Mac 捕获音频并保存到文件的代码示例? - Code sample for capturing audio from a Mac in Cocoa and saving to file? 从Mac上运行的Silverlight OOB应用程序捕获跟踪/调试信息 - Capturing trace/debug information from a Silverlight OOB app running on a Mac 如何在可可Mac中显示来自plist的图像 - How to display images from plist in cocoa mac Java Runtime无法在Mac上捕获STDOUT - Java Runtime not capturing STDOUT on Mac 在Mac OS X上使用内置Apache进行Web开发的优点/缺点 - Advantages/disadvantages of using the built-in Apache for web development on Mac OS X
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM