VS2017 compile OpenCV + OpenCV-Contrib3.4.1

Recently doing OpenCV + QT face recognition project, need to use 32-bit OpenCV library files on the Internet to find a lot of resources, mostly based on MinGW VS2015 or QT's, 32's VS2017 (x86) version of the very few (I can not say no), and intends to compile their own. Re-compilation also met a lot of pits, the following are specific compilation.
First, the pre-compiled ready

  1. Visual Studio 2017
  2. OpenCV + OpenCV-Contrib3.4.1 source. (This file is in the official website Opencv, one is on GitHub), next up is too much trouble, and that the two must be under the corresponding version, the next time I am particularly slow, I put my downloaded into Baidu network disk inside for all to download, all the network disk file which contains the following, so I put the address at the end.
  3. CMake-Gui (I use 3.8.2) that has a detailed online tutorial, I posted one for everyone https://blog.csdn.net/u011231598/article/details/80338941
  4. Cmake during compilation need to download several files FFmpeg, ippcv, xfeatures2d \ boodsdesc, Vgg and other documents will always download fails during compilation, and I will put them Baidu network disk, and these are also the same as for the corresponding contirb version.
  5. Baidu network disk Download link: https: //pan.baidu.com/s/1GDFTdqdfx7y_pnuG6B_VTQ
    extraction code: 3e50
    Second, start compiling
    A. opencv source code under the download unpack in the same directory, open Cmake,
    The above source file directory fill opencv3 source path (not included contrib)
    the above source file directory fill in the source path opencv3 (excluding contrib), the following fill compiled the path, and then click configure, open the configuration interface is generally the default choice if you want to generate a library file x64 choose the compiler when selected later with win64, and the configuration is complete click Finish, then it will start compiling.
    B. compilation process usually reported red (that is, ERROR appears), this is what I have to say that few, mainly FFmpeg and Ippcv two, this time we should use our downloaded these two files replace the original of. After we configure a point in opencv source folder will generate a folder called .cache which we downloaded file compilation, the easiest way is my Baidu network disk in .cache folder replace the original, then you can re-configure.
    Here Insert Picture Description
    Resulting in a compilation error Cmake will be on building a file called CmakeDownLoadLog.txt the directory, the wrong information can be seen on the inside. I share a blog big brother to everyone, he speaks very clearly on these errors. https://blog.csdn.net/KayChanGEEK/article/details/79919417
    C. After re-configure, no accident, configure done message will appear, and the above process does not configure gains across the board, our first step is complete, then you can refer to this blog https: // www. cnblogs.com/kekeoutlook/p/11701511.html we are going to compile OpenCV-Contrib is necessary to CMake some configuration, we can refer to the above blog, then combine my point of view, mainly two aspects, if you want to build extensions library, that BUILD_OPENCV_World this option is not selected, and then add the module path is contrib extensions of H: \ opencv-3.4.1.1 \ opencv_contrib- 3.4.1 \ modules ( the Road King for reference only, you need to replace the path corresponding) and then configure again.
    D, then configure again no accident, then will be prompted to major gains across the board you have not downloaded some files, as shown below
    Here Insert Picture Description
    then we have to take these documents into .cache directory (the Internet was also said to put opencv_contrib-3.4.1 \ modules \ under xfeatures2d \ src directory, after I put nothing past use, recommendations or two places to put it, since have made a blog that is certainly to do it, maybe some different steps), put .cache directory next is to be noted that one that is directly to my .cache folder in the past, if they do so, remember to add a file in front of the corresponding MD code, different versions of the corresponding code value is not the same as shown below. Yes, there may download files fail face_landmark_model.dat, I will have it in the cloud pan should be placed at compile time .cache \ data below, of course, this document should also increase the MD code, the full file name is 7505c44ca4eb54b4ab1e4777cb96ac05 -face_landmark_model.DAT
    Here Insert Picture Description
    Then click again to configure, under normal circumstances would not be a rosy, rosy again if you can open the corresponding file contents inside (gains across the board, then it should be covered to a 0 byte) recopy it. Then the configuration again until configure done and no gains across the board. Then click Generate to generate vs project, after the process should be no problem. You can refer to this blog https://www.cnblogs.com/kekeoutlook/p/11701511.html.
    III Conclusion
    This article compiled under VS2017 opencv said, in fact, more of a resolution, and resource sharing Cmake error in the compilation process issues, hoping to help to you, and finally I will I compiled a 32-bit Debug | win32 libraries, and project file on Baidu cloud Baidu cloud which is also uploaded on the role of a README.txt resources which are described, we want to help. Welcome to have a problem with QQ: 1798151948 exchanges.
Released five original articles · won praise 9 · views 1278

Guess you like

Origin blog.csdn.net/qq_33685823/article/details/104739433