1. Download opencv2.4.3from http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.3;
2. Place opencv-2.4.3.exe in the d: \ soft \ opencv2.4.3 folder, decompress it to the current folder, and generate an opencv folder;
3. Download and install cmake: http://www.cmake.org/cmake/resources/software.html
4. From http://www.python.org/
Download the python-2.7.3.msi installation to the D: \ python27 directory,
5. Download python-2.7.3.tar from the http://www.python.org to the d: \ soft \ Python folder, decompress it to the current folder, and generate a python-2.7.3 folder;
6. open pcbuild in the d: \ soft \ Python-2.7.3 \ pcbuild folder with vs2008. SLN project, select solutionpcbuild, right-click, select Properties, set in release and debug respectively, common
Properties --> startup project --> select Python under singlestartup project; then select Configuration properties --> configuration, and only select Python and pythoncore;
7. debug and release respectively, select the make_buildinfo project and rebuild, then select the make_versioninfo project, rebuild, and Solution
Pcbuild and rebuild generate python27.lib, python27_d.lib, python27.dll, and python27_d.dll in the d: \ soft \ Python-2.7.3 \ pcbuild folder;
8. Copy python27_d.lib to the d: \ python27 \ libs folder (in this way, opencv can be compiled normally under debug; otherwise, python27_d.lib cannot be found );
9. Run cmake (cmake-Gui) and enter the decompressed file path in the source code of whereis, such as D: \ soft \ opencv2.4.3 \ opencv in where
To build the binaries, fill in the path to be stored during compilation, such as D: \ soft \ opencv2.4.3 \ vs2008. This vs2008 folder needs to be created by yourself;
10. Click Configure. In the displayed dialog box, select Visual Studio 9 2008 and click Finish;
11. If a red box is displayed, click Configure;
12. Click Generate. If the machine itself does not support cuda, a red prompt will still be displayed, so ignore it;
13. After completing the preceding steps, the opencv. sln file is displayed in the vs2008 folder;
14. Use vs2008 to open the opencv. sln file. Under debug and release, select solution.
In explorer, right-click solution opencv, Run "rebuild solution", click Install under cmaketargets, and build will be in D: \ soft \ opencv2.4.3 \ vs2008 \ install stores the corresponding dynamic library in the bin folder, and the corresponding static library in the Lib folder;
15. Open vs2008, create a console application, and configure the opencv environment for vs2008: select the menu tools --> options --> Project
And Solutions --> VC ++ directories, show directories
Select include files and add the Directory D: \ soft \ opencv2.4.3 \ vs2008 \ install \ include D: \ soft \ opencv2.4.3 \ vs2008 \ install \ include \ opencvd: \ soft \ opencv2.4.3 \ vs2008 \ install \ include \ opencv2; showdirectories
For, select library files and add the Directory D: \ soft \ opencv2.4.3 \ vs2008 \ install \ Lib.
;
16. Add D: \ soft \ opencv2.4.3 \ vs2008 \ install \ bin to the path of the Windows system environment variable and restart the system;
17. Add the corresponding. Lib Library to the dependent library.
# Include
"Stdafx. H"
# Include
<Opencv2/opencv. HPP>
Using
Namespace CV;
Int
_ Tmain (int
Argc, _ tchar *
Argv [])
{
Mat MAT =
Imread ("1.jpg ");
Namedwindow ("showimage ");
Imshow ("showimage ",
Mat );
Waitkey (0 );
Return 0;
}
References:
1. http://www.cnblogs.com/tornadomeet/archive/2012/11/07/2759476.html
2. http://code.opencv.org/projects/opencv/wiki/ChangeLoghttp://code.opencv.org/projects/opencv/wiki/ChangeLog
3. http://www.cnblogs.com/pzxbc/archive/2012/01/12/2320736.html
4. http://www.cnblogs.com/heshizhu/archive/2012/08/09/2630346.html