OpenCV Study notes (eight)--OPENCV 3.1.0 + opencv_contrib compilation (Windows)

Source: Internet
Author: User

Because the surf and sift algorithms are needed for feature point detection in learning image recognition, these two algorithms do not exist in the release version of OpenCV 3.1.0 because they are unstable function modules stored under the Opencv_contrib directory. So if we want to use the functionality of this directory, we need to re-compile OpenCV.


First, the preparatory work:

1. Download OPENCV installation package: https://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/

The installation process is actually the decompression process, after the installation has been completed:


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

Once the download is complete, you can use it directly, without having to install it.


Second, To generate OpenCV.sln using CMake:

1. Open the Cmake-gui.exe tool in the Cmake-gui\bin directory:

2. Fill in the appropriate parameters, including: OpenCV Source Directory and the Export Directory of OpenCV.sln project , start exporting OpenCV.sln Engineering:

The first time you export, you need to set the following to compile this OpenCV.sln Works of vs's version , here I'm using vs:

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, which is found in the configuration table " Opencv_extra_modules_path ", set its parameter value to Open_contrib in the source package. 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 select the platform information compiled before, this is the compilation generated debug version and release version of the difference:

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 catalog, you can see that a bunch of files were generated:


Iv. Configure the new library file to the project:

    1. VC + + Directory--contains directories, add:
      D:\opencv3\opencv\mybuild\install\include

    2. VC + + Directory---Library directory, add:
      D:\opencv3\opencv\mybuild\install\x86\vc12\lib
      D:\opencv3\opencv\mybuild\install\x86\vc12\staticlib

    3. Linker-to-and-attach dependencies, add: (version of release added below, note that the added library is consistent with the compilation option)

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.

OpenCV Study notes (eight)--OPENCV 3.1.0 + opencv_contrib compilation (Windows)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.