在 OSX 下分析摄像头输入
我正在寻找一种在 OSX 下以编程方式分析来自外部 USB 网络摄像头的视频源的方法。
因为我之前没有做过任何像这样的低级编程,所以我目前有点迷失从哪里开始。
如何访问网络摄像头并抓取图像数据以进行进一步处理? 此时我只是想理解基本概念,而不是寻找特定于语言的解决方案。 任何示例代码将不胜感激。
如果有人能指出我正确的方向并帮助我开始,我将非常感激。
预先非常感谢您!
托马斯
I am looking for a way to programmatically analyze a video feed from an external usb webcam under OSX.
Since I haven't done any low level programming like this before I am currently kind of lost on where to start.
How can I access a webcam feed and grab the image data to then process further?
At this point I am just trying to understand the basic concept and am not looking for language-specific solutions.
Any sample code would be highly appreciated.
I'd appreciate it very much if someone could point me in the right direction and help me get started.
Thank you very much in advance!
Thomas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用OpenCV。
如果您正在寻找显示网络摄像头图像的代码示例,请查看我之前关于此主题的答案。它将视频源转换为灰度并将其显示在窗口上:
OpenCV 2.1:运行时error
如果您只想显示帧,请将 else 块替换为:
如果您不知道如何操作帧的像素:
Use OpenCV.
And check my previous answer on this subject if you are looking for a code example to display the webcam images. It converts the video feed to grayscale and displays them on a window:
OpenCV 2.1: Runtime error
If you just want to display the frames, then replace the else block by this:
In case you are wandering how to manipulate the pixels of the frame:
要快速访问网络摄像头并操作像素数据,您可以将 Processing 与 视频库 - 最简单的开始方法是查看与 IDE 捆绑的示例。
Processing 是一种基于 Java 的可视化语言,易于学习和使用,可在 WIndows、MacOSX 和 Linux 上运行。我发现网络摄像头在我的 MacBook 上开箱即用。
下面是一个示例脚本(基于 IDE 中捆绑的示例),它加载网络摄像头源并以灰度渲染像素。
此外,还有一个很棒的OpenCV 接口,可用于边缘检测等。
For quick access to a webcam and for manipulation of pixel data, you can use Processing with the Video library - the easiest way to start is to check out the examples bundled with the IDE.
Processing is a java based visualisation language which is easy to learn and use and works on WIndows, MacOSX and Linux. I found the webcam stuff worked out of the box on my MacBook.
Here is an example script (based on an example bundled in the IDE) which loads a webcam feed and renders the pixels in greyscale.
Moreover, there is a great interface to OpenCV which can be used for edge detection etc.