如何用八度正常化的形象呢? [英] How to normalize an image using Octave?
问题描述
在他们的文章中描述的维奥拉 - 琼斯目标检测框架(稳健实时人脸检测由中提琴和琼斯),它是说:
In their paper describing Viola-Jones object detection framework (Robust Real-Time Face Detection by Viola and Jones), it is said:
用于培训的所有示例子窗口被方差标准化,以尽量减少不同的照明条件的影响。
All example sub-windows used for training were variance normalized to minimize the effect of different lighting conditions.
我的问题是,如何实现八度图像归?
My question is "How to implement image normalization in Octave?"
我不是在寻找特定的实现,中提琴和放大器;琼斯使用,但类似的一个,产生几乎相同的输出。我一直在关注很多哈尔培训教程(试图检测手),但尚未能够输出一个很好的检测器(XML)。
I'm NOT looking for the specific implementation that Viola & Jones used but a similar one that produces almost the same output. I've been following a lot of haar-training tutorials(trying to detect a hand) but not yet able to output a good detector(xml).
我一直试图联系作者,但还是没有反应呢。
I've tried contacting the authors, but still no response yet.
推荐答案
我已经回答了如何在一般准则,以它这个线程。
I already answered how to to it in general guidelines in this thread.
下面是如何做到的方法1倍频程(规范化为标准的正常偏差)(展示一个随机矩阵 A
,当然,也可以应用到任何矩阵,如何将图片重新presented):
Here is how to do method 1 (normalizing to standard normal deviation) in octave (Demonstrating for a random matrix A
, of course can be applied to any matrix, which is how the picture is represented):
>>A = rand(5,5)
A =
0.078558 0.856690 0.077673 0.038482 0.125593
0.272183 0.091885 0.495691 0.313981 0.198931
0.287203 0.779104 0.301254 0.118286 0.252514
0.508187 0.893055 0.797877 0.668184 0.402121
0.319055 0.245784 0.324384 0.519099 0.352954
>>s = std(A(:))
s = 0.25628
>>u = mean(A(:))
u = 0.37275
>>A_norn = (A - u) / s
A_norn =
-1.147939 1.888350 -1.151395 -1.304320 -0.964411
-0.392411 -1.095939 0.479722 -0.229316 -0.678241
-0.333804 1.585607 -0.278976 -0.992922 -0.469159
0.528481 2.030247 1.658861 1.152795 0.114610
-0.209517 -0.495419 -0.188723 0.571062 -0.077241
在上面的使用:
- 要获得其矩阵的标准偏差:
S = STD(A(:))
- 要获得其矩阵的平均值:
U =平均(A(:))
- 然后下面的公式
A'[I] [J] =(A [I] [J] - U)/ S
的 量化版本:A_norm =(A - U)/ S
- To get the standard deviation of the matrix:
s = std(A(:))
- To get the mean value of the matrix:
u = mean(A(:))
- And then following the formula
A'[i][j] = (A[i][j] - u)/s
with the vectorized version:A_norm = (A - u) / s
使用矢量归正火这也很简单:
Normalizing it with vector normalization is also simple:
>>abs = sqrt((A(:))' * (A(:)))
abs = 2.2472
>>A_norm = A / abs
A_norm =
0.034959 0.381229 0.034565 0.017124 0.055889
0.121122 0.040889 0.220583 0.139722 0.088525
0.127806 0.346703 0.134059 0.052637 0.112369
0.226144 0.397411 0.355057 0.297343 0.178945
0.141980 0.109375 0.144351 0.231000 0.157065
在abvove:
-
ABS
是向量(长度),其计算公式与矢量乘法(A(:)'* A(绝对值:)
其实就是和(A [i] [j]的^ 2)
) - 然后,我们用它来归一化矢量所以这将是长度为1。
abs
is the absolute value of the vector (its length), which is calculated with vectorized multiplications (A(:)' * A(:)
is actuallysum(A[i][j]^2)
)- Then we use it to normalize the vector so it will be of length 1.
这篇关于如何用八度正常化的形象呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!