在Win7系统下为VS2010安装和配置OpenCV2.1

由于要重新开发一个机遇OpenCV2.1的程序,因此需要在Win7系统下为VS2010安装和配置OpenCV2.1。网上找了几个教程都不能正确配置,最后找到一篇英文安装的帖子,简单明了实现了配置。为了方便自己日后查看以及其他人的可能的需要,现在将配置过程记录下来。

 

原帖请见:http://opencv-srf.blogspot.it/2011/09/getting-started-with-opencv_16.html

 

Installing & Configuring OpenCV2.1 with VS 2010

Installation 
You can download the latest OpenCV library from its sourceforge.net page. But for Windows 7, Windows Vista or Windows XP SP3 users, it is easy to download Latest OpenCV Windows executable (.exe) file and just double click it to install. 

Once you have completed installing, you need to change some settings in your IDE so that it knows where to find the library files and header files of OpenCV. I’ll demonstrate the configuring process of  Microsoft Visual Studio 2010. (The configuration process is same for   Microsoft Visual C++ 2010 Express Edition (free))
 
 
Steps to Configure Microsoft Visual Studio 2010
  • Start Microsoft Visual Studio 2010
  • Go to File>New>Project>Visual C++>Win32>Win32 Console Application. Enter a name, say "HelloWorld" for your application and then click OK
 
 
Creating Visual C++ Application
  • In Visual Studio 2008
    • Go to 'Tools > Options > Projects and Solutions'
  • In Visual Studio 2010
    • Go to 'Project > Properties'  or  'Project > Helloworld Properties'  
  • Don't forget to select Configurations as 'All Configurations' as illustrated below
  • In the left pane, click  'Configuration Properties>VC++ Directories'
    • In Include Directories, add 'C:\OpenCV2.1\include\opencv'
    • In Library Directories, add 'C:\OpenCV2.1\lib'
    • In Source Directories, add 'C:\OpenCV2.1\src\cv; C:\OpenCV2.1\src\cvaux; C:\OpenCV2.1\src\cxcore; C:\OpenCV2.1\src\highgui; C:\OpenCV2.1\src\ml'
Configuring Microsoft Visual Studio for OpenCV
  • In the left pane, Click  'Configuration Properties > Linker > Input'
    • In Additional Dependencies, add 'cv210.lib; cxcore210.lib; highgui210.lib; cvaux210.lib; ml210.lib '
Configuring Microsoft Visual Studio for OpenCV
 
Now you are ready to write your first computer vision program using the 'OpenCV' library with Visual C++.

你可能感兴趣的:(在Win7系统下为VS2010安装和配置OpenCV2.1)