April 2017

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
  • Opencv target tracking example

    opencv tracking tutorial

    The computer vision is just super fun. Machine learning with just visible results.. This is so powerful to bring more people intogame. To apply K means clustering to millions of line data-set and obtain 10 clusters. Cool. Sure. Where is the fun_ This is actually super cool. Machine learning, good know of video image properties, optical flow control theory, optimization, feature extraction and others super cool staf. 

    Share, subscribe, This support me to continue


     

    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



    Simple Installation opencv Visual Studio 2017

    Simple installation of opencv for Visual studio 2017 by image example. Easy and fast way to start coding in opencv by Nuget packages. If your plan is going to use cuda, or some advanced opencv settings. You should install opencv in different way. For example build your own libs according to HW you have available.. This will be my next tutorial.

    If you want to play and make a fun in Visual Studio 2017 this is tutorial for you. All mine tutorials for Opencv is now running just based on NUGET packages installation. For most common purpose is this installation just fine.

    OPENCV VISUAL STUDIO 2017 need vs141 libs version

    This doesn't make any sense to me Visual Studio 2012 was 110 lib version, 2013 was 113, Visual studio 2015 has VS140 lib version and now the big step forward. Visual studio 2017 you are finding DLL, libs etc compatible with VS141.. What a big step from previous visual studio :)

    Instal opencv under 1 minute 

    On nuget package side find nuget distribution. This will install library, DLL and header just into your project. Find the right NUGET for you on https://www.nuget.org/packages

    Find support VS141
    openCV for Windows
    320.1.1-vs141

    I just try this nuget and It works fine for 86 version build in VS 2017.
    Install-Package opencv.win.native -Pre
    x86/x64 builds for OpenCV 3.2 release for Visual Studio 2017

    Install Step by step

    • Create empty C++ project
    • Click on source file on Right and add new source.cpp file. 
    • Add source code. You will see unresolved dependencies and other staff. Just because your functions try to find where are they implemented.  


    opencv nuget visual studio 2017


    • Your Visual Studio 2017 needs NUGET packages extension installed. The installation of VS17 is more modular than before, but NUGET are most common extension. 
    • In tools - Nuget Packages Manager - open Package Manager Console
    • Write here simple Install-Package opencv.win.native -Pre     OR any others you find 
    • On second picture you can see that Nuget is installed 


    Now, You can compile at least 86 build and released without any problem. I am tested just this packages. The next tutorial show how to build your own libraries.. See you




    Helping on stackoverflow

    Maybe some of this ideas are useful also for you. 

    Question was?? 

    You have one people income stream and you need to determine exit points, Right, Left or just straight. Use detection and statistic or whole tracking.


    tracking is best to solve this problem, I think


    This is my ansfer.
    The best accurate way is to use tracking algorithm instead of statistic appearance counting of incoming  people and detection occurred left right and middle..
    You can use extended statistical models.. That produce how many inputs producing one of the outputs and back validate from output detection the input.

    People detection


    My experience is that tracking leads to better results than approach above. But is also little bit complicated. We talk about multi target tracking when the critical is match detection with tracked model which should be update based on detection. If tracking is matched with wrong model. The problems are there.
    [![enter image description here][1]][1]

    Here on youtube I developed some multi target tracker by simple LBP people detector, but multi model and kalman filter for tracking. Both capabilities are available in opencv. You need to when something is detected create new kalman filter for each object and update in case you match same detection. Predict in case detection is not here in frame and also remove the Kalman i it is not necessary to track any more.
    1 Detect
    2 Match detections with kalmans, hungarian algorithm and l2 norm. (for example)
    3 Lot of work. Decide if kalman shoudl be established, remove, update, or results is not detected and should be predicted. This is lot of work here.
    Pure statistic approach is less accurate, second one is for experience people at least one moth of coding and 3 month of tuning.. If you need to be faster and your resources are quite limited. You can by smart statistic achieve your results by pure detection much faster and little bit less accurate. People are judge the image and video tracking even multi target tracking is capable to beat human. Try to count and register each person in video and count exits point. You are not able to do this in some number of people. It is really repents on, what you want, application, customer you have, and results you show to customers. If this is 4 numbers income, left, right, middle and your error is 20 percent is still much more than one bored small paid guard should achieved by all day long counting..


    You can find on my BLOG Some dataset for people detection and car detection on my blog same as script for learning ideas, tutorials and tracking examples..
    [Opencv blog tutorials code and ideas][2]



      [2]: https://funvision.blogspot.com/

    Support vector machine with Histogram of oriented gradient trained near online, and tracker. 

    support vector machine with HOG tracker


    Build the SVM detector based on HOG feature is relatively simple process. When is not necessary to be robust and detector is focused only on one object. You can build this by combine several OPENCV available tutorials and source codes distributed in Opencv samples. There is maybe one think what is not natural and cannot be taken from example and tutorials. Train set in online training is only 20 positive images warp over positive windows and 30 random negative samples.

    What do you think  ? 

    Tutorial on SVM with HOG, tracker soon


    This is just and example. Tutorial will be available later.. Code is little bit complex.


    ad