Opencv build and install Visual Studio 2017 Contrib library

Follow

My favourite

  • Opencv tutorial people detection
  • Head people cascade download
  • Opencv tutorial optical flow
  • Opencv Video stabilization
  • Opencv car dataset download
  • Opencv tutorial Transparent mask
  • Opencv videowriter
  • Opencv FFMPEG
  • Opencv Canny edge and hough lines
  • Build install Opencv with Contrib, Visual studio 2017

    Easy install and build of Opencv 3+ tested on 3.2 version with contributor library and additional features described step by step, picture by picture. After this tutorial you can modify setting of CMAKE project according to HW possibilities and available libraries to build your own Opencv library. Most of the time, Prebuild libs with already generated DLL, LIBS are used to start project and coding. In case, that new visual studio 2017 is available there is no prebuild libraries for VS141, Thich is from my point of view confusing naming of Libraries compatible with Visual Studio 2017.
    Opencv Visual Studio 2017 build


    Opencv VS 2017 install options

    Alternatives to this tutorial. You can skip this. 
    1. There is possibility use some compatibility pack downloaded to VS140 and use same prebuild library as in case of Visual Studio 2015 this is described here
    2. The second way is to try use some prebuild NUGET package. I am using nugets a lot. Simple installation under one line of code inside nuget packages console. here

    Opencv Install and Build in Visual studio 2017 prerequisites 

    Do not afraid. There is lots of tricky parts for sure. You can miss some prerequisites for sure. You can fail many times. My last compilation has one error to link Python. I do not care. Library, I need are fine.
    1. Download CMAKE, I am using this version in the example.
    https://cmake.org/download/
    Choose windows installer Windows (Win32 Installer) cmake-3.4.0-win32-x86.exe
    Install CMAKE

         2. Install Visual studio 2017 Community, with C++ and C support, maybe also cross platform C++ and C. This is lots of space around 20 gigs per installation. Who knows what is inside. :)

    Download Opencv from github

    I have created opencv32 folder in c:/.

    Opencv Install and Build in Visual studio 2017
    To this folder i extract from following links the source code Opencv 3.2.0 and opencv_contrib-3.2.0
    just unzip here.
    Create here one blank folder opencv21build
    https://github.com/opencv/opencv/releases
    https://github.com/opencv/opencv_contrib/releases

     Opencv Install and Build in Visual studio 2017


    Configure CMAKE OPENCV project 

    Cmake configure project for Visual studio 2017 and checking what is available to be build with your own opencv libraries, ffmpeg, opencv, cuda and others.
    Add path to opencv-3.2.0, where is the base opencv source code and to the empty folder created by you called build. 
    Opencv Install and Build in Visual studio 2017
    Now you need to specify path to Visual studio 2017 compiler for C and C++.  Mine are on the picture.

    Opencv Install and Build in Visual studio 2017
    You can several times hit configure. Until you have some list of possible settings like on image below. Use different settings and configuration options. Just pick up solution you want. FFMPEG, OPENCL support and generate OPENCV.SLN file inside yout opencv32 build folder. 

    Opencv Install and Build in Visual studio 2017
    Do not choose averythink but cmake check and configure also only what is possible.. 

    Opencv Extra Modules contrib libraries 

    This is great source of modern algorithm to use. CNN, advanced tracking and detection like waldboost. Just in your cmake fill OPENCV_EXTRA_MODULES_PATH and put here path, where you extract zip from contributor git repository. HIT in cmake generate and yout Opencv.SLN file is upgraded. 

    Opencv Install and Build in Visual studio 2017

    Build and deploy opencv 

    Open from Visual studio 2017 generated opencv.sln file inside opencv32build. 
    Opencv Install and Build in Visual studio 2017

    Visual studio just ask you if you want to upgrade toolchain to Visual studio 2017. Cmake just generate 2015 but visual studio upgrade this anyway,

    In solution menu you just see all you want to build like on picture.


    1. FIRST just select DEBUG, x64 version like on picture, click right mouse on Entire solution and hit BUILD solution like on picture.  Opencv Install and Build in Visual studio 2017
    2. Second you need to switch from DEBUG to RELEASE and build the solution again. This build also cmake target install, (you can see this under install) where is your installation located. 


    Opencv Install and Build in Visual studio 2017

    You can see my release build 114 modules and 0 fails. It should works. And works.
    Your installation isn under opencv32build/install

    Opencv Install and Build in Visual studio 2017
    There is located header files in include and x64 libraries and DLL. Opencv Install and Build in Visual studio 2017

    This is your own build of opencv with specification to HW and software for any new release of Visual Studio. This is 2017. 

    NOW use same setting like to install Visual studio project as usual. Headers and libs you have build. 

    Opencv  Visual studio 2017



    No comments:

    Post a Comment

    ad