Monday, April 19, 2010

Install OpenCV 2.1 for Microsoft Visual Studio 2008

Install OpenCV:

Configure Visual Studio:

  1. Open VC++ Directories configuration: Tools > Options > Projects and Solutions > VC++ Directories
  2. Choose "Show directories for: Include files" then Add "$openCVDir\include\opencv"
  3. Choose "Show directories for: Library files" then Add "$openCVDir\lib" (*.lib and *.dll files)
  4. Choose "Show directories for: Source files"
    Add "$openCVDir\src\cv"
    Add "$openCVDir\src\cvaux"
    Add "$openCVDir\src\cxcore"
    Add "$openCVDir\src\highgui"

Configure your Project:
After you've created a project you'll need to add the OpenCV dependencies.
Open Project Properties: Project > %projectName% Properties...
Open Linker Input properties: Configuration Properties > Linker > Input
Open the "..." window to edit "Additional Dependencies" and on each line put:
"cv210.lib"
"cxcore210.lib"
"highgui210.lib"

"ml210.lib"

"opencv_ffmpeg210.lib"

And any other lib file necessary for your project
Your project should now build. If you get any errors try restarting Visual Studio and then doing a clean Rebuild.

1 comment:

Followers