2.1) Install the OpenCV 2.4.13 that you downloaded into your PC. Choose an easy to find directory , like C:>OpenCV . When the installation is done , you will see two folders inside the OpenCV folder ( Build and Source ).
2.2) Create a new folder called OpenCV-Build into an easy to find directory , like C:OpenCV-Build.
2.3) Open the CMAKE and on the box “Where the source code is ” Select the folder OpenCV > Source (Generated by the OpenCV installation) . On the box “Where to build the binaries” Select the folder OpenCV-Build that you created.
2.4) Click one time in Generate (it will ask for you to select your compiler , choose the Visual Studio version that you are using) , and after generating is complete click in Configure. You will get some errors but it is OK because we are only installing the OpenCV without any other 3rd party libraries.
2.5) Go to the OpenCV-Build folder and open the ALLBUILD visual studio solution.
2.6) On the top Taskbar , select Debug and x64(if you have windows 64 bits ) or x86 (if you have windows 32 bits ) . After that right click the install on the right side of the window and select BUILD. It will take some time and you will get some errors (because some 3rd party libraries are missing but thats OK ).
2.7) Repeat 2.7 using the Release instead of Debug.
2.8) Close the visual studio and open again . Select new project > Visual C++ and select win32 Console Application. Choose the folder where do you want to save it ( can be anywhere ) and select a name. Click OK , it will pop up a window , select next , check the “empty project” box ( don't change the other options) and click OK.
2.9) Select Debug and x64(if you have windows 64 bits ) or x86 (if you have windows 32 bits).
2.10) Right click on the source files folder on the solution explorer (right side of the window). Click in add > new item. Select Visual C++ in the left , click on c++ File (.cpp) and then OK.
2.11) On the Solution explorer (right side ) , right click into your project name > properties.
2.12) On the top , Configuration select Debug , and platform select all.
2.13) On the left , select C/C++ > general. Into the additional include directory , add the directory : OpenCV-Build > install > include.
2.14) On the left , select Linker> general. Into the additional library directory add the directory: OpenCV-Build > install > x64 (or x86 depending on your Windows bits) > vc14 > lib.
2.15) On the left , select Linker > input. Into additional dependencies paste the following libraries: <Code> opencv_calib3d310d.lib opencv_flann310d.lib opencv_core310d.lib opencv_features2d310d.lib opencv_highgui310d.lib opencv_ml310d.lib opencv_objdetect310d.lib opencv_imgproc310d.lib opencv_video310d.lib opencv_imgcodecs310d.lib opencv_photo310d.lib opencv_shape310d.lib opencv_superres310d.lib opencv_ts310d.lib opencv_videoio310d.lib opencv_videostab310d.lib </Code>
2.16) Repeat 2.12) 2.13) 2.14) using Release configuration. In the step 2.15) you must paste the libraries names without the “d” on the final , for example opencv_calib3d310.lib instead of opencv_calib3d310d.lib.
2.17) Close the Visual Studio.
2.18) Go to your files explorer , right click into your PC icon > properties. Select advanced system settings > environment variables. Into the system variables box , find the Path variable , click to edit it. Click in new and then select your directory : OpenCV-Build > install > x64 (orx86) > vc14 > bin.
2.19) Restart your PC.
2.20) Open Visual Studio again , and open the project that you created following the previous steps. If you did everything OK you are good to go.
2.21) Copy and paste any example on the Tutorials section and see if it is running OK.