Opencv Visual studio 2017 simple hack installation


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
  • Opencv in Visual studio 2017

    This tutorial show you how to use and install OPENCV 3 + in Visual Studio 2017. It is more hack than proper install. Use Nuget packages in package console is simple installation of opencv without setting of environmental variables and additional troubles with installation. All Visual Studio Versions needs its own build of Opencv library also the Nuget packages. VS 2012 needs version of libs V110. If you match following pictures together you have my point.. VC12 libs is version for Visual studio 2013. VC14 is lib version for Visual Studio 2015. Finally Visual Studio 2017 needs platform tool set and lib version V141. In opencv prebuild libs we need to wait to VC141. Hopefully. I never get the point of this naming convention.. Visual studio year and V140 141 110 120 but.. Current release is more confusing than the others.

    opencv VS141

    Opencv library has prebuild versions in that location after install.

    opencv visual studio 2017

    If you want to VC141 libs you need to build by CMAKE and Visual studio 2017 like in my older tutorial.. Same approach but switch visual studio version..
    Build opencv for new version of Visual Studio in cmake

    Opencv visual studio 2017 and older toolset

    Best approach is set the tool set in Visual studio project to V140 and use prebuild version of opencv libs for VS 2015 or use Nuget packages in simple 2 minutes installation also for version 2015 and enjoy coding in Visual studio 2017 until somebody solve and build the libs in VS 2017. 

    Follow and enjoy coding. Build own opencv is necessary in case using the embedded and specific HW. In case of coding on windows its better to wait for prebuild libs than install cmake on windows machine.. 

    Opencv Visual studio 2017 Step by step image tutorial

    opencv VS141

    opencv visual studio 2017opencv C ++ VS141

    Opencv nuget package console Visual studio 2017

    Previous step are really simple. Just openc empty project in C++ and add one source file source.cpp.. There is no magic and nothing to block you to start coding.. Just follow the pictures and let me know if any problems occurred. 
    Add some program, for example this for capture video from web camera.. If you try to build and link.. You will failed with no resolve dependency.. Now is the time to add. Opencv library.. Nuget is the simplest option..
    #include "opencv2\highgui.hpp"
    #include "opencv2\imgproc.hpp"
    #include "opencv2\objdetect\objdetect.hpp"
    #include "opencv2\videoio\videoio.hpp"
    #include "opencv2\imgcodecs\imgcodecs.hpp"
    #include <vector>
    #include <stdio.h>
    #include <Windows.h>
    #include <iostream>
    Now open the Nuget packages console TOOLS-NUGET Package Manager and Package Manager console.. Do not afraid of console..

    opencv visual studio 2017

     In console just write PM>  Install-Package opencvdefault 
    ONLY part start with Install..  and wait until your includes in visual studio is resolved and we see that the packages are successfully installed. We are not finished!!

    opencv visual studio 2017

    Now, if you try to build and link you will have trouble with linking.. Right click to Project name Opencv and go to general settings and change platform support to v140 to 2015.. If you do not  have this V140 you need to install something like compatibility pack.. platform toolchain for VS140..

    opencv visual studio 2017

    Compile, link and run.. Web cam is here.. It is a hack, no proper installation for VS141 but there is no reason for it.. There is no difference. Better hack than build by CMAKE on windows machine if you are not skilled enough.

    Enjoy coding in Visual studio 2017.

    opencv visual studio 2017


    1. hi
      i cant have Nuget packages on tootls
      please can you help me?