Search code examples
xmlface-detectionhaar-classifier

Haar Cascade XML


I am interested in what everything in the xml file below means:

<stages>
<trees>
<feature>
<rects>
<_>
<tilted>
<threshold>
<left_val>
<right_val>

and what the five integers in between rects mean.

        <feature>
          <rects>
            <_>
              14 18 1 2 -1.</_>
            <_>
              14 19 1 1 2.</_></rects>
          <tilted>0</tilted></feature>
        <threshold>-4.3883759644813836e-005</threshold>
        <left_val>0.3130159080028534</left_val>

Solution

  • OK, you are making this a bit harder than it has to be, but I'll try. I guess, you are asking about object detectors in OpnenCV. These are cascades of boosted classifiers which originate from Viola&Jones face detector which classify each image region/patch into object/background classes and are called scanning window object detectors.

    • <stages> is a series of more and more complex classifiers which try identify if an image patch contains a face (with higher and higher confidence).
    • <trees> should be even simpler classifiers which the stages are composed of.
    • <feature> is a simple hand-coded feature which extracts single value from an image.
    • <rects> are rectangular regions a feature is composed of.
    • <tilted> could be a binary value - if the feature is 45° rotated.
    • <threshod> is a threhold of the value of the feature.
    • <left_val> is a vote about the probability that the classified region contains face if the value of the feature is below the <threshold>.
    • <right_val> is a vote about the probability that the classified region contains face if the value of the feature is above the <threshold>.

    PS: I could be wrong, I did my Ph.D. on this type of classifiers, I did not write OpenCV.