Second, VS2012 configuration OpenCV

Reference: http://www.cnblogs.com/mxbs/p/6187835.html

Step 1: Preparatory work before configuration.

Complete the installation of VS2012, and the download and file extraction of opencv-2.4.10,

Double-click this file and set the file path to get the extracted file. The extracted file is named after OpenCV.

Step 2: Configure system environment variables.

Right-click "Computer" -> "Properties" -> "Advanced System Settings" -> "Environment Variables", where you need to modify "User Variables" and "System Variables".

In "User Variables", select "New", as shown in the figure below.

 

In "System Variables", select "Path" -> "Edit", as shown in the figure below, be careful to separate them with a semicolon ";". 

Note: You need to choose x86 here, because the vs2012 compilation environment uses the win32 compiler by default. The choice of x86 or x64 here has nothing to do with whether your system is 32-bit or 64-bit.

The third step, configure VS2012

Open VS2012, select a new project, name it TestOpenCV, select "Empty Project", and finish. Add the source file testOpenCV as shown:

Open "View" -> "Property Manager", expand to Debug|Win32, right-click and select "Add New Project Property Sheet", name it OpenCV_Debug_Setting.props, double-click to open this property sheet,

 

Under "General Properties" -> "VC++ Directories", set the include directory and library directory respectively.

Include directory:

C:\OpenCV\build\include\opencv2

C:\OpenCV\build\include\opencv

C:\OpenCV\build\include

 

 

library directory:

C:\OpenCV\build\x86\vc11\lib

 

 

 

Select "Common Properties" -> "Linker" -> "Input" -> "Additional Dependencies", add the library file in the additional dependencies: the path is C:\OpenCV\build\x86\vc11\lib

Add all files with "d" at the end and the suffix ".lib" in this path, such as opencv_calib3d2410d.lib. as the picture shows.

So far, the work of configuring OpenCV2.4.13 in the VS2012 environment has been completed. You can export and save the configuration file OpenCV_Debug_Setting.props. For the OpenCV project created later, you only need to add the property configuration of this project, no need to step by step. Repeat configuration.

The third step is to test the configuration

Type the following code in testOpenCV.cpp,

You can see the displayed picture.

Indicates that the configuration has been successful.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325247005&siteId=291194637