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?"
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.
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):In the above you use:
s = std(A(:))
u = mean(A(:))
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:
In the abvove:
abs
is the absolute value of the vector (its length), which is calculated with vectorized multiplications (A(:)' * A(:)
is actuallysum(A[i][j]^2)
)