24x24窗口中类似haar的功能的数量 [英] Number of haar like features in 24x24 window

查看:141
本文介绍了24x24窗口中类似haar的功能的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请参阅以下链接

中提琴&琼斯人脸检测

以上链接包含有关与不同模板相对应的haar特征数量的计算(以下摘录自链接).

The above link contains the calculation regarding the number of haar features corresponding to different templates(below is excerpt from the link).

我不知道如何计算(43200,27600,43200,27600,20736)的精确计算.有人可以轻松地向我解释一下吗?

I am not getting how those(43200,27600,43200,27600,20736) exact calculations are made.Can somebody explain that to me in an easy way?

推荐答案

要了解,请看一下算法#1.对于第一个模式(a),以下两行(本文中的5和6)给出了解释

To understand, have a look at the algorithm #1. For the first pattern (a), the following two lines (5 and 6 in the article) gives the explanations

for all(i,j) such 1<=i<=24 and 1<=j<=24:
  for all(h,w) such that i+h-1<=24 and j+2w-1<=24:

这意味着您将采用左上角的所有组合(i是顶部,j是左侧),然后采用宽度(w)和高度(h)的所有组合可以放在24x24内部.

This means you will take all the combinations of top-left corners (i is top, and j is left), then all the combinations of width (w) and heights (h) that will fit inside the 24x24.

该算法还将使用宽度和高度的所有组合(1x4、1x6、1x8,...,1x24、2x2、2x4、2x6、2x8,...,2x24、3x2、3x4、3x6,... ,最多24x24).只要宽度是2的倍数(由#6行中的2w指定).

The algorithm will also use all combinations of widths and heights (1x4, 1x6, 1x8, ..., 1x24, 2x2, 2x4, 2x6, 2x8, ..., 2x24, 3x2, 3x4, 3x6, ..., up to 24x24). As long as widths are a multiple of 2 (specified by 2w in line #6).

最小的图案(宽2像素,高1像素)将适合24 * 23 = 552个位置(23个水平位置和24个垂直位置).

The smallest pattern (2 pixels wide and 1 pixel high) will fit in 24 * 23 = 552 positions (23 horizontal positions, and 24 vertical positions).

例如,在某个时候,您将拥有7x10的图案(高度为7像素,宽度为10像素).它将适合18 x 15 = 270个位置(18个垂直位置和15个水平位置).

At some point, for example, you will have a 7x10 pattern (7 pixels height, and 10 pixels wide). It will fit in 18 x 15 = 270 positions (18 vertical positions and 15 horizontal positions).

最大的矩形(24x24像素)将由12个白色列和随后的12个黑色列组成.它只适合一个位置(整个图像).

The biggest rectangle (24x24 pixels), will consist of 12 white columns followed by 12 black columns. It will fit in only one position (the whole image).

如果对所有可能的尺寸的所有位置求和,则会得到数字.

If you sum all the positions for all possible dimensions, you obtain the numbers.

要获取第一个数字(针对模式a),请使用以下程序(我没有对其进行优化!但是应该很容易理解)打印43200:

To get the first number (for pattern a), the following program (I did not optimize it! but it should be easily understandable) prints 43200:

# Pattern A
total = 0
for i in range(1,25):     # 1 <= i <= 24
  for j in range(1,25):     # 1 <= j <= 24
    for w in range(1,13):     # 2*w=2,4,6,...24
      for h in range(1,25):     # h=1,2,...,24
        if (i+h-1<=24) and (j+2*w-1<=24):
          total += 1
print total

其他模式的解释类似.

这篇关于24x24窗口中类似haar的功能的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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