简体   繁体   English

用c ++访问网络摄像头

[英]webcam access in c++

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. 我用Google搜索,但我感到困惑。

Can you point me to a library that can do that (windows)? 你能指点一个可以做到这一点的图书馆(窗户)吗? and maybe also provide an example? 也许也提供一个例子?

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次左右,如果可能的话。

You need DirectShow . 你需要DirectShow This is a Windows framework for video playback and capture. 这是一个用于视频播放和捕获的Windows框架。

It's included in Windows SDK and there are many samples for video input capture included. 它包含在Windows SDK中 ,包含许多用于视频输入捕获的示例。

But, as Vijay mentioned, you can also try using OpenCV since 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,还包括许多图像处理算法,您可以使用它们来跟踪项目中的灯光。

There's a wrapper for DirectMedia/DirectShow called Extremely Simple Capture API or ESCAPI. 有一个名为Extremely Simple Capture API或ESCAPI的DirectMedia / DirectShow包装器。 If you don't need to do anything complicated, ESCAPI might be a good bet. 如果您不需要做任何复杂的事情,ESCAPI可能是一个不错的选择。

Checkout OpenCV . 结账OpenCV It is a cross-platform computer vision SDK and has modules to capture images from the webcam. 它是一个跨平台的计算机视觉SDK,具有从网络摄像头捕获图像的模块。 Maybe too feature rich for you, but it's worth a look. 也许你的功能太丰富了,但值得一看。

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(或者七个),那么就会有新的Media Foundation SDK,它稍微易于操作,而且功能更丰富,而且最重要的是,Microsoft将来会更好地支持它。

You can find out about it here . 你可以在这里找到它。

And about video capture specifically here . 关于这里的视频捕获。

你可以在这里使用DirectShow:

你也可以试试openframeworks http://openframeworks.cc/

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM