# Haar transform definition

I am trying to understand Haar transform of simple vector of numbers.

Some references I found say, that first level transform of $X = (4,6,8,10,13,9,3,3)$ will be $\sqrt{2}(5,9,11,3, -1,-1,2,0)$. Others say, it will be $(5,9,11,3,-1,-1,2,0)$.

Which one is true? Or are they both correct in some way and am I missing something?

And important question, which one do I use when I am performing Haar transform on image and this vector represents one row/column of pixels in image?

The only difference between the two transform results is a gain factor. The transform should have the same energy as the original data sequence, so we can use that to check for the right result. The energy of $X$ is-
$$\sum X^2 = 484$$ $$\sum (5,9,11,3,−1,−1,2,0)^2 = 242$$ $$\sum (\sqrt{2}(5,9,11,3,−1,−1,2,0))^2 = 2\sum (5,9,11,3,−1,−1,2,0)^2 = 484$$ This shows that of the two possible transforms, $\sqrt{2}(5,9,11,3,−1,−1,2,0)$ has the right energy and is thus the right choice.
• Thank you much for explanation. But is it also right choice in case of image transformation? Beacuse in that case the $\sqrt{2}$ factor is increasing the values of transformed pixels in each level of transformation. Without that factor I can always stay in possible range of pixel values (for example 0-255). Like in my example, the first two pixels with values $4$ and $6$ would not produce $5$ but $\sqrt{2} * 5 = 7.071$ Dec 2 '14 at 12:04
• @violin512 I am not an image guy, so bear in mind that I don't have experience to draw on. Filters with negative taps (and one way of looking at the Haar Transform is looking at it as a set of FIR filters) are problematic with images because you can end up with negative numbers, which don't make sense for images. You have, in fact, ended up with negative numbers that I assume you would have to change to 0. The results can also go above 255, as you have noted. The relative values are correct with both result sets, so if taking out the $\sqrt(2)$ improves your results then just do it. Dec 2 '14 at 14:05