1 , first of all to install vs2010
2 , download opencv3.1 :
Https://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.1.0/opencv-3.1.0.exe/download
3 , download CMake :
https://cmake.org/files/v3.5/
4 , install first. CMake
5 , the OpenCV Install (unzip) to D:\Program Files\opencv (directory according to own situation)
6 , create a new folder under D:\ProgramFiles\opencv vs .
7 , open CMake , follow to set
then click on the Configure button and in the dialog box that appears, select Visual Studio Ten (Mine is . , if you are not . Select the same as you installed), the following options select Usedefault Native compilers, click Finish to continue
Then there was a large red
(This picture is not mine)
Small box inside the check mark is the default, do not change.
then click Generate. After a while, the Generatedone appeared.
8 , click on "Computer" --- "Properties" --- "Advanced system Settings" --- "Environment variables", in Path Add environment Variables in:
D:\ProgramFiles\opencv\opencv\build\x64\vc10\bin\Debug , add the semicolon before the end to the English state, OH, restart the computer after the effective.
9 opencv \vs2010 a VS2010 solution file OPENCV.sln, after double-click Open, the OpenCV 3.1 all projects, then click on " Build Solution
in this case, the vs2010 bin and the Lib Copy files to D:\PROGRAMFILES\OPENCV\OPENCV\BUILD\X64\VC10 under ( VC Ten is the folder you created), you can delete the vs2010 folder
Ten , and then configure it, first click on the SolutionExplorer (Solution Explorer) tab under Property Manager
One , in VC + changes in the project
( 1 ) Add the executable directory D:\Program Files\opencv\opencv\build\x64\vc10\bin\debug
( 2 ) in the Include directory, add
D:\ProgramFiles\opencv\opencv\build\include
D:\ProgramFiles\opencv\opencv\build\include\opencv
D:\ProgramFiles\opencv\opencv\build\include\opencv2
( 3 ) is added under the Library directory D:\Program Files\opencv\opencv\build\x64\vc10\lib\debug
A , in the linker, in the "input" ---- Add in Additional dependencies
Opencv_calib3d310d.lib
Opencv_core310d.lib
Opencv_features2d310d.lib
Opencv_flann310d.lib
Opencv_highgui310d.lib
Opencv_imgcodecs310d.lib
Opencv_imgproc310d.lib
Opencv_ml310d.lib
Opencv_objdetect310d.lib
Opencv_photo310d.lib
Opencv_shape310d.lib
Opencv_stitching310d.lib
Opencv_superres310d.lib
Opencv_ts310d.lib
Opencv_video310d.lib
Opencv_videoio310d.lib
Opencv_videostab310d.lib
Identify and close this item
A and we're going to experiment with this, okay?
Now create a new file, put a code in the image of a picture
#include <opencv2/opencv.hpp>
using namespace Std;
using namespace CV;
int main (int argc, char* argv[])
{
Const char* imagename = "d:\\yanghuan\\ scientific research \ \ Infrared night vision night vision project \ \ \ \" "Image \\photo\\hongwai1-1.jpg";
Read images from a file
Mat img = imread (imagename);
If the read-in image fails
if (Img.empty ())
{
fprintf (stderr, "Can not load Image%s\n", imagename);
return-1;
}
Display image
Imshow ("Image", IMG);
This function waits for the key and presses any key on the keyboard to return
Waitkey ();
return 0;
}
The operation results are as follows
At this point, the installation is complete.
OPENCV installation (for any version of Visual Studio)