Installing OpenCV in windows
Note: I have added snapshots lately.
This is the step by step instructions of installing opencv and configuring it with Visual studio 2008.
1) Downloaded OpenCV-2.0.0a-win32.exe opencv sourceforge site.
2) This step made a directroy C:\OpenCV2.0.
3) I installed cmake and created a project vs2008 as described in http://surfnet.dl.sourceforge.net/project/opencvlibrary/opencv-win/2.0/OpenCV-2.0.0a-win32.Readme.Please.txt This step should make a directory C:\Opencv2.0\vs2008
4) opened OpenCV.sln (C:\OpenCV2.0\vs2008\OpenCV.sln) in visual studio and build the project in both debug and release mode. It went well. It created two folders lib and bin inside the C:\OpenCV2.0 folder. To build the project click on the green arrow button in the highlighted part of the image. Notice the Debug option in the drop down. After it successfully build in debug mode change the dropdown option to Release and then build it. What this step would do is to create two directories C:\OpenCV2.0\vs2008\bin\Debug and C:\OpenCV2.0\vs2008\bin\Release. Add these two directories to system path.
5) Added C:\OpenCV2.0\vs2008\bin\Debug;C:\OpenCV2.0\vs2008\bin\Release to the system path
6) Inside visual studio i set the include and library files according to this website
[Only difference is :Tools–>Options–>Projects–>VC++ Directories–>Library files the value should be: C:\OpenCV2.0\vs2008\lib\Release C:\OpenCV2.0\vs2008\lib\Debug as suggested in a later email]
7) The above 6 steps are for common VC++ environment. Apart from this you have to change the settings for individual project properties. After you create a new project change its Project Properties as below. Project->Properties->Linker->Input->Additional Dependencies Make sure it has these libraries mentioned cv200.lib cvaux200.lib cxcore200.lib highgui200.lib separated by space.
This is OpenCV 2.0, the installation package for Windows.
The major new features: =======================
* the brand-new C++ interface, in addition to the existing OpenCV 1.x C API.
* a lot of new functionality, especially in the area of feature detectors and descriptors
* SSE2 optimization of many functions
* the revised directory structure and the completely new CMake-based build system
* completely new documentation, available offline as PDF (included) and online: http://opencv.willowgarage.com/documentation/index.html
and a lot more; please, see the ChangeLog.
Important installation notes: =============================
1. The library is better to be installed to a directory _without_ a space in its name, such as the default C:\OpenCV2.0 - otherwise (e.g. if you install it to C:\Program Files\OpenCV2.0) you may get compile errors. This is a limitation of the current build scripts.
2. Due to many technical problems the installation package does not include pre-compiled OpenCV libraries for Visual Studio users.
Instead, it includes libraries built with MinGW 4.3.3 TDM-SJLJ.
They are good enough to run the C/C++ and Python samples and tests, but for developing your OpenCV-based applications using Visual Studio, Borland IDE etc., or even a different version of MinGW, you need to build the libraries with your compiler using CMake, as explained here: http://opencv.willowgarage.com/wiki/InstallGuide.
Here is the procedure at glance: -------------------------------- 1. Download CMake from http://www.cmake.org/cmake/resources/software.html and install it.
2. Run CMake GUI tool and configure OpenCV there: 2.1. select C:\OpenCV2.0 (or the installation directory you chose) as the source directory; 2.2. choose some other directory name for the generated project files, e.g. C:\OpenCV2.0\vs2008, or D:\Work\OpenCV_MinGW etc. 2.3. press Configure button, select your preferrable build environment 2.4. adjust any options at your choice 2.5. press Configure again, then press Generate.
3a. In the case of Visual Studio or any other IDE, open the generated solution/workspace/project ..., e.g. C:\OpenCV2.0\vs2008\OpenCV.sln, build it in Release and Debug configurations. 3b. In the case of command-line Makefiles, enter the destination directory and type "make" (or "nmake" etc.)
4. Add the output directories to the system path, e.g.: C:\OpenCV2.0\vs2008\bin\Debug;C:\OpenCV2.0\vs2008\bin\Release:%PATH% It is safe to add both directories, since the Debug OpenCV DLLs have the "d" suffix, which the Release DLLs do not have.
5. Optionally, add C:\OpenCV2.0\include\opencv to the list of include directories in your IDE settings, and the output library directories (e.g. C:\OpenCV2.0\vs2008\lib\{Debug,Release}) to the list of library paths.
It is important to build both release and debug configurations, and link you code with the proper libraries in each configuration, otherwise various compile-time or run-time errors are possible.
Known issues: =============
1. Python 2.6 bindings for OpenCV are included within the package, but not installed. You can copy the subdirectory opencv/Python2.6/Lib/site-packages into the respective directory of the Python installation. This procedure will be automated in the next OpenCV update.
2. Several (actually, most) SWIG-based Python samples do not work correctly now. The reason is this problem is being investigated and the intermediate update of the OpenCV Python package will be released as soon as the problem is sorted out.
3. The library has not been tested on 64-bit Windows versions. But it is known to have some limitations in the highgui part, such as the lack of FFMPEG and DirectShow support.
4. The library can be built with VS2003.NET, and all the tests pass, but DirectShow support (via videoInput library) is not included.
Differences between OpenCV-2.0.0-win32.exe and OpenCV-2.0.0a-win32.exe: =======================================================================
1. Visual Studio 2003.NET is now supported
2. Corrected bug in matrix routines that could produce incorrect results or even cause runtime errors.
3. A few other minor changes to sync the content with the source package for Unix.
How to use OpenCV 2.0a in Visual Studio?OpenCV 2.0 now uses CMake to organize the whole project. By default, it only provides linux library. So we need to compile it first. Download Cmake for windows and install. Go to C:\OpenCV2.0, execute the following cmd cmake . -G "Visual Studio 9 2008" Change "Visual Studio 9 2008" to your default compiler. Cmake will generate a solution file (containing many projects) for you visual studio. Open it and build with “release”. Add the following path to Tools–>Options–>Projects–>VC++ Directories–>Include files C:\OpenCV2.0\include\opencv Add following path to Tools–>Options–>Projects–>VC++ Directories–>Library files C:\OpenCV2.0\lib\Release When create a new project, cv200.lib cxcore200.lib highgui200.lib Tested on OpenCV 2.0 on Visual Studio 2008
(以上转载)
================================== 安装openCV后,在 VSRS调用使用时,总是编译不过去,提示 LINK : fatal error LNK1104: cannot open file 'cv210.lib' 。感觉问题莫名其妙,因为我安装的是openCV2.0,和cv200.lib 有关才对。一晚上弄这个问题,以为是配置上出了问题,没有解决。 第二天重新来找问题原因,偶然间发现程序中有 #pragma comment(lib, "cv210.lib") 的预编译。 这才找到问题原因。把预编译注释掉。编译不再出问题。 还没来得及高兴,运行程序时却不能运行,提示计算机找不到cv200.lib ,但计算机上分明是有的。 重新建立一个工程,却没有问题。我电脑老是出现冠以现象。不再这死调了。重新关闭VSRS工程,再运行,通过了。 。。。。。。 岁月匆匆,时间就流失在解决这小问题中。。。 以后,不妨把问题放一放,将精力集中在重要的事情中,再回过头来看问题。 |