Digital Image Processing Lectures 11 & 12

Digital Image Processing Lectures 11 & 12

2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) Digital Image Processing Lectures 11 & 12 M.R. Azimi, Professor Department of Electrical and Computer Engineering Colorado State University M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) Algorithm For Computing Linear Convolution using 2D DFT-Cont Example 1 (circular convolution): 1 0 1 0 Consider 2-D arrays x(m; n) = ,h(m; n) = . Find y^(m; n) 2 1 1 1 and y(m; n). The 2 × 2 DFT of these sequences give 1 1 X X −j 2πmk −j 2πnl X(k; l) = x(m; n)e 2 e 2 m=0 n=0 X(0; 0) = x(0; 0) + x(0; 1) + x(1; 0) + x(1; 1) = 4 X(0; 1) = x(0; 0) + x(0; 1)e−jπ + x(1; 0) + x(1; 1)e−jπ = x(0; 0) − x(0; 1) + x(1; 0) − x(1; 1) = 1 − 0 + 2 − 1 = 2 X(1; 0) = x(0; 0) + x(0; 1) + x(1; 0)e−jπ + x(1; 1)e−jπ = x(0; 0) + x(0; 1) − x(1; 0) − x(1; 1) = −2 M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) X(1; 1) = x(0; 0) + x(0; 1)e−jπ + x(1; 0)e−jπ + x(1; 1)e−j2π = 0 4 2 3 1 Thus X(k; l) = , H(k; l) = . and −2 0 −1 1 12 2 Y^ (k; l) = X(k; l)H(k; l) = . Taking IDFT we get 2 0 4 3 y^(m; n) = . This result can alternatively be obtained using 3 2 the circular convolution in the spatial domain i.e. 1 1 X X y^(m; n) = x(p; q)h(((m − p))2; ((n − q))2) p=0 q=0 y^(0; 0) = x(0; 0)h(0; 0) + x(0; 1)h(0; 1) + x(1; 0)h(1; 0) +x(1; 1)h(1; 1) = 4 M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) y^(0; 1) = x(0; 0)h(0; 1) + x(0; 1)h(0; 0) + x(1; 0)h(1; 1) +x(1; 1)h(1; 0) = 3 y^(1; 0) = x(0; 0)h(1; 0) + x(0; 1)h(1; 1) + x(1; 0)h(0; 0) +x(1; 1)h(0; 1) = 3 y^(1; 1) = x(0; 0)h(1; 1) + x(0; 1)h(1; 0) + x(1; 0)h(0; 1) +x(1; 1)h(0; 0) = 2 Now, let us find the result of the desired linear convolution first using the direct method and then using the DFT. y(0; 0) = x(0; 0)h(0; 0) = 1 y(0; 1) = x(0; 0)h(0; 1) + x(0; 1)h(0; 0) = 0 . y(2; 1) = x(1; 1)h(1; 0) + x(1; 0)h(1; 1) = 3 y(2; 2) = x(1; 1)h(1; 1) = 1 M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) 1 0 0 y(m; n) = 3 2 0 2 3 1 Note: y^(m; n) is the aliased version of this array. Extend arrays to size P = 4 ≥ M1 + M2 − 1, Q = 4 ≥ N1 + N2 − 1 i.e. 1 0 0 0 1 0 0 0 2 1 0 0 1 1 0 0 x0(m; n) = ; h0(m; n) = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Taking 4 × 4 DFT and IDFT of the product gives 1 0 0 0 3 2 0 0 y0(m; n) = 2 3 1 0 0 0 0 0 which is y(m; n) if the last row and column are removed. M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) Matrix Representation of DFT Consider an N-point finite-extent sequence x(n), n 2 [0;N − 1] with DFT N−1 1 X nk X(k) = p x(n)WN k 2 [0;N − 1] N n=0 ∆ −2πj=N where WN = e , then in matrix form 2 3 2 3 1 1 ··· 1 2 3 X(0) 6 N−1 7 x(0) 6 7 6 1 WN ··· W 7 6 7 6 . 7 6 N 7 6 . 7 . = p1 6 7 . 6 7 N 6 . 7 6 7 6 . 7 6 . 7 6 . 7 4 5 6 . 7 4 5 X(N − 1) 4 5 x(N − 1) N×1 1 W N−1 ··· W N×1 N N N×N X = WN x W : DFT matrix with elements w = p1 W kn mod N N kn N N −1 The inverse is x = WN X. M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) Properties and Remarks a. Symmetry and Unitary For a 1-D DFT matrix t −1 ∗ WN = WN i:e: symmetry; WN = WN i:e: unitary ∗ Thus WN WN = I. b. Energy Conservation For a unitary transform the energy is preserved in both domains i.e. kXk2 = kxk2 To see this N−1 2 ∆ X 2 ∗t ∗t ∗t kXk = jX(k)j = X X = x WN WN x k=0 t = x∗ x = kxk2 M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) c. 2-D DFT in Matrix Form For a 2-D finite-extent image, x(m; n) with ROS,RMN , the 2-D DFT is M−1 N−1 1 X X mk nl X(k; l) = p x(m; n)WM WN k 2 [0;M−1]; l 2 [0;N−1] MN m=0 n=0 If x and X represent the original image matrix and its DFT image (complex) matrix (both of size M × N), respectively, the separable 2-D transform in matrix form can be written as X = WM xWN and ∗ ∗ x = WM XWN which shows the separability of the 2-D DFT. This is a unified matrix representation since for other image transforms such as sine, cosine, Hadamand, Haar and Slant transforms similar representation hold. M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) Basis Images of 2-D DFT ∗ ∗ H ∗ Let wk be the kth column of WM and wl be the lth row of WN , then the (k; l)th basis image is ∗ ∗ H W (k; l) = wkwl ∗ ∗ Using x = WM XWN the image can be represented as M−1 N−1 X X x = X(k; l)W∗(k; l) k=0 l=0 i.e. the image is decomposed onto a space spanned by these MN basis images.The coefficients in this representation are given by X(k; l) =< x; W∗(k; l) > where inner product of two matrices is given by M−1 N−1 X X < A; B >= a(m; n)b∗(m; n) m=0 n=0 . M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) Discrete Cosine Transform (DCT) Recall that the DFS of any real even symmetric signal contains only real coefficients corresponding to the cosine terms. This can be extended to the DFT of a symmetrically extended signal/image. There are many ways to symmetrically extend a signal or an image leading to variety of DCT types. Here, we present DCT-II which is the most common one (see Fig.). The 1-D DCT-II of a finite-extent signal x(n) of size N is 8 N−1 > p1 P x(n) k = 0 <> N X(k) = n=0 q N−1 > 2 P (2n+1)kπ :> N x(n) cos[ 2N ] k 2 [1;N − 1] n=0 M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) The inverse transform is r N−1 1 2 X (2n + 1)kπ x(n) = p X(0)+ X(k)cos[ ] n 2 [0;N−1] N 2N N k=1 In matrix form we get X = Cx;C = [c(k; n)] with forward kernel p ( 1= N k = 0; n 2 [0;N − 1] c(k; n) = q 2 (2n+1)kπ N cos[ 2N ] k 2 [1;N − 1]; n 2 [0;N − 1] where x is the signal vector X is the DCT vector. The inverse transform in matrix form is x = C−1X = CtX Remarks 1 DCT is real and orthogonal i.e. C = C∗;C−1 = Ct M.R. Azimi Digital Image Processing 2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT) 2 2-DCT can be performed using 1-D DCT's along columns and row, i.e. separable. 3 DCT is NOT the real part of the DFT rather it is related to the DFT of a symmetrically extended signal/image. 4 The energy of signal/image is packed mostly in only a few DCT coefficients (i.e. only a few significant X(k)'s), hence making DCT very useful for data compression applications. 2-D DCT of Images The 2-D DCT of a finite-extent image x(m; n) of size N × N is 8 > N−1 N−1 k;l=0;0 > 1 P P x(m;n) > N > m=0 n=0 m;n2[0;N−1] <> X(k;l)= k;l6=0;0 > N−1 N−1 > 2 P P x(m;n) cos[ (2m+1)kπ ] cos[ (2n+1)lπ ] k;l2[0;N−1]; > N 2N 2N > m=0 n=0 :> m;n2[0;N−1] M.R.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    18 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us