March 2016


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

  • Median flow tracker code coming soon

    • Simple median flow tracker base od goodFeaturesToTrack
    •  calcOpticalFlowPyrLK
    • TODO complete forward backwards tracking and feature filtering. I already have forward, backwards LK tracker, without filtering (just prepared NORM computation).
    • TODO complete redetection. White rectangles are redetection with online learning by RTrees opencv 3.1 support. Rtrees work great. I only need better features. Do you have any advice or tips?
    • From the initial Rectangle is generated several positive examples and negatives from the rest of image. Rtrees learning and prediction can run very fast. I still haven't got a good features. Feature extracting took some time to. 
    • TODO Forward backward + redetection. 
    • 300 lines of code 
    Final result will be 

    TLD tracker

    I would like to release this in 4 next tutorials. 

    Forward backwards median flow tracker

    Rtrees learning ( new features ) and prediction with single scale detection sliding window

    Complete TLD tracker

    Slow Multi target TLD tracker

    Share please

    Feel free to share this article.. Thanks a lot

    Testing Alchemy Vision  is powerful computer vision API that provide advance image understanding for business to make a better decisions. Alchemy Vision extract text from images, recognize some brands and put them in the content. This deep learning Watson based technology is great for social media monitoring, analysis and target ads for example on Stratigram. Some of the result on Alchemy Vision outperform other products in this category.
    Cloud based computer vision with advanced image analysis  is available through Rest API that anyone can create application with this capabilities on Mobile phones, tablets and personal computers.

    Target segment is

    • Brand monitoring on social media
    • Organization of images
    • Customer suggestions 
    • Profile markets
    Look at the results

    I am testing a lots of products like this. The Alchemy is the most advanced with better results than others products like this. AlchemyAPI is part of Watson cloud.

    Brand and logo recognition coputer vision coputer vision

    Text within Image

    intelkelloggpuma, cred, ups, atletico, ibm, gucci, disadvantages, gap, redbullgoogle, son, kayla, caterpillar, cartier, isa, ros, cam, timemicrosoftwii

    People and logo image finding

    Alchemy Vision


    • Person
    Text within image
    • Female Age  18-24 
    This is incredible!! Result
    • Celebrity
    • Mila Kunis
    • People-celebrities-Mila Kunis 0.978
    • Person-Actor-Celebrity-Film-Actor-TVActor
    For example there is no one famous on that picture :)
    Alchemy Vision

    • Male
    • Female
    • Male
    • Male
    • Female
    • Female
    • 35-44
    • 35-44
    • 45-54
    • 35-44
    • 18-24
    • 55-64 coputer vision
    • Person 0.9

    Text within image
    • Female  Age 35-44 

    Simular images coputer vision

    Image understanding coputer vision
    • Car 0.961
    • Ford   0.5     OK,, This is a Lexus.

    Word hierarchy
    • vehicle-cars-ford
    • Male  in age 35-44    

    Action recognition

                 coputer vision

    Word Hierarchy
    • activities sports hockey
    • activities sport
    • people
    • events sports nhl
    • Male
    • 18-24

    People activity analysis coputer vision
    • Persons
    Text Within Image

    Social media analysis

    Alchemy Vision

    • Person
    • Female
    • Female
    • Male
    • 18-24
    • 18-24
    • >64
    Simular pictures

    Alchemy Vision

    Alchemy Vision


    • Person

    Text within image

    • Trump
    • Steaks

    Male Age 55-64

    Science Journals in general

    I think that, if you have something published in IEEE. You are the really good one. I have. It is not in computer vision, but IEEE transaction and automatic control. If you choose IEEE  series, it is something like a guarantee of quality in engineering.

    Pls. Do not pay for the impact factor. The people who want access to resources of good information have to pay for them. If you pay to be published somewhere. Sorry, Your work is not good enough or You do not have the nerves to the admissions process . There is one exception. You can pay for public access to your journal paper in some cases.

    Personally, I think that only 10 percent of this articles and science papers are valuable more than Starbucks coffee. Maybe less than. The really good one research progress are almost publically available or behind closed doors of big company. The best from the good ones go to public. They do not afraid of their good work. They want to attract sponsors and company to sell their skills, knowledge and bring ideas fast to the real word with company which offer to bring idea into real world.

    This is the problem. Best of the research papers leak public. Why do I pay for IEEE Explorer subscription after left school.

    Computer Vision Journals and conferences 

    Conferences are great..Particularly workshops can help you to move forward in your research.

    IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016

    IEEE Transactions on Pattern Analysis and Machine Intelligence

    IEEE Transactions on Image Processing Link

    European Conference on Computer Vision

    IEEE International Conference on Computer Vision, ICCV

    Pattern Recognition

    International Journal of Computer Vision

    Medical Image Analysis

    Image and Vision Computing

    CVPR 2016 Tutorial and workshop list 

    Workshops and tutorials are great reasources and list of incoming CVPR 2016 conference is here workshops and here tutorials.

    Another computer vision tutorials

    My favourite Tutorials are also from standford.

    Deep Learning Tutorial

    Deep learning tutorial

    Opencv fast people detection by CascadeClassifier 

    Simple Opencv C++ tutorial and example of people detection in video samples and pictures. There is nothing you cannot achieve in few simple steps. People detection and performace tasks in opencv could be solved if you have little bit knowledge of programing. Or just simple follow the steps.. 

    Opencv tutorial instalation of opencv

    You can simple prepare the project inside the Visual Studio 2015 by Nuget Packages. This approach is easy for beginers and better than standard installation with all the environmental variables problems. Just follow the installation steps inside here 

    Cascade Classifier detect Multi Scale

    Opencv is great and complex tools. There is lot of image processing and also machine learning features. You can simply learn your own detector. I would like to prepare some tutorial how to learn your own detector. It is long time run. 

    All, you need to do, is some experience and basic opencv tools. 
    under opencv/build/x64/vc14/bin


    Prepare your dataset and files with labels are better under linux. You can use simple shall scripts. 
    This is really for long tutorial, but you can do image annotation in windows as well and maybe use the new tool opencv_annotation,exe, but i dont have any experience with this. My own scripts and programs crop, saves and annotating data. I have own image cropper to prepare datasets. You can build your own dataset in few days. It is tricky to. 

    First step

    Use basic opencv cascades to crop some positive samples from video or better crop precisely the positive samples from your images. Negative samples is not problem. Generate them randomly from your images.  Clean and prepare data manually.. This is a worse part. Crop also images selected correctly by default opencv cascade to achieve better results.

    Second step

    Build your initial detector, which is used for another positive data collecting.  Again Clean and prepare data manually. Stupid boring and it takes a long time.


    !!Use this on your own risk. !!

    Run cloud machine on aws and install opencv 3.1. 
    Better is memory than number of cores.. Something like 

    r3.4xlarge   cores 16  memory 52                              $1.33 per Hour

     !!!!On your own risk!!!!

    8000 positive and 15000 negatives dataset with 10- 20 stages could take minutes - hours instead of days of learning on your own computer.. And it's cheaper than electricity bill.Time to learn depends on number of data, parameters, selected machine and many things.I can not guarantee that it goes so fast with your data and parameters.. I do it this way saves time. I am preaty sure that your first detector will be terrible. In the cloud you can learn 10 detectors day. Which is great

    Performance detectMultiScale and parameters

    • Source image is 640x480 image. My PC is notebook I7, 4 cores, 8 threads and huge amount of RAM :). Opencv version is 3.1 default for windows machines. 

    • I have 2 people detector detectMultiScale in the main loop . 

    • The main performance issue is in scaleFactor parameter and minSize of the object. In faster case, I have 1.1 and in slower case is 1.02 scaleFactor.  

    • Choose appropriately as needed the minSize parameter. If you have to small window, your program need to check far more options. Size(40,70)

    CascadeClassifier at approximately 13 FPS

    detectorBody.detectMultiScale(img, human, 1.1, 1, 0 | 1, Size(40,70), Size(80, 300));
    detectorUpper.detectMultiScale(img, upperBody, 1.1, 1, 0 | 1, Size(40, 70), Size(80, 300));

    Cascade Classifier detect Multi Scale

    CascadeClassifier at approximately 2 FPS

    detectorBody.detectMultiScale(img, human, 1.02, 2, 0 | 1, Size(40,70), Size(80, 300));
    detectorUpper.detectMultiScale(img, upperBody, 1.02, 2, 0 | 1, Size(40, 70), Size(80, 300));

    Cascade Classifier detect Multi Scale

    Opencv  HAAR LBP cascade download

    I also learn some mine cascade on my own datasets. There are here. To be sure that you can reach them here are the links.. 

    Cascade for car detector download

    This is just basic 5 stage haar cascade car detector, post where to find my cascade to detect cars

    Cascade for head and people download 

    This cascade is also able to use by tutorial code below. For head and for people detection. 
    Learned by me on my own data set. cascade for head and people detection

    Opencv CascadeClassifier tutorial code

    !!Simple as opencv Sample.. Let me add some useful remarks. Some windows opencv version of detect multiScale return errors.. 2.9.4 -3.0 maybe 3.1. I don't know why. The classifier returns to many output rectangles out of bound. This does not make sense and kill your program.. 
    If this is a issue of your error on windows.. Switch from debug to release. It helps. !! Really

    #include "opencv2\highgui.hpp"
    #include "opencv2\imgproc.hpp"
    #include "opencv2\objdetect\objdetect.hpp"
    #include "opencv2/video/tracking.hpp"
    #include <vector>
    #include <stdio.h>
    #include <Windows.h>
    #include <iostream>
    #include <time.h>
    #include <ctime>

    using namespace cv;
    using namespace std;

    int main(int argc, const char** argv)

             // prepare video input
    VideoCapture cap("");
             // prepare video output
    VideoWriter outputVideo;"video4.wmv", CV_FOURCC('W', 'M', 'V', '2'), cap.get(CV_CAP_PROP_FPS), Size(640, 480), true);

            // prepare cascadeClassifier
    CascadeClassifier detectorBody;
    CascadeClassifier detectorUpper;
    // !! Put your cascade or opencv cascede into project folder !!
    string cascadeName1 = "cascadeName.xml";
    string cascadeName2 = "cascadeName.xml";

            // Load cascade into CascadeClassifier
    bool loaded1 = detectorBody.load(cascadeName1);
    bool loaded3 = detectorUpper.load(cascadeName2);

      // Basic video input loop
    for (;;)

    bool Is = cap.grab();
    if (Is == false) {

    cout << "Video Capture Fail" << endl;
    else {
    // Just for measure time
    const clock_t begin_time = clock();

                            // Store results in these 2 vectors
    vector<Rect> human;
    vector<Rect> upperBody;

                            // prepare 2 Mat container
    Mat img;
    Mat original;

    // capture frame from video file
    cap.retrieve(img, CV_CAP_OPENNI_BGR_IMAGE);
    // Resize image if you want with same size as your VideoWriter
    resize(img, img, Size(640, 480));
                            // Store original colored image
                            // color to gray image
    cvtColor(img, img, CV_BGR2GRAY);

    // detect people, more remarks in performace section
    detectorBody.detectMultiScale(img, human, 1.1, 2, 0 | 1, Size(40,70), Size(80, 300));
    detectorUpper.detectMultiScale(img, upperBody, 1.1, 2, 0 | 1, Size(40, 70), Size(80, 300));

                            // Draw results from detectorBody into original colored image
    if (human.size() > 0) {
    for (int gg = 0; gg < human.size(); gg++) {

    rectangle(original, human[gg].tl(), human[gg].br(), Scalar(0,0,255), 2, 8, 0);


                           // Draw results from detectorUpper into original colored image
    if (upperBody.size() > 0) {
    for (int gg = 0; gg < upperBody.size(); gg++) {

             rectangle(original, upperBody[gg].tl(), upperBody[gg].br(),  Scalar(255,0,0), 2, 8, 0);

    // measure time as current - begin_time
           clock_t diff = clock() - begin_time;
                                    // convert time into string
           char buffer[126];
           sprintf(buffer, "%d",diff);
    // display TIME ms on original image
            putText(original, buffer, Point(100, 20), 1, 2, Scalar(255, 255, 255), 2, 8, 0);
            putText(original, "ms" , Point(150, 20), 1, 2, Scalar(255, 255, 255), 2, 8, 0);
                                    // draw results
    namedWindow("prew", WINDOW_AUTOSIZE);
    imshow("prew", original);
                                    // make video output
    outputVideo << original; 

    int key1 = waitKey(20);


    People detection by Cascade Classifier Opencv

    The comparison of Opencv Cascade for people detections. Default opencv cascades are good one. You can simply achive better result but you need to collect the training data. On my blog you can find the datasets for car detection. There is more than 2000 positives car samples available for you and test to learn your own detector.. 
    Here in this article, I just want to show my cascade compare to cascade which are default in opencv. 

    LBP cascade for people detection

    Also I recently publish LBP cascade for people detection. You can download 12 stage LBP cascade LBP cascade for download. There is couple or maybe more than 3 tutorials how to use detect multiscale in opencv. Just download the LBP cascade and enjoy coding in Opencv..

    Cascade Classifier opencv

    Haar Cascade Classifier for People detection

    In this short tutorial, I would like to test some standard haar cascade in opencv 3.1. 
    My first note is where you can find this cascades.
    When you download opencv for windows this cascades are located in opencv/sources/data/haarcascades

    In the picture i use these types of cascades. 




    Visually, i can rate the cascade as rly great for fullbody an lowerbody. The upperbody cascade has trouble with my source video. Which is not its fault.

    Own haar like cascade

    Also, I am testing some of mine own haar cascade, which are learned by different methods like gentle boost, adaboost, etc.

    Red and blue are the cascades for people detection. White is haar cascade for head detection. Check the video for results.

    Video of mine haar cascade.


    Code is HERE and cascade is LBP cascade for download