使网络摄像头在OpenCV中工作 [英] Getting Webcam to work in OpenCV
问题描述
我正在尝试让我的网络摄像头在Windows 7 64位版本的OpenCV 2.2版中捕获视频.但是,我遇到了一些困难. OpenCV随附的所有示例二进制文件都无法检测到我的网络摄像头.最近,我发现这篇帖子暗示答案在于重新编译属性页中具有属性HAVE_VIDEOINPUT HAVE_DSHOW的文件opencv_highgui.
I'm trying to get my webcam to capture video in OpenCV, version 2.2 in Windows 7 64 bit. However, I'm having some difficulties. None of the sample binaries that come with OpenCV can detect my webcam. Recently I came across this posting which suggested that the answer lies in recompiling a file, opencv_highgui with the property HAVE_VIDEOINPUT HAVE_DSHOW in the property page.
但是,我不确定程序上该怎么做.有人可以建议如何解决吗?谢谢.
However, I'm unsure about procedurally how to do this. Can someone recommend as to how to go about this? Thanks.
推荐答案
大致上,这些是重要步骤:
Roughly, these are the important steps:
- 下载OpenCV 2.2源代码
- 根据 InstallGuide 设置一个项目进行编译.
- 进行您需要在代码中进行的任何更改,
- 构建opencv_highgui库(可能是dll和lib文件),并且
- 将它们替换为原始项目.
- Download the OpenCV 2.2 source code,
- set up a project to compile it, according to the InstallGuide,
- make any changes you need to make in the code,
- build the opencv_highgui library (dll and lib files, probably), and
- replace these in your original project.
如果您可以将项目配置为仅生成highgui文件(而不是OpenCV中的每个库),请这样做,因为您需要进行的更改不会影响其他模块.这样可以节省一些时间.
If you can configure the project to generate the highgui files only (and not every library in OpenCV), do so, since the change you need to do shouldn't affect other modules. This saves some time.
有关构建OpenCV的详细说明,请参见: http://opencv.willowgarage.com/wiki/InstallGuide .您应该遵循本指南.
The detailed instructions to build OpenCV are in: http://opencv.willowgarage.com/wiki/InstallGuide. You should follow this guide.
这篇关于使网络摄像头在OpenCV中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!