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
(佚名) |