Only for OpenCV 2.4.10 and VS2013, other versions not tested
- Download OpenCV 2.4.10 and unzip the installation
Go to OPENCV official website download: http://opencv.org/downloads.html, I downloaded the version is Opencv-2.4.10.exe.
and extract to the folder, such as my unpacked folder is D:\Program Files (x86) \opencv.
- Configuring Environment variables
Under the system variable of the environment variable, add a directory to the value of the variable named path
D:\Program Files (x86) \opencv\build\x86\vc12\bin
The green section is replaced with your own installation directory.
Because most compilers are 32-bit, x86 is chosen.
VC12 representative of VS2013,VC11 on behalf of VS2012,VC10 VS2010
So far, the system has been configured, and now you have to configure the VS2013 in the
Open VS2013, create a new empty Win32 console Project
Open the project's property manager and double-click the highlighted option, Microsoft.Cpp.Win32.user (if the debug program is configured under Debug)
Select VC + + Directory
Add the following directories in the Include directory:
D:\Program Files (x86) \opencv\build\include
D:\Program Files (x86) \OPENCV\BUILD\INCLUDE\OPENCV
D:\Program Files (x86) \opencv\build\include\opencv2
Add the following directories in the Library directory:
D:\Program Files (x86) \opencv\build\x86\vc12\lib
Check the linker's entry again:
Add the following files in the additional dependencies:
Opencv_objdetect2410d.lib
Opencv_ts2410d.lib
Opencv_video2410d.lib
Opencv_nonfree2410d.lib
Opencv_ocl2410d.lib
Opencv_photo2410d.lib
Opencv_stitching2410d.lib
Opencv_superres2410d.lib
Opencv_videostab2410d.lib
Opencv_calib3d2410d.lib
Opencv_contrib2410d.lib
Opencv_core2410d.lib
Opencv_features2d2410d.lib
Opencv_flann2410d.lib
Opencv_gpu2410d.lib
Opencv_highgui2410d.lib
Opencv_imgproc2410d.lib
Opencv_legacy2410d.lib
Opencv_ml2410d.lib
The release Microsoft.Cpp.Win32.user is configured in the release environment
Step is the same, the only difference is that the file name in the attached dependency is finally stripped D (for debug)
- Test is configured successfully
Run this code, in the working directory feel free to put a picture to spit imagetest.jpg, if you can display the image, it means that the configuration is successful
#include <opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>#include<iostream>using namespaceCV;using namespacestd;intMainvoid) {Mat image; Image= Imread ("imagetest.jpg", Imread_color);//Read the file if(!image.data)//Check for Invalid input{cout<<"Could not open or find the image"<<Std::endl; return-1; } Namedwindow ("Display window", window_autosize);//Create a window for display.Imshow ("Display window", image);//Show our image inside it.Waitkey (0);//Wait for a keystroke in the window return 0;}
Configuration of OpenCV 2.4.10 on VS2013