当前位置:首页 > Windows程序 > 正文

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

2021-05-25 Windows程序

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

原帖请见:

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

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/71151.html