C ++中的网络摄像头访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1259192/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
webcam access in c++
提问by csiz
I want to access the webcam so I can do some precessing on the images, like tracking a light, but I can't find a way to access the webcam. I googled it but I got confused.
我想访问网络摄像头,以便对图像进行一些处理,例如跟踪光线,但我找不到访问网络摄像头的方法。我用谷歌搜索,但我很困惑。
Can you point me to a library that can do that (windows)? and maybe also provide an example?
你能指出一个可以做到这一点的图书馆(windows)吗?也许还提供一个例子?
I would need to periodically get a pixel map of the image, about 20 time per second or so if it would be possible.
如果可能的话,我需要定期获取图像的像素图,大约每秒 20 次左右。
采纳答案by Vijay Mathew
回答by macbirdie
You need DirectShow. This is a Windows framework for video playback and capture.
你需要DirectShow。这是一个用于视频播放和捕获的 Windows 框架。
It's included in Windows SDKand there are many samples for video input capture included.
它包含在Windows SDK 中,并且包含许多视频输入捕获示例。
But, as Vijay mentioned, you can also try using OpenCVsince it not only abstracts away the platform-specific video capture API, it also includes many image processing algorithms you could use to track the light in your project.
但是,正如 Vijay 所提到的,您也可以尝试使用OpenCV,因为它不仅抽象了特定于平台的视频捕获 API,还包括许多可用于跟踪项目中光线的图像处理算法。
回答by Jonba
There's a wrapper for DirectMedia/DirectShow called Extremely Simple Capture APIor ESCAPI. If you don't need to do anything complicated, ESCAPI might be a good bet.
DirectMedia/DirectShow 有一个名为Extremely Simple Capture API或 ESCAPI的包装器。如果您不需要做任何复杂的事情,ESCAPI 可能是一个不错的选择。
回答by Mathieu Garstecki
If you target Windows Vista (or Seven), there's the new Media Foundation SDK, which is slightly easier to manipulate and more feature-rich, and most important, will be better supported by Microsoft in the future.
如果您的目标是 Windows Vista(或 7),则有新的 Media Foundation SDK,它更易于操作且功能更丰富,最重要的是,Microsoft 将来会更好地支持它。
You can find out about it here.
And about video capture specifically here.
以及关于视频捕捉特别在这里。
回答by Abhishek
you can try openframeworks as well http://openframeworks.cc/
你也可以试试 openframeworks http://openframeworks.cc/