Wavelets and Image Compression Augusta State University April, 27, 6 Joe Lakey Department of Mathematical Sciences New Mexico State University 1
Signals and Images Goal Reduce image complexity with little loss in information Goal Fast algorithms for decomposition/reconstruction Goal Uniform success over a large class of signals/images Problem How to define information vs. content 2
Function spaces: How do we measure magnitudes, errors, etc? L 2 (R) : f, g = f(x) g(x) dx; f 2 = f, f 1/2 l 2 (Z) : c, d = k c k d k ; c l 2 = c, c 1/2 L 2, l 2 : Integrals / sums converge Image processing: is L 2 a good metric for perception? Alternatives: f L 2 or f L 1. 3
SVD Singular Value Decomposition Images are matrices of pixel values. Truncations: A = UΣV T Ã = U ΣV T Classical approach Optimal in average sense. Data specific: Image as matrix Good for discrimination 4
Fourier transform 5
Figure 1: Fourier, before and after [include Fourier before and after here] Fourier transform on R ˆf(ξ) = f(t) e 2πitξ dt = f, cos 2πtξ + i sin 2πtξ Fourier inversion formula f(t) = ˆf(ξ)e 2πitξ dξ In what sense does this representation converge? Unitary: f, g = ˆf, ĝ. 6
ˆf 2 = f 2 Fourier series: periodic functions f(t +1)=f(t) ˆf[n] = 1 0 f(t) e 2πint dt f(t) = n= ˆf[n] e 2πint 7
Properties on R Translation and modulation Dilation: forλ>0: F(f( α))(ξ) =e 2πiαξ F(f( ))(ξ); F(e 2πiα f( ))(ξ) =F(f( ))(ξ α) F(f(λ ))(ξ) = 1 λ F(f( )) ( ξ λ Periodization: f p (t) = n= f(t + n) ) f p [n] = ˆf(n) Plancherel; Parseval: f, g = ˆf, ĝ 8
Discrete signals Digital signals come from sampling Discrete Fourier transform matrix: F jk = 1 N ω jk, ω = e 2πi/N, j,k =0,...,N 1 9
Figure 2: John Tukey. Developed FFT (O(N logn)) with J.W. Cooley 10
Wavelets: A little history 11
10 20 30 40 50 60 70 80 90 10 20 30 40 50 60 70 80 90 Figure 3: Alfred Haar. First wavelet basis in 1909 12
Philip Franklin (1928): Periodic continuous wavelets... Yves Meyer (early 80s): Can one discretize to get an ONB? J.O. Strömberg: Franklin wavelets function spaces 13
Why weren t wavelets developed sooner? Data explosion: more recent FFT: good enough? Why did wavelets become so popular so quickly? Engineering: Esteban et al: subband coding for speech processing; parallel implementations Seismic imaging: Morletetal(CWT) Mathematics: nice for analyzing function spaces, PDEs Approximation theory: subdivision, splines, etc. Other areas 14
Applications/directions FBI fingerprint standard JPEG 0 PDE Different directions: Wavelet packets: Coifman-Meyer. Algorithms: Wickerhauser. Local trigonometric bases: Coifman-Meyer; Malvar. Time-frequency tilings Brushlets: Coifman et al. http://www.math.yale.edu/ycm/ chirplets Curvelets...: Donoho, Càndes et. al. 15
The holy grail: what is the right way of representing a signal? Grand challenge obtain accurate models of naturally occurring sources of data, obtain optimal representations of such models and rapidly compute such optimal representations. Why STILL wavelets? 16
Wavelets to mathematicians: Easy properties Scaling equation: ϕ(x) =2 k h k ϕ(2x k) 17
Linear spline H(x) = = ½ H(2x) + + H(2x - 1) + ½ H(2x - 2) 18
ϕ(x) = lim T n f 0 Tf(x) = 2 k h k f(2x k) subdivision scheme 19
D4 scaling, level 3 D4 wavelet 1 1 0.8 0.8 0.6 0.6 0.4 0.4 0.2 0 0.2 0.2 0 0.4 0.6 2 1 0 1 2 1 0 1 Figure 5: Level 3 20
D4 scaling, level 4 D4 wavelet 1.2 1 1 0.8 0.6 0.5 0.4 0 0.2 0 0.5 0.2 2 1 0 1 1 2 1 0 1 Figure 6: Level 4 21
D4 scaling, level 6 D4 wavelet 1.2 1.5 1 1 0.8 0.6 0.5 0.4 0 0.2 0.5 0 0.2 1 2 1 0 1 2 1 0 1 Figure 7: Level 6 22
D4 scaling, level 8 D4 wavelet 1.2 1.5 1 1 0.8 0.6 0.5 0.4 0 0.2 0.5 0 0.2 1 2 1 0 1 2 1 0 1 Figure 8: Level 8 23
D4 scaling, level 10 D4 wavelet 1.2 1.5 1 1 0.8 0.6 0.5 0.4 0 0.2 0.5 0 0.2 1 2 1 0 1 2 1 0 1 Figure 9: Level 10 24
V ϕ = { k c kϕ(x k) : k Z c2 k < } V ϕ j = {f(2 j x): f(x) V ϕ } Scaling implies V ϕ j V ϕ j+1. 25
MultiResolution Analysis properties: V ϕ j V ϕ j+1 V j = lim j V j = {0} V j dense in L 2 (R). Abstract Hilbert space theory: spaces W j : V 1 = V 0 W 0 V 2 = V 1 W 1 = V 0 W 0 W 1...... V N = V 0 W 0 W N 1...... L 2 (R) = j= W j 26
What one wants Approximation: Polynomials up to some degree nearly in V ϕ j Regularity: ϕ has some derivatives ϕ(x) = lim T n f 0 Tf(x) = 2 k h k f(2x k) converges in a suitable norm Orthogonality: ϕ( ), ϕ( k) = δ 0k 27
Construction of ϕ from {h k } 1 2 ϕ( x ) 2 = k h k ϕ(2x k) ˆϕ(2ξ) = k h k e 2πikξ ˆϕ(ξ) H(ξ) = k = H(ξ)ˆϕ(ξ) h k e 2πikξ Iterate... ˆϕ(2ξ) =ˆϕ(ξ) H(ξ/2 j ) j=1 28
Orthogonality: ϕ( ), ϕ( k) = δ 0k ϕ( ), ϕ( k) = ϕ(x)ϕ(x k) dx = = = l= l 1 l= 1 0 ˆϕ(ξ)ˆϕ(ξ) e 2πikξ dξ l+1 0 ˆϕ(ξ) 2 e 2πikξ dξ ˆϕ(ξ + l) 2 e 2πikξ dξ Φ(ξ) 2 e 2πikξ dξ Orthogonality plus Fourier uniqueness: Φ 1. 29
Orthogonality and H Break into odd and even and using Φ 1: 1 = l ˆϕ(2ξ + l) 2 = l ( H ξ + l ) ( 2 ˆϕ ξ + l ) 2 2 2 = l = l ( ) ( ) ( H ξ + l 2 ˆϕ ξ + l 2 + H ξ + l + 1 ) ( 2 ˆϕ ξ + l + 1 ) 2 2 2 ( ) ( ) ( H ξ 2 ˆϕ ξ + l 2 + H ξ + 1 ) ( 2 ˆϕ ξ + l + 1 ) 2 2 2 ( = H(ξ) 2 + H ξ + 1 ) 2 2 30
Condition of orthogonality: H(ξ) 2 + H ( ξ + 1 ) 2 1 2 Plus some subtleties! 31
Conditions of regularity Depends on eigenvalues of transition matrix Example Daubechies 4-coefficient systems H(z) = 1 1+ν 2 ( ν(ν 1) + (1 ν)z +(1+ν)z 2 + ν(1 + ν)z 3) 32
Dnu scaling nu =.001 Dnu wavelet 0.06 0.06 0.05 0.04 0.04 0.02 0.03 0 0.02 0.02 0.01 0.04 0 2 1 0 1 33 0.06 2 1 0 1
0.12 Dnu scaling nu =.2 Dnu wavelet 0.1 0.05 0.08 0.06 0 0.04 0.02 0.05 0 0.1 0.02 0.04 0.15 2 1 0 1 34 2 1 0 1
Dnu scaling nu =.5 Dnu wavelet 0.08 0.08 0.06 0.06 0.04 0.02 0.04 0 0.02 0.02 0.04 0.06 0 0.08 0.02 0.1 2 1 0 1 35 0.12 2 1 0 1
Dnu scaling nu =.7 Dnu wavelet 0.07 0.06 0.06 0.05 0.04 0.02 0.04 0 0.03 0.02 0.02 0.01 0.04 0 0.06 0.01 2 1 0 1 36 0.08 2 1 0 1
Dnu scaling nu =.9 Dnu wavelet 0.06 0.06 0.05 0.04 0.04 0.02 0.03 0 0.02 0.02 0.01 0.04 0 0.06 2 1 0 1 37 2 1 0 1
37-1 Dnu scaling nu =.99 Dnu wavelet 0.06 0.06 0.05 0.04 0.04 0.02 0.03 0 0.02 0.02 0.01 0.04 0 2 1 0 1 0.06 2 1 0 1
Wavelets to engineers Low pass H(ω) = k h k e 2πikω High pass G(ω) =e πiω k ( 1) k h 1 k e 2πikω = e πiω H(ω +1/2) 38
Mother wavelet ψ(x) =2 k g k ψ(2x k) Wavelet basis ψ jk (x) =2 j ψ(2 j x k) 39
A catalog of wavelets Look in folder orthogonal ; see also biorthogonal, interpolating For multiwavelets, see mwmp, coefs and multiplot Principal examples: (1) Meyer (2) Battle-Lemarie (3) Daubechies (4) Deslaurier s-dubuc (5) spline wavelets Multiwavelets: good symmetry and support properties Custom designed MRA (i) one benefits from the scaling perspective here! (ii) idea of local approximation (iii) symmetry comes from symmetry of the coefficients. 40
41
0.2 Haar Wavelet 0.2 D4 Wavelet 0.1 0.1 0 0 0.1 0.1 0.2 0.2 0.2 0.4 0.6 0.8 1 0.3 0.2 0.4 0.6 0.8 1 0.2 C3 Coiflet 0.2 S8 Symmlet 0.1 0.1 0 0 0.1 0.1 0.2 0.2 0.4 0.6 0.8 1 42 0.2 0.2 0.4 0.6 0.8 1
9 Some S8 Symmlets at Various Scales and Locations 8 7 6 5 4 3 2 1 (7,95) (6,43) (6,32) (6,21) (5,13) (4, 8) (3, 5) (3, 2) 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 43
GHM scaling #1 GHM wavelet #1 2.5 2 2 1 1.5 0 1 0.5 1 0 2 1 0 1 2 2 1 0 1 GHM scaling #2 GHM wavelet #2 2 2 1.5 1 1 0 0.5 0 0.5 2 1 0 1 44 1 2 2 1 0 1
Discrete implementation 45
Discrete convolution/decimation filters H, G : l 2 (Z) l 2 (Z) (Ha) k = 2 l h l 2k a l (Ga) k = 2 l ḡ l 2k a l. 46
Fast wavelet transform c N H c N 1 H c N 2 H c N 3 c L G G G d N 1 d N 2 d N 3 d L Inverse Fast wavelet transform c L H H c L+1 H c L+2 c L+3 c N 1 H c N G G G G G d L d L+1 d L+2 d N 2 d N 1 47
log(resolution) 0.5 0 Object Doppler 0.5 0 0.5 1 2 4 6 8 WT[Doppler] 10 0 0.5 1 position 48 Wavelet Components of Object Doppler (8,10) (8, 9) 40 (7,11) (7,10) (7, 9) (7, 8) (7, 6) 35 (6,12) (6,10) (6, 9) (6, 8) (6, 7) 30 (6, 6) (6, 5) (6, 4) (6, 3) (5,10) 25 (5, 9) (5, 8) (5, 7) (5, 6) (5, 5) 20 (4,13) (4, 8) (4, 7) (4, 6) (4, 5) 15 (4, 4) (4, 3) (4, 2) (3, 7) (3, 6) 10 (3, 5) (3, 4) (3, 3) (3, 2) (3, 1) 5 (3, 7) (3, 6) (3, 5) (3, 4) (3, 3) 0 0 0.5 1
The crime of wavelets Sample/pixel values treated as {c N } 49
Multivariate wavelets: tensor products Simple: tensor products. 2 n 1 wavelets: V 1 V 1 =(V 0 W 0 ) (V 0 W 0 )= (V 0 V 0 ) [(W 0 V 0 ) (V 0 W 0 ) (W 0 W 0 )] 50
Comparison of Methods I: Zebra 51
50 150 250 50 150 250 52
reconstruction from largest8% Fourier coefficientsreconstruction from largest8 % wavelet coefficients 50 50 150 150 250 50 150 250 250 50 150 250 53
reconstruction from largest4% Fourier coefficientsreconstruction from largest4 % wavelet coefficients 50 50 150 150 250 50 150 250 250 50 150 250 54
reconstruction from largest2% Fourier coefficientsreconstruction from largest2 % wavelet coefficients 50 50 150 150 250 50 150 250 250 50 150 250 55
Comparison of Methods II: Max 56
600 600 700 800 57
50 150 250 50 150 250 58
Eigenvector approximations of Max 59
reconstruction from largest0.5% eigenvalues Reconstruction Error (rescaled intensity) 60
reconstruction from largest2% eigenvalues Reconstruction Error (rescaled intensity) 61
reconstruction from largest4% eigenvalues Reconstruction Error (rescaled intensity) 62
reconstruction from largest8 % eigenvalues Reconstruction Error (rescaled intensity) 63
reconstruction from largest16 % eigenvalues Reconstruction Error (rescaled intensity) 64
reconstruction from largest32 % eigenvalues Reconstruction Error (rescaled intensity) 65
Fourier Approximations of Max 66
reconstruction from largest5e 005 % Fourier coefficientsreconstruction Error (rescaled intensity) 67
reconstruction from largest0.0005 % Fourier coefficientsreconstruction Error (rescaled intensity) 68
reconstruction from largest0.005 % Fourier coefficients Reconstruction Error (rescaled intensity) 69
reconstruction from largest0.05 % Fourier coefficients Reconstruction Error (rescaled intensity) 70
reconstruction from largest0.5 % Fourier coefficients Reconstruction Error (rescaled intensity) 71
reconstruction from largest2 % Fourier coefficients Reconstruction Error (rescaled intensity) 72
reconstruction from largest4 % Fourier coefficients Reconstruction Error (rescaled intensity) 73
reconstruction from largest8 % Fourier coefficients Reconstruction Error (rescaled intensity) 74
reconstruction from largest16 % Fourier coefficients Reconstruction Error (rescaled intensity) 75
Wavelet approximations of Max 76
Wavelet Transform of Max 50 150 250 350 450 50 150 250 350 450 77
0 Nonzero Pattern in Sparsification of WT[Max] 50 150 250 350 450 0 50 150 250 350 450 nz = 13108 78
reconstruction from largest5e 005 % waveletsreconstruction Error (rescaled intensity) 79
reconstruction from largest0.0005 % waveletsreconstruction Error (rescaled intensity) 80
reconstruction from largest0.005 % wavelets Reconstruction Error (rescaled intensity) 81
reconstruction from largest0.05 % wavelets Reconstruction Error (rescaled intensity) 82
reconstruction from largest0.5 % wavelets Reconstruction Error (rescaled intensity) 83
reconstruction from largest2 % wavelets Reconstruction Error (rescaled intensity) 84
reconstruction from largest4 % wavelets Reconstruction Error (rescaled intensity) 85
reconstruction from largest8 % wavelets Reconstruction Error (rescaled intensity) 86
Max: Fourier versus wavelet 87
10 10 Wavelet Compression vs. DCT Compression 10 9 DCT sum(error 2 ) DWT 10 8 10 7 0 0 0 0 0 0 6000 Number of Coefficients Retained 88
reconstruction from largest0.5% Fourier coefficientsreconstruction from largest0.5 % wavelet coefficients 89
reconstruction from largest1% Fourier coefficients reconstruction from largest1 % wavelet coefficients 90
reconstruction from largest2% Fourier coefficients reconstruction from largest2 % wavelet coefficients 91
reconstruction from largest4% Fourier coefficients reconstruction from largest4 % wavelet coefficients 92
Homework: make the world a better place Can you use wavelets to make better cats and dogs? 93
600 50 150 250 600 800 Figure 56: Man s best friends? 94
Some basics of matlab Software resources try this first http://www.wavelet.org/wavelet/index.html 95
Bounded variation and decay Cohen, DeVore, Petrushev and Yu : If f L 1 (R n )thenβ(j, k) =2 j(1 n 2 ) f,ψ jk defines a sequence in l 1, (Z Z n ), that is, for each λ>0, #{Q Q : β(q) >λ} c(n) λ f dx Corollary A deep improvement of the Sobolev embedding theorem. 96
Further issues Progressive transmission and reconstruction Entropy and source coding 97