织梦CMS - 轻松建站从此开始!

罗索

OpenCV的DirectShow在Visual Studio 2005环境下的配置方法

罗索客 发布于 2009-06-17 21:42 点击:次 
这两天为了让OpenCV在VS2005下跑起来还是花了不少冤枉时间的,把过程写下来小结一下
TAG:

Step 1. 编译%OPENCV%\\_make\\opencv.sln,中间会碰到

 “fatal error LNK1181: 无法打开输入文件“cvauxd.lib”
 “error C2039: “foreground_regions” : 不是“CvFGDStatModel”的成员”
 
 这样的错误信息,打开cvaux\\Include\\External\\cvaux.h文件,里面有一行的结束是乱码,导致注释结束在下一行,去掉乱码让注释在行尾结束即可

Step 2. 编译%OPENCV%\\_make\\opencv_directshow.sln

 按照cvstreams.h里的步骤做就可以了

/***************** How to get Visual Studio understand streams.h ****************\\

You need DirectShow SDK that is now a part of Platform SDK
(Windows Server 2003 SP1 SDK or later),
and DirectX SDK (2006 April or later).

1. Download the Platform SDK from
   http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
   and DirectX SDK from msdn.microsoft.com/directx/
   (They are huge, but you can download it by parts).
   If it doesn''''t work for you, consider HighGUI that can capture video via VFW or MIL

2. Install Platform SDK together with DirectShow SDK.
   Install DirectX (with or without sample code).

3. Build baseclasses.
   See <PlatformSDKInstallFolder>\\samples\\multimedia\\directshow\\readme.txt.
   (简而言之,过程是:Start->All Programs->Microsoft Platform SDK for Windows Server 2003 R2->Open Build Environment Window->选择适合自己操作系统的,分别在Debug和Retail模式下进入<PlatformSDKInstallFolder>\\samples\\multimedia\\directshow\\BaseClasses文件夹,敲入nmake,回车)

4. Copy the built libraries (called strmbase.lib and strmbasd.lib
   in Release and Debug versions, respectively) to
   <PlatformSDKInstallFolder>\\lib.

5. In Developer Studio add the following paths:
      <DirectXSDKInstallFolder>\\include
      <PlatformSDKInstallFolder>\\include
      <PlatformSDKInstallFolder>\\samples\\multimedia\\directshow\\baseclasses
    to the includes'''' search path
    (at Tools->Options->Directories->Include files in case of Visual Studio 6.0,
     at Tools->Options->Projects and Solutions->VC++ Directories->Include files in case
     of Visual Studio 2005)
   Add
      <DirectXSDKInstallFolder>\\lib
      <PlatformSDKInstallFolder>\\lib
   to the libraries'''' search path (in the same dialog, ...->"Library files" page)

   NOTE: PUT THE ADDED LINES ON THE VERY TOP OF THE LISTS, OTHERWISE YOU MAY STILL GET
   COMPILER OR LINKER ERRORS. This is necessary, because Visual Studio
   may include older versions of the same headers and libraries.

6. Now you can build OpenCV DirectShow filters.

\\***********************************************************************************/

OK,现在可以用了。

小结一下,花了很多冤枉时间的主要原因是不知道 DirectShow 从 DXSDK 9.0c 开始已经分离出来,加入到了 Platform SDK 中;更土的一点的是,Platform SDK 现在的名字叫做 Windows Server 2003 SP1/SP2 SDK,据说以后要改名叫做 Windows SDK

(佚名)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/200906/7308.html]
本文出处:不详 作者:佚名
顶一下
(1)
100%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容