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

人盡茶涼 提交于 2019-12-21 02:47:12

问题


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.


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/4482123/whats-inside-a-haar-cascade-classifier-in-open-cv-computer-vision

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!