Digital Image Processing Lectures 11 & 12, Lecture notes of Digital Image Processing

2-D Discrete Fourier Transform Unified Matrix Representation Other Image Transforms Discrete Cosine Transform (DCT). Digital Image Processing. Lectures 11 & ...

Typology: Lecture notes

2021/2022

Uploaded on 08/01/2022

fioh_ji
fioh_ji 🇰🇼

4.5

(70)

814 documents

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Digital Image Processing Lectures 11 & 12 and more Lecture notes Digital Image Processing in PDF only on Docsity!

Digital Image Processing

Lectures 11 & 12

M.R. Azimi, Professor

Department of Electrical and Computer Engineering Colorado State University

Algorithm For Computing Linear Convolution using 2D

DFT-Cont

Example 1 (circular convolution): Consider 2-D arrays x(m, n) = 1 0 2 1 ,h(m, n) =^

1 0 1 1. Find^ yˆ(m, n) and y(m, n). The 2 × 2 DFT of these sequences give

X(k, l) =

∑^1 m=

∑^1 n=

x(m, n)e−j^ 2 πmk 2 e−j^ 2 πnl 2

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

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

y(m, n) =

Note: yˆ(m, n) is the aliased version of this array. Extend arrays to size P = 4 ≥ M 1 + M 2 − 1 , Q = 4 ≥ N 1 + N 2 − 1 i.e.

x′(m, n) =

, h′(m, n) =

Taking 4 × 4 DFT and IDFT of the product gives

y′(m, n) =

which is y(m, n) if the last row and column are removed.

Properties and Remarks a. Symmetry and Unitary For a 1-D DFT matrix

WtN = WN i.e. symmetry, W− N^1 = W∗ N i.e. unitary

Thus W N∗ WN = I. b. Energy Conservation For a unitary transform the energy is preserved in both domains i.e.

‖X‖^2 = ‖x‖^2

To see this

‖X‖^2 =∆

N∑ − 1

k=

|X(k)|^2 = X∗ t X = x∗ t W∗ t N WN^ x

= x∗ t x = ‖x‖^2

c. 2-D DFT in Matrix Form For a 2-D finite-extent image, x(m, n) with ROS,RM N , the 2-D DFT is

X(k, l) =

M N

M∑ − 1

m=

N∑ − 1

n=

x(m, n)W (^) Mmk W (^) Nnl k ∈ [0, M −1], l ∈ [0, N − 1

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 = W M∗ XW N∗

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.

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

X(k) =

 



√^1 N

N∑ − 1 n=

x(n) k = 0 √ 2 N

N∑ − 1 n=

x(n) cos[ (2n 2 +1)N kπ] k ∈ [1, N − 1]

The inverse transform is

x(n) =

N

X(0)+

N

N∑ − 1

k=

X(k)cos[ (2n + 1)kπ 2 N ] n ∈ [0, N −1]

In matrix form we get

X = Cx, C = [c(k, n)]

with forward kernel

c(k, n) =

√ N^ k^ = 0, n^ ∈^ [0, N^ −^ 1] 2 N cos[^

(2n+1)kπ 2 N ]^ k^ ∈^ [1, N^ −^ 1], n^ ∈^ [0, N^ −^ 1]

where x is the signal vector X is the DCT vector. The inverse transform in matrix form is

x = C−^1 X = CtX

Remarks

(^1) DCT is real and orthogonal i.e. C = C∗, C−^1 = Ct

The inverse 2-D IDCT is

x(m,n)= (^) N^1 X(0,0)+ (^) N^2 ∑^

N∑ − 1 k=0,l= k,l 6 =(0,0)

X(k,l) cos[ (2m 2 +1)N kπ] cos[ (2n 2 +1)N lπ]

The 2-D DCT of an image x in matrix form becomes

X = CxCt

with forward kernel defined by

C(k,l;m,n)=

  

N^1 k,l=0, m,n∈[0,N^ −1] 2 N cos[^ (2m+1)kπ 2 N ] cos[^ (2n+1)lπ 2 N ]^ k,l^6 =0,^0 k,l∈[0,N^ −1],m,n∈[0,N^ −1]

The inverse 2-D IDCT in matrix form is

x = CtXC

Figure below shows basis images C(k, l) = ckctl , k, l ∈ [0, N − 1] of 2-D DCT for N = 8 where ck is kth column of C. Image x is decomposed as a linear combination of these basis images with the DCT coefficients, X(k, l)s, i.e. x =

∑M − 1

k=

∑N − 1

l=0 X(k, l)C(k, l).

Example To show the usefulness of the DCT for data reduction and compression applications, we reconstructed the Peppers image based upon only 64 × 64 DCT coefficients. The following figures show the DCT coefficients of the Peppers image and the reconstructed result, which exhibits some smearing and ringing artifacts. Why?

Example 1 Show that the N × N cosine transform matrix C is orthogonal, i.e. prove CCt^ = IN. Consider the k, lth (for k, l 6 = 0) element of CCt,

[CCt]k,l = 2 N

N∑ − 1

n=

cos[ (2n + 1)kπ 2 N ] cos[ (2n + 1)lπ 2 N ]

= 1 2 N

N∑ − 1

n=

[e −j(2n+1)(^2 N^ k+l)π+e j(2n+1)(^2 Nk^ +l)π+e −j(2n+1)(^2 N^ k−l)π+e j(2n+1)(^2 Nk^ −l)π]

which simplifies to

[CCt]k,l = cos[ (k + l)π 2 N ]δ(k + l − N ) + cos[ (k − l)π 2 N ]δ(k − l)

where the first term is always zero and the second term is also zero except when k = l. Thus,

[CCt]k,l ==

{ 1 f or k = l 0 otherwise