Need to download and install Visual Studio 2012
Then download and install OpenCV2.4.9 for Windows on OPENCV website at http://opencv.org/downloads.html
It is not recommended to select the latest 3.0.0 because I have tried but the subsequent configuration will cause problems such as Lib not found.
OPENCV installation is to extract out to a folder, and then move the folder to a directory to put it, my installation directory for F:\program, in the following repeatedly appear, need to be based on your own actual path to make changes.
Insert "At the end of the path variable in the environment variable; F:\program\opencv\build\x86\vc11\bin "(do not include double quotes depending on the actual path)
Open vs2012, create a new project-win32 console application, click "Empty Project" in the application Wizard to complete the project creation.
Open the project's resource manager, in Debug| Win32 Right-click, add a new project property sheet, the name is arbitrary.
Just create a new project property sheet, right-click Properties.
In the VC + + directory in the "Include directory" attribute, add "F:\program\opencv\build\include" (according to the actual path modification, do not include double quotation marks)
In the VC + + directory in the "Library Directory" attribute, add "F:\program\opencv\build\x86\vc11\lib" (according to the actual path modification, do not include double quotation marks, this is a directory of 32-bit vs2012)
In the linker-input "Additional Dependencies" property, add the following lines:
Opencv_core249d.lib
Opencv_imgproc249d.lib
Opencv_highgui249d.lib
Opencv_ml249d.lib
Opencv_video249d.lib
Opencv_features2d249d.lib
Opencv_calib3d249d.lib
Opencv_objdetect249d.lib
Opencv_contrib249d.lib
Opencv_legacy249d.lib
Opencv_flann249d.lib
(Here the library filename of 249 refers to the meaning of OpenCV2.4.9, before trying to 3.0.0 to modify to 300, and then compile the sample code can not find the library of the situation so do not toss, changed the 2.4.9)
When other vs projects need to be reconfigured OpenCV, do not need to do it again, just copy the created project property sheet to the corresponding folder of this project, and then in the resource manager debug| Add an existing property sheet to the Win32.
Debug is configured here, release can do the same.
Test code: Display a picture
#include <opencv2/opencv.hpp><iostream>usingnamespace cv; int Main () { *src; = Cvloadimage ("f:\\lena.jpg"); Cvshowimage ("Lena", SRC); Cvwaitkey (0); Cvreleaseimage (&src);}
Running this code requires that you have a picture in the appropriate path.
OPENCV2.4.9+VS2012 Installation and Configuration