Why should CMake, here I state my idea, as a just use OPENCV library of small white, have the following about three points content
1. Due to the use of various edge protection filter (EPS) algorithms in the Learning image processing filter, these algorithms are rare in release versions of OpenCV 3.1.0 because they store a large number of algorithms in OPENCV_ Contrib directory under the Ximgproc folder under the Unstable function module, so if we want to use the function of this directory, we need to re-OPENCV compilation.
2. Since the official opencv3.1.0 is to be used on x64 and used in visual studio2013 including its own platform, how can it be used in a previous version or run on a x86 machine? This is one of the reasons to CMake.
3. Because OpenCV is open Source Library, need to see the source code, understand how the algorithm is implemented in the CMake, you can see ...
Would it be hard for cmake to say so much? I have tried one or two times to succeed, the exact answer is not too difficult, the following are specific preparations and steps
First, the preparatory work:
1. Download OPENCV installation package: Https://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.1.0/opencv-3.1.0.exe/download
The installation process is actually the decompression process, after the installation is completed (this changes the file name):
2. Download Opencv_contrib Source: Https://github.com/Itseez/opencv_contrib
After downloading the direct decompression, get the source directory:
3. Download Cmake-gui tool: http://www.cmake.org/cmake/resources/software.html
Choose not to install the version, according to their own model select X86 or X64, after the download is complete, directly decompression can be used, do not have to install.
Due to the reasons for the slow download, can not step by step, the following will use the following links to the first one. Add your own point of view on the basis of related links, and the problems encountered, as well as the handling
Second, use CMake to generate OpenCV.sln:
1. Open the Cmake-gui.exe tool in the Cmake-gui\bin directory:
2. Fill in the corresponding parameters, including: OpenCV source directory and OpenCV.sln project export directory, began to export OpenCV.sln project:
For the first time, you need to set up the version of VS that will be used to compile this OpenCV.sln project (in particular, it is important to note that there is a corresponding VS version on your machine, if it is not installed, it will be wrong to compile, it may not be possible to find the corresponding tool, and to choose X86 and X64), here is the VS 2015, you can also choose Visual Studio 10, which can be used on VS2010:
Click "Generate" to start building the project after the setup is complete:
3. After the first compilation is complete, we need to add additional opencv_contrib to the project for a second compilation, find "Opencv_extra_modules_path" in the configuration table, set its parameter value to Open_ Contrib source package in the Modles directory, my directory is "E:\OpenCV\tools\opencv_contrib-master\modules":
After the setup is finished, click Configure to configure it, and then compile the second time without error:
The second compilation is usually done in a very short time:
After compiling, we look at the file output directory set above in the Explorer, and found a lot of files in the directory, in fact, OpenCV.sln project file:
Third, open the OpenCV.sln project with VS, compile and generate debug and release libraries:
1. Open the OpenCV.sln project with VS 2015 to view the project catalog in the solution:
2. Compile and build the debug version of the library, remember to choose to compile the platform information before, this is the compilation to build debug version and release version of the difference, you can also choose release, because your project may need to use the corresponding dynamic link library:
In the solution Select Project, right-click to rebuild the solution:
3. Locate the install in the cmaketargets and then right-select "Project only" and "Generate Install only":
Then, in the install directory under the project directory, you can see that a bunch of files have been generated, and this heap of files is similar to the top:
Iv. Configure the new library file to the project:
VC + + Directory--contains directories, add:
D:\opencv3\opencv\mybuild\install\include
VC + + Directory---Library directory, add:
D:\opencv3\opencv\mybuild\install\x86\vc12\lib
D:\opencv3\opencv\mybuild\install\x86\vc12\staticlib
Linker-to-and-attach dependencies, add: (the release version added below, note that the added library is consistent with the compilation options, you need to be aware that debug is more than the file name of release D)
Opencv_aruco310.lib
Opencv_bgsegm310.lib
Opencv_bioinspired310.lib
Opencv_calib3d310.lib
Opencv_ccalib310.lib
Opencv_core310.lib
Opencv_datasets310.lib
Opencv_dnn310.lib
Opencv_dpm310.lib
Opencv_face310.lib
Opencv_features2d310.lib
Opencv_flann310.lib
Opencv_fuzzy310.lib
Opencv_highgui310.lib
Opencv_imgcodecs310.lib
Opencv_imgproc310.lib
Opencv_line_descriptor310.lib
Opencv_ml310.lib
Opencv_objdetect310.lib
Opencv_optflow310.lib
Opencv_photo310.lib
Opencv_plot310.lib
Opencv_reg310.lib
Opencv_rgbd310.lib
Opencv_saliency310.lib
Opencv_shape310.lib
Opencv_stereo310.lib
Opencv_stitching310.lib
Opencv_structured_light310.lib
Opencv_superres310.lib
Opencv_surface_matching310.lib
Opencv_text310.lib
Opencv_tracking310.lib
Opencv_ts310.lib
Opencv_video310.lib
Opencv_videoio310.lib
Opencv_videostab310.lib
Opencv_xfeatures2d310.lib
Opencv_ximgproc310.lib
Opencv_xobjdetect310.lib
Opencv_xphoto310.lib
Ippicvmt.lib
4, about the problem of Imread. If the picture name is present in the TXT document, and you extract it to the list by using the Readimagelists method, pay special attention to the newline character of the TXT document that must be "UNIX final bundle character-lf". Otherwise, the read file name will be more than "\ r" characters, resulting in the reading of image files failed.
RELATED Links: http://blog.csdn.net/linshuhe1/article/details/51221015
RELATED Links: http://www.cnblogs.com/asmer-stone/p/5530868.html
RELATED Links: http://www.yidongtime.com/Html/dev/web/20160305/55517.html
Compiling extensions OpenCV 3.1.0 + opencv_contrib under Windows