📄 faq.cn.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=GBK"><title>OpenCV 文档 (draft)</title>
</head><body>
<center><table cellspacing=0 cellpadding=5 width="90%" bgcolor="#6a9bed" nosave >
<tr nosave>
<td nosave>
<center><i><font color="#000000"><font size=+4>
常见问题及解决方法
</font></font></i></center>
</td>
</tr>
</table></center>
<p>中文翻译者:
<ul>
<li><a href="mailto:yushiqi@yahoo.com.cn">于仕琪</a>,<a href="http://fsa.ia.ac.cn">中科院自动化所自由软件协会</a>
<li>HUNNISH,<a href="http://www.assuredigit.com">阿须数码</a>
</ul>
</p>
<hr>
<h1>一般性问题</h1>
<hr><h3>如何正确安装 OpenCV ?</h3>
<p>阅读<a href="../INSTALL">安装指南</a>
<hr><h3>如何快速认识 OpenCV ?</h3>
<p>
<ol><li>参考<a href="../samples/c/">例子</a>。
<li>在 Visual Studio 中加载 <a href="../_make/">OpenCV workspace</a>:
<ul>
<li>Microsoft Visual Studio 6.0 使用 opencv.dsw
<li>Miscrosoft Visual Studio .NET 2003 使用 opencv.sln
<li>Borland C++ BuilderX 使用 cbuilderx/opencv.bpgr
</ul>
选择 <code>cvsample</code>
项目,编译并运行。阅读代码并且按照自己的想法更改它。
<li>>也可通读<a href="index.htm#ref">参考手册</a> - 里面也包含一些例子代码。
<li>
在<a href="http://groups.yahoo.com/group/OpenCV">http://groups.yahoo.com/group/OpenCV</a>OpenCV archives
搜索你感兴趣的主题。
<li>
从 <a href="#devstudio_project">scratch</a>
创建新的项目,或者修改现有的 <code>cvsample</code>。
有专门为 Microsoft Visual Studio 设计的 application wizard 用来创建 OpenCV-aware 项目;
它们从 <a href="http://groups.yahoo.com/group/OpenCV">http://groups.yahoo.com/group/OpenCV</a>
(Files section - 你必须注册为 OpenCV@yahoogroups.com 用户)
查找到。
</ol>
</p>
<hr><h3>哪里可以报告OPENCV的BUG?</h3>
<p>发送邮件到 <a href="mailto:OpenCV@yahoogroups.com">OpenCV@yahoogroups.com</a> ;
主题:BUG <....your title...>;</p>
<hr><h3>怎么报告 Intel® Ingegrated Performance Primitives 的BUG?</h3>
<p>发送有件到 <a href="mailto:developer_support@intel.com">developer_support@intel.com</a></p>
<hr><h3>怎么加入 OpenCV 论坛?</h3>
<p>发送邮件到 <a href="mailto:OpenCV-subscribe@yahoogroups.com">OpenCV-subscribe@yahoogroups.com</a>,
成为成员后并登录后,你可以在
<a href="http://groups.yahoo.com/group/OpenCV">http://groups.yahoo.com/group/OpenCV</a>阅读内容。</p>
<p>译者注:<a href="http://www.assuredigit.com">阿须数码技术有限公司</a>
设立了一个<a href="http://www.assuredigit.com/forum">中文OPENCV论坛</a>,可以在那里找到很多有用资料。</p>
<hr><h3>怎么修改用户组设置使得不再收到大量邮件?</h3>
<p>
想实时获得邮件,或者一天只接收一次邮件摘要,
可以访问<a href="http://groups.yahoo.com/mygroups" target="_top">http://groups.yahoo.com/mygroups</a>
可以从OpenCV的下拉选单中选择你的设置。</p>
<hr><h3>好,我发现用户组一点没用。如何退掉我订阅的邮件列表?</h3>
<p>发送标题为<b>[OpenCV]</b>的邮件到
<a href="mailto:OpenCV-unsubscribe@yahoogroups.com">OpenCV-unsubscribe@yahoogroups.com</a>
邮件体内容可以任意。</p>
<hr><h3>当同时使用 OpenCV 和 IPL,发生编译错误。怎么解决这个问题?</h3>
<p>
为了完全独立于 IPL (INTEL的图像处理库), OpenCV 复制了 IplImage
和其它一些结构变量的声明。 在 OpenCV 头前面定义 HAVE_IPL
或者将语句 "#include <ipl.h>" 放置于 OpenCV
头文件的前面,可以解决这个冲突。</p>
<hr><h3>OpenCV 可以工作在其它处理器下吗?</h3>
<p>
是的,OpenCV 本身是开放源代码的,而且非常便于移植(特别是在32位平台上)。
从另外一方面看,如果采用 INTEL 处理器,那么依靠 <a href="index.htm#ipp">IPP</a> ,OpenCV
可以运行得更快。</p>
<hr><h1>Windows® 操作系统的相关问题:</h1>
<hr>
<h3>
当我试图编译其中的应用程序时,得到错误:streams.h not found.</h3>
<p>你需要 DirectShow SDK ,它是 DirectX SDK 的一部分。</p>
<ol>
<li>
从 msdn.microsoft.com/directx/ 下载 DirectX,(文件很大,但是可以只下载部分)。
如果不能正常工作,考虑一下 HighGUI,它利用 VFW 或 MIL 来扑捉视频序列。
<li>>带例子安装。
<li>打开项目 <DirectXSDKInstallFolder>\samples\C++\DirectShow\BaseClasses\baseclasses.{dsw|sln}.
如果没有这个文件,要么是你没有下载样例,要么是路径不对。
如果是后者,寻找 streams.h 并在同一个文件夹下打开一个 workspace 文件。
<li>编译建立库的 Release 和 Debug 版本。
<li>将产生的库 (在 DirectX 9.x 中,分别叫 strmbase.lib 和
strmbasd.lib) 拷贝到目录 <DirectXSDKInstallFolder>\lib 下。
<li>在 Developer Studio 添加路径:<p>
<DirectXSDKInstallFolder>\include<br>
<DirectXSDKInstallFolder>\samples\C++\DirectShow\BaseClasses<br>
</p>
<p>到 includes' 搜索路径中 (在 Developer Studio 6.0 情况下是 Tools->Options->Directories->Include files)</p>
<p>添加 <DirectXSDKInstallFolder>\lib 到库搜索路径中 (在 Developer Studio 6.0 情况下是 Tools->Options->Directories->Library files)
</p>
<p><b>注意:将上面增加的东东添加到最顶端,否则还会出现编译或链接错误。
因为 Developer Studio 6.0 包含了一些老版本的 DirectX 头文件和库文件,它们与新版本有冲突。</b></p>
<li>大功告成!
</ol>
<hr><h3>安装了 DirectX SDK 后,仍然有链接错误,提示:undefined
or redefined "TransInPlace" filter class constructors etc.</h3>
<p>阅读前面的示范,特别注意搜索目录的次序。</p>
<hr><h3>当我试图使用 cvcam 时, 程序崩溃</h3>
<p>请确认是否已经注册了 ProxyTrans.ax 和 SyncFilter.ax</p>
<!-- <hr><h3>CamShiftDemo can not be run</h3>
<p>Make sure, you registered CamShift.ax and you have DirectShow-compatible camera</p> -->
<hr><h3>怎么注册 *.ax (DirectShow filter)?</h3>
<p>在“资源管理器”中用regsvr32.exe打开这个文件。
在 Win2000 中可以通过右键点击Open with->Choose Program...->Browse...->c:\windows\system32\regsvr32.exe
(路径可能有所差别)。
你可以让计算机记住*.ax跟regsvr32.exe的联系,以后双击*.ax则可。</p>
<hr><h3>Filter 不能被注册 (regsvr32 报告错误)</h3>
<p>最可能的原因是 filter 需要的一些 DLLs
不在路径中。这种情况下,请确认 <OpenInstallFolder>\bin 在路径中。<p>
<!-- <hr><h3>LKDemo / HMMDemo reports an error during startup and no the view is completely black</h3>
<p>To run either of these apps you will need VFW-compatible camera.
At startup the programs iterate through registered video capture devices.
It might be that they could not find one. Try to select the camera manually
by pressing "tune capture parameters" (camera) toolbar button. Then, try to
setup video format (the button on the left from camera) to make the camera work.
</p> -->
<hr><h3>cxcore096d.dll 或 cxcored.lib 好像丢失了</h3>
<p>cxcore096d.dll 是 cxcore DLL 的 DEBUG 版本,cxcored.lib 是
cxcore096d.dll 的输入库。打开Open <a href="../_make/">OpenCV workspace</a>,
选择 "cxcore" 作为 active project,并且选择 "Win32 Debug"
的配置. 编译建立库,这样就得到 bin\cxcore096d.dll 和
lib\cxcored.lib。 同样步骤可以生成其它所有的 OpenCV 组件。加 <em>d</em>
表示 Debug 版本。</p>
<hr><h3>当我编译 HighGUI ,得到错误 "mil.h is not found"</h3>
mil.h 是 Matrox Imaging Library (MIL) 的一个部分,提供
Matrox (或兼容) 视频采集卡,如 Meteor, Meteor II 等
<ul>
<li>如果你安装了一个这样的采集卡和MIL,添加 mil\include 和 mil\lib
到 Developer Studio 的搜索路径中(菜单 Tools->Options->Directories)。
<li>如果你没有 MIL,忽略这个错误则可,文件 mil.h 只是用来编译
带有 MIL 的 HighGUI "Win32 MIL Debug" 或者 "Win32 MIL Release"。
选择HighGUI的 "Win32 Debug" 或者 "Win32 Release" 的配置
(菜单 Build->Set Active Configuration...)来代替,
这两个版本的HighGUI仍然能够通过 VFW 借口采集视频,处理 AVI 文件和静态图像。
</ul>
<hr><h3>如何调试 DirectShow filter?</h3>
<p><ul>
<li>打开带 FILTER 的 workspace (e.g. opencv.dsw),
<li>选择 filter 作为活动项目,在 debug 配置下编译它,
<li>切换到“资源管理器”,注册 filter 的 debug 版本
(例如 regsvr32 camshiftd.ax)(当 debug/release 版本切换的时候,只需要做一次就可以了,注册表里仅保存
filter 的名字),
<li>回到 Developer Studio 然后开始 debugging 过程 (F5)。
在提示 “do you want to run to debug the
module”下,选择 camshiftdemo 通过 camshift.ax 和
DirectX SDK 工具图形编辑器 graphedit 来调试 DirectShow filter。
<li>在 graphedit 中建立 filter 图 (即 camera->camshift->renderer)
<li>保存 graph (下次只要打开就可以了)
<li>在filter中的 Transform 方法或其它位置设置断点。
<li> 运行 filter,好好体会吧。
</ul>
<hr><h3><a name="devstudio_project">怎么创建一个 DeveloperStudio 项目来开始玩 OpenCV</a></h3>
<p>(注意:这是一个很罗嗦的解答)</p>
<p>为了在 Developer Studio
下创建基于 OpenCV 的项目,按如下步骤进行:</p>
<ol>
<li>在 Developer Studio 中创建新的应用程序:
<ol>
<li>选择菜单 "File"->"New..."->"Projects" 标签。
选择 "Win32 Application" 或者 "Win32 console application" -
后者是简单的方法,例程都采用这种类型。
<li>键入项目名称,并且选择保存位置。
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -