开发者

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

开发者 https://www.devze.com 2023-01-31 02:45 出处:网络
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.)

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.0337941开发者_JAVA百科907346249</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

0

精彩评论

暂无评论...
验证码 换一张
取 消