The Discrete Wavelet Transform for Image Compression Speaker: Jing-De Huang Advisor: Jian-Jiun Ding Graduate Institute of Communication Engineering National Taiwan University, Taipei, Taiwan, ROC Outline • • • • • • • Subband Coding Multiresolution Analysis Discrete Wavelet Transform The Fast Wavelet Transform Wavelet Transforms in Two Dimension Image Compression Simulation Result 2 1. Subband Coding h0(n) 2 y0 (n) 2 Analysis x ( n) h1(n) 0 2 Synthesis y1 (n) H1 ( ) H1 ( ) Low band High band /2 g0(n) 2 + xˆ (n) g1(n) 3 1. Subband Coding • Cross-modulated Z-transform : H 0 ( z )G0 ( z ) H1 ( z )G1 ( z ) X ( z ) 12 H 0 ( z )G0 ( z ) H1 ( z )G1 ( z ) X ( z ) Xˆ ( z ) 1 2 For error-free reconstruction Xˆ ( z ) X ( z ) H 0 ( z )G0 ( z ) H1 ( z )G1 ( z ) 0 H 0 ( z )G0 ( z ) H1 ( z )G1 ( z ) 2 For finite impulse response (FIR) filters and ignoring the delay g0 (n) (1) n h1 (n) g1 (n) (1) n 1 h0 (n) FIR synthesis filters are cross-modulated copies of the analysis filters with one (and only one) being sign reversed. 4 1. Subband Coding • Biorthogonal g 0 (k ), h0 (2n k ) (n), g 0 (k ), h1 (2n k ) 0 g1 (k ), h1 (2n k ) (n), g1 (k ), h0 (2n k ) 0 hi (2n k ), g j (k ) (i j ) (n), i, j {0,1} The analysis and synthesis filter impulse responses of all two-band, real-coefficient, perfect reconstruction filter banks are subject to the biorthogonality constraint 5 1. Subband Coding • Orthonormal – gi (n), g j (n 2m) (i j ) (m), i, j {0,1} – one solution of biorthogonal – used in the fast wavelet transform – the relationship of the four filter is : g1 (n) (1) n g0 (2 K 1 n) , 2K denotes the number of coefficients g1 (n) is related to g 0 (n) hi (n) gi (2 K 1 n), i {0,1} h1 (n), h2 (n) is time-reversed versions of g1 (n), g 2 (n), respectively 6 2. Multiresolution Analysis • Expansion of a signal f (x) : f ( x) kk ( x) k : real-valued expansion coefficients k k ( x) : real-valued expansion functions k k ( x), f ( x) k* ( x) f ( x)dx k ( x): the dual function of k ( x) If k ( x) is an orthonormal basis for V , then k ( x) k ( x) If the expansion is unique, the k ( x) are called basis functions. The function space of the expansion set k ( x) : V span k ( x ) k If k ( x) are not orthonormal but are an orthogonal basis for V , then the basis funcitons and their duals are called biorthogonal. 0 , j k Biorthogonal: j ( x), k ( x) jk 1 , j k 7 2. Multiresolution Analysis • Scaling function j ,k ( x) 2 j / 2 (2 j x k ), for k Z and ( x) L2 R The subspace spanned over k for any j : V j span j ,k ( x) k The scaling functions of any subspace can be built from double-resolution copies of themselves. That is, ( x) h (n) 2 (2 x n) n where the coefficients are called scaling function coefficients. 8 2. Multiresolution Analysis • Requirements of scaling function: 1. The scaling function is orthogonal to its integer translates. 2. The subspaces spanned by the scaling function at low scales are nested within those spanned at higher scales. That is V V1 V0 V1 V2 V 3. The only function that is common to all V j is f ( x) 0. That is V 0 4. Any function can be represented with arbitrary precision. That is, 2 V L R 9 2. Multiresolution Analysis • Wavelet function spans the difference between any two adjacent scaling subspaces V j and V j 1 j ,k ( x) 2 j / 2 (2 j x k ) for all k Z that spans the space W j where W span ( x) j j ,k k The wavelet function can be expressed as a weighted sum of shifted, double-resolution scaling functions. That is, ( x) h (n) 2 (2 x n) n where the h (n) are called the wavelet function coefficients. It can be shown that h (n) (1) h (1 n) n 10 2. Multiresolution Analysis V2 V1 W1 V0 W0 W1 V1 V0 W0 W1 W0 V0 Figure 2 The relationship between scaling and wavelet function spaces. The scaling and wavelet function subspaces in Fig. 2 are related by V j 1 V j W j We can express the space of all measurable, square-integrable function as L2 R V0 W0 W1 W2 or L2 R W2 W1 W0 W1 W2 11 3 Discrete Wavelet Transform • Wavelet series expansion f ( x) c j0 (k ) j0 ,k ( x) d j (k ) j ,k ( x) k j j0 k where j0 is an arbitrary starting scale c j0 (k ) f ( x), j0 ,k ( x) f ( x) j0 ,k ( x)dx called the approximation or scaling coefficients d j (k ) f ( x), j ,k ( x) f ( x) j ,k ( x)dx called the detail or wavelet coefficients 12 3 Discrete Wavelet Transform • Discrete Wavelet Transform the function f(x) is a sequence of numbers 1 f ( x) M 1 W ( j , k ) ( x ) k 0 j0 ,k M W ( j, k ) j j0 k j ,k ( x) where j0 is an arbitrary starting scale 1 W ( j0 , k ) M M 1 f ( x) x 0 j0 , k ( x) called the approximation or scaling coefficients 1 W ( j , k ) M M 1 f ( x) x 0 j,k ( x) called the detail or wavelet coefficients 13 4 The Fast Wavelet Transform • Fast Wavelet Transform (FWT) – computationally efficient implementation of the DWT – the relationship between the coefficients of the DWT at adjacent scales – also called Mallat's herringbone algorithm – resembles the twoband subband coding scheme 14 4 The Fast Wavelet Transform Scaling x by 2j, translating it by k, and letting m = 2k + n ( x) h (n) 2 (2 x n) n (2 j x k ) h (n) 2 2(2 j x k ) n h (m 2k ) 2 2 j 1 x m n m Similarity , j (2 x k ) h (m 2k ) 2 (2 j 1 x m) m Consider the DWT. Assume 1 W ( j0 , k ) M 1 M ( x) ( x) and ( x) ( x) M 1 f ( x) x 0 j0 , k ( x) h (m 2k ) ( x) h (n) 2 (2 x n) n 2 (2 j0 x m) m 15 4 The Fast Wavelet Transform 1 W ( j , k ) M 1 M M 1 f ( x) j ,k ( x) f ( x)2 j / 2 (2 j x k ) x 0 j ,k ( x) 2 j / 2 (2 j x k ) x j/2 j 1 f ( x )2 h ( m 2 k ) 2 (2 x m ) x m 1 ( j 1) / 2 j 1 h (m 2k ) f ( x )2 (2 x m ) m M x 1 M h (m 2k )W ( j 1, m) m Similarity, W ( j, k ) h (m 2k )W ( j 1, m) m 16 4 The Fast Wavelet Transform W ( j , k ) h (n) W ( j 1, n) W ( j , k ) h (n) W ( j 1, n) n 2 k , k 0 n 2 k ,k 0 Figure 3 An FWT analysis filter bank. 17 4 The Fast Wavelet Transform Figure 4 An FWT-1 synthesis filter bank. By subband coding theorem, perfect reconstrucion for two-band orthonormal filters requires gi (n) hi (n) for i = {0, 1}. That is, the synthesis and analysis filters must be time-reversed versions of one another. Since the FWT analysis filter are h0 (n) h (n) and h1 (n) h (n) , the required FWT-1 synthesis filters are g 0 (n) h0 (n) h (n) and g1 (n) h1 (n) h (n) . 18 Wavelet Transform vs. Fourier Transform • Fourier transform – Basis function cover the entire signal range, varying in frequency only • Wavelet transform – Basis functions vary in frequency (called “scale”) as well as spatial extend • High frequency basis covers a smaller area • Low frequency basis covers a larger area 19 Wavelet Transform vs. Fourier Transform Time-frequency distribution for (a) sampled data, (b) FFT, and (c) FWT basis 20 5 Wavelet Transforms in Two Dimension Figure 5 The two-dimensional FWT the analysis filter. 21 5 Wavelet Transforms in Two Dimension W ( j , m, n) WH ( j, m, n) W ( j 1, m, n) WV ( j , m, n) WD ( j, m, n) two-dimensional decomposition W ( j , m, n) WH ( j, m, n) W ( j 1, m, n) WV ( j , m, n) WD ( j, m, n) Figure 6 Two-scale of two-dimensional decomposition 22 5 Wavelet Transforms in Two Dimension 23 5 Wavelet Transforms in Two Dimension Figure 7 The two-dimensional FWT the synthesis filter bank. 24 Common Wavelet Filters • Haar: simplest, orthogonal, not very good • Daubechies 8/8: orthogonal • Daubechies 9/7: bi-orthogonal most commonly used if numerical reconstruction errors are acceptable • LeGall 5/3: bi-orthogonal, integer operation, can be implemented with integer operations only, used for lossless image coding 25 6 Image Compression image Wavelet coding Quantization • Quantization Entropy coding bitstream W j (m, n) q j (m, n) sign( y j (m, n)) j – uniform scalar quantization – separate quantization step-sizes for each subband • Entropy coding – Huffman coding – Arithmetic coding 26 7 Simulation Result I1 encoder C decoder I2 I1: Original image with width W and height H C: Encoded jpeg stream from I1 I2: Decoded image from C CR (Compression Ratio) = sizeof(I1) / sizeof(C) H RMS (Root mean square error) = W I1 ( x, y) I 2 ( x, y) /( H W ) 2 y 1 x 1 27 7 Simulation Result Original image DCT-based image compression CR = 11.2460 RMS = 4.1316 Wavelet-based image compression CR = 10.3565 RMS = 4.0104 28 7 Simulation Result Original image DCT-based image compression CR = 27.7401 RMS = 6.9763 Wavelet-based image compression CR = 26.4098 RMS = 6.8480 29 7 Simulation Result Original image DCT-based image compression CR = 53.4333 RMS = 10.9662 Wavelet-based image compression CR = 51.3806 RMS = 9.6947 30 Reference • • • • R. C. Gonzolez, R. E. Woods, "Digital Image Processing second edition", Prentice Hall, 2002. R. C. Gonzolez, R. E. Woods, S. L. Eddins, "Digital Image Processing Using Matlab", Prentice Hall, 2004. T. Acharya, A. K. Ray, "Image Processing: Principles and Applications", John Wiley & Sons, 2005. B. E. Usevitch, 'A Tutorial on Modern Lossy Wavelet Image Compression: Foundations of JPEG 2000', IEEE Signal Processing Magazine, vol. 18, pp. 22-35, Sept. 2001. 31