了解OpenCV的LBP实施 [英] Understanding OpenCV LBP implementation

查看:269
本文介绍了了解OpenCV的LBP实施的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要LBP基于人脸检测一些帮助,这就是为什么我写这个。

I need some help on LBP based face detection and that is why I am writing this.

我有以下问题与面临的OpenCV实现检测:

I have the following questions related to face detection implemented on OpenCV:

  1. 在lbpCascade_frontal_face.xml(这是来自OpenCV的):是什么 internalNodes,leafValues​​,树,功能等?我知道他们正在使用 在算法。但我不明白,每个人的意义 对他们。例如,为什么我们需要一个特定的功能,而不是 其他为特定的阶段?我们是如何决定哪些功能/ 节点选择呢?
  2. 什么是在LBP_frontal_face_classifier.xml特征值?一世 知道他们的4个整数的向量。不过,我应该怎么用这个 特征?我以为阶段0获得第一个特征,但访问 不在此图案。什么是访问模式时,此功能?

  1. In lbpCascade_frontal_face.xml (this is from opencv): what is internalNodes, leafValues, tree,features etc? I know they are used in the algorithm . But I do not understand the meaning of each one of them. For example, why we take a particular feature and not the other for a particular stage? how we are deciding which feature/ node to choose?
  2. What is feature values in the LBP_frontal_face_classifier.xml? I know they are a vector of 4 integers. But how should I use this features? I thought stage 0 access to the first feature but access is not in this pattern. What is the access pattern to this features?

所有的文学论文只给出高度概括。其     说明主要包括LBP计算从邻里     像素。但如何LBP值是用来对付那些元素     分类?

All the papers in literature give a high level overview only. Their descriptions mainly consist of LBP calculation from neighborhood pixels. But how this LBP values is used against those elements in the classifier?

我看了一些文章,文章。但没有明确说明LBP如何基于人脸检测工程或算法的细节。如果有人想开发一个人脸检测程序对自己,有什么措施,他应该后续没有文档描述了。

I read some papers, articles. But none clearly describes how LBP based face detection works or the algorithm in details. If someone wants to develop a face detection program on his own,what are the steps he should follow- no document describes that.

请帮我这些,如果你能。我将不胜感激。

Please help me on these if you could. I would be grateful.

推荐答案

请您看看我的<一个href="http://stackoverflow.com/questions/20085833/face-detection-algorithms-with-minimal-training-time/20086402#20086402">own从过去它轻轻触及的话题回答,但没有解释XML级联格式。

I refer you to my own answer from the past which lightly touches on the topic, but didn't explain the XML cascade format.

让我们看一个,修改后的透明度的例子,只有一个单级级联,和三个特点。

Let's look at a fake, modified for clarity example of a cascade with only a single stage, and three features.

<!-- stage 0 -->
<_>
  <maxWeakCount>3</maxWeakCount>
  <stageThreshold>-0.75</stageThreshold>
  <weakClassifiers>
    <!-- tree 0 -->
    <_>
      <internalNodes>
        0 -1 3 -67130709 -21569 -1426120013 -1275125205 -21585
        -16385 587145899 -24005</internalNodes>
      <leafValues>
        -0.65 0.88</leafValues></_>
    <!-- tree 1 -->
    <_>
      <internalNodes>
        0 -1 0 -163512766 -769593758 -10027009 -262145 -514457854
        -193593353 -524289 -1</internalNodes>
      <leafValues>
        -0.77 0.72</leafValues></_>
    <!-- tree 2 -->
    <_>
      <internalNodes>
        0 -1 2 -363936790 -893203669 -1337948010 -136907894
        1088782736 -134217726 -741544961 -1590337</internalNodes>
      <leafValues>
        -0.71 0.68</leafValues></_></weakClassifiers></_>

有点晚......

Somewhat later....

<features>
  <_>
    <rect>
      0 0 3 5</rect></_>
  <_>
    <rect>
      0 0 4 2</rect></_>
  <_>
    <rect>
      0 0 6 3</rect></_>
  <_>
    <rect>
      0 1 4 3</rect></_>
  <_>
      <rect>
      0 1 3 3</rect></_>

...

让我们先来看看一个阶段的标签:

Let us look first at the tags of a stage:

  • maxWeakCount 的阶段是在舞台弱分类器的数量,所谓的注释的&LT;! - 树 - &GT; 和我所说的LBP功能。
    • 在这个例子中,LBP特征在阶段0的数目是 3
    • The maxWeakCount for a stage is the number of weak classifiers in the stage, what is called in the comments a <!-- tree --> and what I call an LBP feature.
      • In this example, the number of LBP features in stage 0 is 3.
      • 在这个例子中阶段门槛 -0.75

      在谈到描述的LBP特征标签:

      Turning to the tags describing an LBP feature:

      • internalNodes 是11整数数组。前两个是毫无意义的LBP级联。第三个是索引到&LT;功能&GT; 表中的&LT; RECT&GT; ■在XML的结束文件(&LT; RECT&GT; 描述的特征的几何形状)。最后8个值是8个32位的值,它们共同构成了256位LUT我在刚才的答复谈到。此LUT是通过培训过程中,我不完全了解自己计算。
        • 在这个例子中,阶段引用的第一特征矩形 3 这是由四个整数<描述的 /电磁> 0 1 4 3
        • The internalNodes are an array of 11 integers. The first two are meaningless for LBP cascades. The third is the index into the <features> table of <rect>s at the end of the XML file (A <rect> describes the geometry of the feature). The last 8 values are eight 32-bit values which together constitute the 256-bit LUT I spoke of in my earlier answer. This LUT is computed by the training process, which I don't fully understand myself.
          • In this example, the first feature of the stage references rectangle 3, which is described by the four integers 0 1 4 3.
          • 在这个例子中的失败重量的第一特征是 -0.65 和通重量 0.88
          • In this example the first feature's fail weight is -0.65 and the pass weight is 0.88.

          最后,&LT;特征&GT; 标记。它由℃的阵列; RECT&GT; 包含4个整数描述的特征的几何形状的标签。给定一个处理窗口(24x24的你的情况),前两个整数描述它 X 整数像素的偏置的处理窗口内,而接下来的两个整数描述的宽度的和的高度进行评价。

          Lastly, the <feature> tag. It consists of an array of <rect> tags which contain 4 integers describing the geometry of the feature. Given a processing window (24x24 in your case), the first two integers describe its x and y integer pixel offset within the processing window, and the next two integers describe the width and height of one subrectangle out of the 9 that are needed for the LBP feature to be evaluated.

          在本质上,然后,一个标记&LT; RECT&GT; ft.x ft.y ft.width ft.height&LT; / RECT&GT; 位于处理窗口内的 pW.width X pW.height 检查脸部是否为present在 pW.x X pW.y 对应...

          In essence then, a tag <rect> ft.x ft.y ft.width ft.height </rect> situated within a processing window pW.widthxpW.height checking whether a face is present at pW.xxpW.y corresponds to...

          要评价LBP话,只须在点读积分图像 P [0..15] 和使用 P [BR] + P [TL] -p [TR] -p [BL] 来计算九subrectangles的积分。所述的中央的子矩形,R4相比较的八人,从R0顺时针开始的是,以产生一个8位的LBP(比特打包[MSB LSB 01258763])。

          To evaluate the LBP then, it suffices to read the integral image at points p[0..15] and use p[BR]+p[TL]-p[TR]-p[BL] to compute the integral of the nine subrectangles. The central subrectangle, R4, is compared that of the eight others, clockwise starting from R0, to produce an 8-bit LBP (the bits are packed [msb 01258763 lsb]).

          这8位LBP然后被用作一个索引功能的(2 ^ 8 = 256)位LUT(即&LT; internalNodes&GT; ),选择单位。如果该位为1,特征是具有面不一致;如果为0,它是与一个面是一致的。适当的重量(​​&LT;叶节点&GT; ),然后返回,并与所有其他特征的权重加入到生产的整体阶段和。这是当时相比,&LT; stageThreshold&GT; 确定阶段是通过还是失败

          This 8-bit LBP is then used as an index into the feature's (2^8 = 256)-bit LUT (the <internalNodes>), selecting a single bit. If this bit is 1, the feature is inconsistent with a face; if 0, it is consistent with a face. The appropriate weight (<leafNode>) is then returned and added with the weights of all other features to produce an overall stage sum. This is then compared to <stageThreshold> to determine whether the stage passed or failed.

          如果还有别的我没有解释不够好,我可以澄清。

          If there's something else I didn't explain well enough I can clarify.

          这篇关于了解OpenCV的LBP实施的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆