0

Can someone explain me what the functions in haar.cpp file (in OpenCv) do? And which function actually does the Haar feature evaluation?

star_2014
  • 3
  • 1
  • 4
  • 1
    Asking for doco on 2500 lines of code is might get you a "too broad" close. Looking at your previous question, I think haar.cpp might be too and ugly for you to deal with because most of it is the cascade classifier. Calculating the features is not too hard see the Viola Jones paper mentioned at http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html. Really your are just – Bull Jul 19 '14 at 13:33
  • Thanks for trying to help... I did the extraction with my code and got 97% accuracy :) – star_2014 Jul 24 '14 at 11:45

1 Answers1

2

This is how HAAR module works in my understanding:

You need an image and a cascade file. Cascade file contains a "tree". You start at the top of the tree and propagate downwards. Every node specifies what type of haar feature you have to extract and a threshold (http://opencv.jp/opencv-2.2_org/c/objdetect_cascade_classification.html).

Here is the pseudocode

  1. Take a 2D Image patch where you want to detect an object. Lets say it's size is 64x64 grayscale pixels.

  2. Start propagating the cascade tree, by computing the node's haar-like feature and comparing its value with the threshold stored in the node. If bigger go to the left otherwise go to right, let's say. Continue until a tree leaf is reached.

If you disable all optimizations, some of this computations happen between lines 797 to 813 haar.cpp.

ivan_a
  • 613
  • 5
  • 12