Integral and Discrete Transforms in Image Processing Z-transform David Svoboda email: svoboda@fi.muni.cz Centre for Biomedical Image Analysis Faculty of Informatics, Masaryk University, Brno, CZ October 24, 2022 David Svoboda (CBIA@FI) Image Transforms autumn 2022 1 / 22 Outline 1 Definition 2 Properties 3 Applications David Svoboda (CBIA@FI) Image Transforms autumn 2022 2 / 22 1 Definition 2 Properties 3 Applications David Svoboda (CBIA@FI) Image Transforms autumn 2022 3 / 22 Z-Transform Definition (bilateral) Z-Transform F(z) = ∞ n=−∞ f (n)z−n (unilateral) Z-Transform F(z) = ∞ n=0 f (n)z−n Notice: Here z ∈ C, i.e. for z = eiω we get a special case of Z-transform, which is DFT. David Svoboda (CBIA@FI) Image Transforms autumn 2022 4 / 22 Z-Transform Definition Forward transform converts discrete series into continuous signal (Z-plane) F(z) = ∞ n=−∞ f (n)z−n Inverse transform If F(z) is a polynomial, i.e. F(z) = ∞ k=−∞ ckz−k, then f (n) = Z−1 (F(z)) = ∞ k=−∞ ckδ(n − k) Notice: Forward transform applied to discrete signals or linear filters always creates a polynomial with one variable z. David Svoboda (CBIA@FI) Image Transforms autumn 2022 5 / 22 Z-Transform Some examples Z-transform of a constant signal/averaging filter (left aligned): f (n) = [1, 1, 1, 1, 1] F(z) = 1 + z−1 + z−2 + z−3 + z−4 Z-transform of a constant signal/averaging filter (centered): f (n) = [1, 1, 1, 1, 1] F(z) = z+2 + z+1 + 1 + z−1 + z−2 Z-transform of Sobel filter: f (n) = [−1, 0, 1] F(z) = −z+1 + z−1 Z-transform of any random filter: f (n) = [1, 3, 1, 4, 2] F(z) = z+1 + 3 + z−1 + 4z−2 + 2z−3 Notice: With Z-transform, we always pay attention to origin! David Svoboda (CBIA@FI) Image Transforms autumn 2022 6 / 22 Z-Transform An inverse transfom Inverse transform for linear filters is an easy step: Signal of length 5: F(z) = 3z3 + z − 3z−1 f (n) = Z−1 (F(z)) = [3, 0, 1, 0, −3] Gaussian filter in Z-domain: F(z) = 1 4 z + 1 2 + 1 4 z−1 f (n) = Z−1 (F(z)) = 1 4 [1, 2, 1] Step function in Z-domain F(z) = z−1 + z−2 + z−3 + z−4 f (n) = Z−1 (F(z)) = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] David Svoboda (CBIA@FI) Image Transforms autumn 2022 7 / 22 Z-Transform Relationship to other transforms Important notes: green circle (z = eiφ ⇒ |z| = 1) reduces Z-transform simply to discrete Fourier transform DC (direct current) term is DC term from DFT Re Im r=1 ω Z−plane DC term David Svoboda (CBIA@FI) Image Transforms autumn 2022 8 / 22 1 Definition 2 Properties 3 Applications David Svoboda (CBIA@FI) Image Transforms autumn 2022 9 / 22 Z-Transform – Properties Delay/Shift Z{f (n − k)} = F(z)z−k An example: f (n) = [1, 2, 3, 4] g(n) = [1, 2, 3, 4] h(n) = [1, 2, 3, 4] F(z) = 1 + 2z−1 + 3z−2 + 4z−3 G(z) = z1 + 2 + 3z−1 + 4z−2 H(z) = z2 + 2z + 3 + 4z−1 F(z) = G(z)z−1 F(z) = H(z)z−2 G(z) = H(z)z−1 David Svoboda (CBIA@FI) Image Transforms autumn 2022 10 / 22 Z-Transform – Properties Convolution theorem Z{f (n) ∗ g(n)} = F(z) · G(z) Corollary: Convolution in time domain becomes a polynomial multiplication in Z-domain: Z([3, 5] ∗ [−1, 1]) = 3 + 5z−1 · −1 + z−1 An example: [3, 5] ∗ [−1, 1] = [−3, −2, 5] /Z(·) Z([3, 5] ∗ [−1, 1]) = Z([−3, −2, 5]) Z([3, 5]) · Z([−1, 1]) = Z([−3, −2, 5]) (3 + 5z−1 ) · (−1 + z−1 ) = −3 − 2z−1 + 5z−2 −3 − 2z−1 + 5z−2 = −3 − 2z−1 + 5z−2 David Svoboda (CBIA@FI) Image Transforms autumn 2022 11 / 22 Z-Transform – Properties Convolution theorem - cont’d time domain Z-domain separation of convolved signals polynomial factorization An example (Gaussian decomposition): [1, 2, 1] = Z−1 z + 2 + z−1 = Z−1 1 + z−1 · (z + 1) = Z−1 1 + z−1 ∗ Z−1 [z + 1] = [1, 1] ∗ [1, 1] David Svoboda (CBIA@FI) Image Transforms autumn 2022 12 / 22 Z-Transform – Properties Linearity Z{af (n) + bg(n)} = aF(z) + bG(z) An example: f ′ (n) = f (n) ∗ [1, −1, 2] f ′ (n) = 2f (n) − f (n + 1) + f (n + 2) /Z(·) Z(f ′ (z)) = Z(2f (n)) − Z(f (n + 1)) + Z(f (n + 2)) F′ (z) = 2F(z) − F(z)z1 + F(z)z2 F′ (z) = F(z)[2 − z1 + z2 ] Notice: Keep in mind that: Z([1, −1, 2]) = z2 − z1 + 2 David Svoboda (CBIA@FI) Image Transforms autumn 2022 13 / 22 Z-Transform – Properties Symmetry Z{f (−n)} = F 1 z See the relationship betwenn time-revesed signals: f (n) = [1, 2, 3, 4, 5, 6] F(z) = 1 + 2z−1 + 3z−2 + 4z−3 + 5z−4 + 6z−5 ⇓ f (−n) = [6, 5, 4, 3, 2, 1] F(z−1 ) = 1 + 2z1 + 3z2 + 4z3 + 5z4 + 6z5 David Svoboda (CBIA@FI) Image Transforms autumn 2022 14 / 22 Z-Transform – Properties Signal upsampling Let L be a positive integer and h(n) = f (n/L) n/L is an integer 0 otherwise Then H(z) = F(zL ) Derivation: H(z) = n=...,−L,0,L,... f (n/L)z−n = m=...,−1,0,1,... f (m)z−mL = m=...,−1,0,1,... f (m) zL −m = F(zL ) David Svoboda (CBIA@FI) Image Transforms autumn 2022 15 / 22 Z-Transform – Properties Signal decomposition with downsampling F(z) = Feven(z2 ) + z−1 Fodd (z2 ) An example: f (n) = [a, b, c, d, e, f ] feven(n) = [a, c, e] fodd (n) = [b, d, f ] F(z) = a + bz−1 + cz−2 + dz−3 + ez−4 + fz−5 Feven(z) = a + cz−1 + ez−2 Fodd (z) = b + dz−1 + fz−2 Feven(z2 ) = a + cz−2 + ez−4 Fodd (z2 ) = b + dz−2 + fz−4 Feven(z2 ) + z−1 Fodd (z2 ) = a + bz−1 + cz−2 + dz−3 + ez−4 + fz−5 David Svoboda (CBIA@FI) Image Transforms autumn 2022 16 / 22 Z-Transform – Properties Signal decomposition without downsampling F(z) = 1 2 [F(z) + F(−z)] + 1 2 [F(z) − F(−z)] where Feven(z2 ) = 1 2 [F(z) + F(−z)] . . . even component Fodd (z2 ) = 1 2 [F(z) − F(−z)] . . . odd component An example: f = [a, b, c, d, e, f ] /Z(·) F(z) = a + bz−1 + cz−2 + dz−3 + ez−4 + fz−5 EVEN = 1 2 [F(z) + F(−z)] = a + cz−2 + ez−4 = Z−1 [a, 0, c, 0, e, 0] ODD = 1 2 [F(z) − F(−z)] = bz−1 + dz−3 + fz−5 = Z−1 [0, b, 0, d, 0, f ] David Svoboda (CBIA@FI) Image Transforms autumn 2022 17 / 22 Z-Transform Transfer function Definition Let f and h be input and output signals, respectively, and let g be a linear filter such that h = f ∗ g, then Z(g) is called a transfer function. An example: h = f ∗ [1, 2, 1] /Z(·) H(z) = F(z) · z + 2 + z−1 H(z) F(z) = z + 2 + z−1 G(z) = H(z) F(z) = z + 2 + z−1 Notice: Transfer function expresses the frequency response of selected linear filter. In optics, G(z), when assigning z = eiφ , is called a optical transfer function (OTF) and its time-domain counter part is a point spread function (PSF). David Svoboda (CBIA@FI) Image Transforms autumn 2022 18 / 22 1 Definition 2 Properties 3 Applications David Svoboda (CBIA@FI) Image Transforms autumn 2022 19 / 22 Z-Transform Applications The areas that rely on Z-transform Linear recursive filters Optimization of wavelet transform Understanding and frequency analysis of linear filters . . . David Svoboda (CBIA@FI) Image Transforms autumn 2022 20 / 22 Bibliography Strang G., Nguyen T. Wavelets and Filter Banks, Wellesley-Cambridge Press, 1997, ISBN 0-9614088-7-1 Steven W. Smith. The scientist and engineer’s guide to digital signal processing. California Technical Publishing, USA. 1997 https://www.youtube.com/watch?v=B4IyRw1zvvA David Svoboda (CBIA@FI) Image Transforms autumn 2022 21 / 22 You should know the answers . . . Describe the relationship between Fourier transform and Z-transform. What is the Z-transform of signal [1, 2, 4, 3, 20, −5, 23]? What is the Z-transform of Gaussian filter? How is the time delay expressed with Z-transform? Is it possible to perform inverse Z-transform for a linear filter? How is the signal upsampling expressed with Z-transform? What is a transfer function? What does the polynomial z − 1 z mean? David Svoboda (CBIA@FI) Image Transforms autumn 2022 22 / 22