如何以编程方式捕获网络摄像头照片 [英] How to programmatically capture a webcam photo
问题描述
在 Ubuntu 11.10 中以编程方式引导(来自 Bash 或 Python)用户捕捉自己的网络摄像头照片的最简单方法是什么?
我可以启动像 Cheese 这样的简单应用,但我没有找到一种简单的方法来立即检测或检索它捕获的照片.我也可以直接通过 OpenCV 访问和记录网络摄像头流,但我必须重新设计 GUI 才能与用户进行通信.
是否有任何一种脚本是一种快乐的媒介,我可以在其中启动它,并在标准输出上打印用户拍摄的图像的文件名?
如果您想通过 Python 执行此操作,看起来您有几个选择.Pygame 库能够访问相机.
如果这不令人满意,您可以转到更低的级别并访问视频 4Linux 2 API 使用 Python 的 fcntl 库直接使用 ioctl 调用.>
What's the simplest way in Ubuntu 11.10 to programmatically guide (either from Bash or Python) the user to capture a webcam photo of themselves?
I can launch a simple app like Cheese, but I don't see an easy way to immediately detect or retrieve the photo it captures. I can also access and record the webcam stream directly via OpenCV, but I'd have to reinvent the GUI to communicate with the user.
Is there any kind of script that's a happy medium, where I can launch it, and it prints on stdout the filename of the image the user took?
If you want to do this via Python, it looks like you have a few options. The Pygame library has the ability to access cameras.
If that's unsatisfactory, you can go much lower level and access the Video 4 Linux 2 API directly using ioctl calls using Python's fcntl library.
这篇关于如何以编程方式捕获网络摄像头照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!