Selected Solutions to Homework 4 0) is easy and 3) is computational so both are omitted. 1) Verify that CDF(2,2) preserves the first moment, i.e. X n 1 X naj+1 [n] = √ naj [n]. 2 2 n Solution: From the given lifting steps, gathering like terms yields √ √ √ 2 2 3 2 aj [2n]− (aj [2n + 2] + aj [2n − 2])+ (aj [2n + 1] + aj [2n − 1]) . aj+1 [n] = 4 8 4 Multiplying each term by n and summing, we have ! √ √ X 3 2X 2 X naj+1 [n] = naj [2n] − naj [2n + 2] + naj [2n − 2] 4 8 n∈Z n∈Z n∈Z n∈Z ! √ X 2 X naj [2n + 1] + naj [2n − 1] . (1) + 4 X n∈Z n∈Z Now we treat each sum on the right hand side separately (each sum is over n ∈ Z): P 1 2 P 2naj [2n]. P P Now naj [2n + 2] = naj [2(n + 1)] = (n − 1)aj [2n]. P P Likewise, naj [2n − 2] = (n + 1)aj [2n]. First naj [2n] = P Therefore, X naj [2n + 2] + P naj [2n + 1] = X naj [2n + 1] + Finally, P X naj [2n − 2] = X naj [2(n + 1) − 1] = 2naj [2n]. P (n − 1)aj [2n − 1], so we have X naj [2n − 1] = 1 X (2n − 1)aj [2n − 1]. Thus, using these identities, we can rewrite (1) as X n∈Z √ √ √ 3 2X 2X 2X 2naj [2n] − 2naj [2n] + (2n − 1)aj [2n − 1] 8 8 4 n∈Z n∈Z n∈Z ! √ X 2 X 2naj [2n] + (2n − 1)aj [2n − 1] = 4 naj+1 [n] = n∈Z n∈Z 1 X = √ naj [n]. 2 2 n∈Z 2) In the z-transform formulation, we found T (z) for CDF(2,2) in class. Determine the entire matrix factorization in the z-transform for one lifting step of CDF(2,2). Now find the low pass filter h0 (simply h in our filter bank notation) from the identity H0 (z) = H00 (z 2 ) + zH01 (z 2 ). Solution: As in class, the easiest way to do this is to take the z-transform of the given prediction and update steps. The z-transfrom of P is 1 (1) Dj+1 (z) = Aj1 (z) − (1 + z)Aj0 (z). 2 The z-transform of the update step is 1 (1) (1) Aj+1 (z) = Aj0 (z) + (z −1 + 1)Dj+1 (z). 4 Thus, including the normalization, we have √ Aj+1 (z) 2 = Dj+1 (z) 0 0 1 √1 0 2 1 −1 4 (z 1 2 + 1) 1 − 12 (1 + z) Aj0 (z) 0 . j 1 A1 (z) Hence, H(z) is the product of the three 2 × 2 matrices, namely −1 1 −(z − 6 + z) H(z) = √ 4 2 −2(1 + z) 2(z −1 4 + 1) . Using the identity H0 (z) = H00 (z 2 ) + zH01 (z 2 ), we have 1 H0 (z) = √ (−z −2 + 2z −1 + 6 + 2z − z 2 ). 4 2 Since H0 (z) is the z-transform of our low pass filter h0 , we have that h0 [n] = 1 − 4√ 2 1 √ n = ±2 n = ±1 2 2 3 √ 2 2 0 n=0 n 6= 0, ±1, ±2. Similarly, we can find the high pass filter, h1 , h1 [n] = 1 − 2√ 2 √1 n = 0, 2 n=1 2 0 n 6= 0, 1, 2. Since h0 has 5 nonzero coefficients and h1 has 3 nonzero coefficients, CDF(2,2) is often called the 5\3-biorthogonal wavelet. 3 4) Suppose Lift(s) performs the lifting implementation for some transform on a one dimensional signal, s = {s[n] : n ∈ Z}. Describe how to perform a two dimensional, separable transform on an image, im = {im[n1 , n2 ] : n1 , n2 ∈ Z}. (Pseudo code is appropriate if that is easier for you.) Solution: Since many of you used MatLab, I’ll use the MatLab format. The algorithm should check for errors, such as k not being too large and that you want m and n to be powers of 2. Algorithm 1 2d Lifting Implementation Input: The image: im Number of levels of the transfrom: k Output: An image transformed k levels Initialization: 1: 2: Set z = 0 [m, n] = size(im); (initialize the counter) (assign the dimensions of the image) Iteration: 1: while z < k do 2: for i = 1 : m do 3: A(i, :) = Lift(im(i, :)); (perform the transform on the rows) 4: end for 5: for i = 1 : n do 6: T (1 : m, i) = Lift(A(:, i)0 ); (transform the columns of the new matrix) 7: end for 8: im = [ ]; A = [ ]; m = m/2; n = n/2; (reset the internal variables) 9: im = T (1 : m, 1 : n); (extract the low pass portion of the transformed matrix for the next iteration) 10: z = z + 1; (update the counter) 11: end while 12: return T 4 G5) Determine the z-transform factorization of the form K H(z) = 0 0 K −1 m Y 1 0 i=1 1 Si (z) −Ti (z) 1 0 1 for the biorthogonal transfrom CDF(3,3). Following the method from 2), we arrive at H(z) = √3 2 0 0 1 2 0 3 √ 1 −1 36 (3z 1 + 16 − 3z) − 83 (3 + z) 1 0 1 1 0 5 − 13 z −1 1 .