Difference between revisions of "Haar wavelet (2x2)"
From ScienceZero
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Image:Haaroriginal.png|right|thumb|Original picture]] | [[Image:Haaroriginal.png|right|thumb|Original picture]] | ||
[[Image:Haartransform.png|right|thumb|Haar transformation]] | [[Image:Haartransform.png|right|thumb|Haar transformation]] | ||
− | The two-dimensional Haar wavelet | + | The two-dimensional 2 by 2 Haar wavelet transforms data into 4 bands where ''b0'' contains the DC level of each block while ''b1-b3'' contains higher frequency components. It is useful for both data analysis and compression. It is a very computationally efficient transformation. |
− | By recursively applying the transformation on b0 until b0 reaches a size of 1 we get frequency information about different areas in the picture at different scales. After the transformations most values will have a low value (assuming that the input data is a normal photograph), by using quantization and setting very low values to zero the data will compress very well using | + | By recursively applying the transformation on b0 until b0 reaches a size of 1 we get frequency information about different areas in the picture at different scales. After the transformations most values will have a low value (assuming that the input data is a normal photograph), by using quantization and setting very low values to zero the data will compress very well using a combination of simple compression algorithms like [[Run-length encoding]] and [[Huffman coding]]. |
Input block of 2x2 pixels | Input block of 2x2 pixels | ||
Line 9: | Line 9: | ||
p2 p3 | p2 p3 | ||
− | Forward transformation | + | Forward 2D Haar transformation |
b0 = (p0 + p1) + (p2 + p3) 'DC level | b0 = (p0 + p1) + (p2 + p3) 'DC level | ||
b1 = (p0 - p1) + (p2 - p3) 'Horizontal difference | b1 = (p0 - p1) + (p2 - p3) 'Horizontal difference | ||
Line 15: | Line 15: | ||
b3 = (p0 - p1) - (p2 - p3) 'Horizontal and vertical difference | b3 = (p0 - p1) - (p2 - p3) 'Horizontal and vertical difference | ||
− | Reverse transformation | + | Reverse 2D Haar transformation |
p0 = ((b0 + b1) + (b2 + b3)) / 4 | p0 = ((b0 + b1) + (b2 + b3)) / 4 | ||
p1 = ((b0 - b1) + (b2 - b3)) / 4 | p1 = ((b0 - b1) + (b2 - b3)) / 4 |
Latest revision as of 00:02, 23 February 2011
The two-dimensional 2 by 2 Haar wavelet transforms data into 4 bands where b0 contains the DC level of each block while b1-b3 contains higher frequency components. It is useful for both data analysis and compression. It is a very computationally efficient transformation.
By recursively applying the transformation on b0 until b0 reaches a size of 1 we get frequency information about different areas in the picture at different scales. After the transformations most values will have a low value (assuming that the input data is a normal photograph), by using quantization and setting very low values to zero the data will compress very well using a combination of simple compression algorithms like Run-length encoding and Huffman coding.
Input block of 2x2 pixels p0 p1 p2 p3
Forward 2D Haar transformation b0 = (p0 + p1) + (p2 + p3) 'DC level b1 = (p0 - p1) + (p2 - p3) 'Horizontal difference b2 = (p0 + p1) - (p2 + p3) 'Vertical difference b3 = (p0 - p1) - (p2 - p3) 'Horizontal and vertical difference
Reverse 2D Haar transformation p0 = ((b0 + b1) + (b2 + b3)) / 4 p1 = ((b0 - b1) + (b2 - b3)) / 4 p2 = ((b0 + b1) - (b2 + b3)) / 4 p3 = ((b0 - b1) - (b2 - b3)) / 4