简体   繁体   中英

What's inside a haar cascade classifier in Open CV computer vision?

I need to translate an .xml OpenCV haar cascade to a txt file.

(Open CV has a Haar Feature-based Cascade Classifier for Object Detection.)

So I need to understand the xml. I'm wondering what are the "stages" and the "trees". Does a tree stand for a weak classifier? Are the trees in the same stage combined to be a strong classifier?? Are the stages cascaded???

In a tree from haarcascade_frontalface_alt.xml, it says:

<!-- tree 0 -->
    <_>
        <!-- root node -->
        <feature>
          <rects>
            <_>3 7 14 4 -1.</_>
            <_>3 9 14 2 2.</_></rects>
          <tilted>0</tilted></feature>
        <threshold>4.0141958743333817e-003</threshold>
        <left_val>0.0337941907346249</left_val>
        <right_val>0.8378106951713562</right_val></_></_>
    <_>

I want to know what the numbers stand for.

I'll try explain the cascade xml meaning.

<_>
<!-- root node -->
    <feature>
      <rects>
        <_>3 7 14 4 -1.</_>
        <_>3 9 14 2 2.</_></rects>
      <tilted>0</tilted></feature>
    <threshold>4.0141958743333817e-003</threshold>
    <left_val>0.0337941907346249</left_val>
    <right_val>0.8378106951713562</right_val></_></_>
<_>

In

<_>3 7 14 4 -1.</_>

3,7 are the cordinate of the rectangle you'd like to sum using the square sum matrix (the integral image) 14 4 are the length and hieght of the rectangle -1 is the wieght of the rectangle (this is NOT the weight according to viola-johnes original article)

please denote that the rects are should be normalize to your detector size

if the rects sum passes the threashold value , then the right_val is sumed for the future, otherwise the left_sum is sumed

Good luck

S

Eureka! Page 370 of the OpenCV Reference Manual v2.1.

link http://picoforge.int-evry.fr/projects/svn/gpucv/opencv_doc/2.1/opencv.pdf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM