October 31, 2005
How to configue OpenCV in Visual Studio
tested on OpenCV 1.0 with Visual Studio 2005
tested on OpenCV 0.9 with Visual Studio 2003
If you need DXSDK support, please follow Section 2. If not, Section 1 is enough.
update 2009-1-8: for new versions of OpenCV, just adding path to VS is enough, no need to compile any more. So, please just do Section 1 step 3~5, that’s all.
Section 1 (Configure without DXSDK)
- Open “C:\Program Files\OpenCV\_make\opencv.sln“.
NOTE: @line 1138 in OpenCV file cvaux –> include –> external –> cvaux.h, there is an syntax error. change “/” to “*/“. - Build solution with both debug and release configuration. (recommond to use “Build->batch build“). If u encounter any errors, u can try to remove all files in “C:\Program Files\OpenCV\_temp” and build again.
- Open visual c++, add following path to “Tools–>Options–>Projects–>VC++ Directories–>Include files“:
C:\Program Files\OpenCV\cv\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\otherlibs\cvcam\include - Add “C:\Program Files\OpenCV\lib” to “Tools–>Options–>Projects–>VC++ Directories–>Library files“
- When create a new project,
add following to “Project–>Properties–>LinkeràInput–>Additional dependencies”
(debug) cvd.lib cxcored.lib highguid.lib cvauxd.lib
(release) cv.lib highgui.lib cvaux.lib cxcore.lib
Section 2 (Configure with DXSDK)
- Download OpenCV default installation dir is C:\Program Files\OpenCVDownload Directx SDK default installation dir is C:\DXSDK
- open
“C:\DXSDK\samples\C++\DirectShow
\BaseClasses\baseclasses.sln”
build it using both debug and release configuration.
copy ” strmbasd.lib & strmbase.lib “C:\DXSDK\lib. - open visual c++, add following path to “Tools–>Options–>Projects–>VC++ Directories–>Library files -> Include files“:
C:\DXSDK\Include
C:\DXSDK\Samples\C++\Common\Include
C:\DXSDK\Samples\C++\DirectShow\BaseClasses
add C:\DXSDK\lib to “Tools–>Options–>Projects–>VC++ Directories–>Library files -> Library Files“ - build “C:\Program Files\OpenCV\_make\opencv.sln” using both debug and release configuration. (recommond to use “Build->batch build“).if u encounter some builder errors, u can remove all files in “C:\Program Files\OpenCV\_temp” and build again.
- NOTE: @line 1138 in OpenCV file cvaux –> include –> external –> cvaux.h, there is an syntax error. change “/” to “*/“.
- build “C:\Program Files\OpenCV\_make\opencv_directshow.sln” using both debug and release configuration.(recommond to use “Build->batch build“).
- open visual c++, add following path to “Tools–>Options–>Projects–>VC++ Directories–>Include files“:
C:\Program Files\OpenCV\cv\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\otherlibs\cvcam\include - add “C:\Program Files\OpenCV\lib” to “Tools–>Options–>Projects–>VC++ Directories–>Library files -> Library Files“
- when create a new project,
add following to “Project–>Properties–>Linker->Input–>Additional dependencies”
(debug) cvd.lib cxcored.lib highguid.lib cvauxd.lib
(release) cv.lib highgui.lib cvaux.lib cxcore.lib
Reference:
LIHAO,
http://spaces.msn.com/members/meteorash/Blog/cns!1pQBr1bgHmU1smFBpCpoUZ4A!105.entry
Comments(3)


