<<

C. A. Bouman: Processing - January 20, 2021 1

1-D Rate Conversion

• Decimation – Reduce the sampling rate of a discrete-time . – Low sampling rate reduces storage and computation requirements. • Interpolation – Increase the sampling rate of a discrete-time signal. – Higher sampling rate preserves fidelity. C. A. Bouman: - January 20, 2021 2

1-D Periodic Subsampling

• Time domain subsampling of x(n) with period D y(n)= x(Dn)

x(n)D y(n)

representation 1 D−1 Y (ejω)= X ej(ω−2πk)/D D Xk=0  

• Problem: Frequencies above π/D will alias. • Example when D =2

aliased aliased signal signal

ω −π −π/2 π/2 π

• Solution: Remove frequencies above π/D. C. A. Bouman: Digital Image Processing - January 20, 2021 3

Decimation System ω x(n) H(e j ) D y(n)

• Apply the filter H(ejω) to remove high frequencies – For |ω| <π Dω H(ejω)= rect  2π  – For all ω ∞ ω − k2π H(ejω) = rect D  2π  kX=−∞

= prect2π/D(ω) – 1 h(n)= sinc(n/D) D • Frequency domain representation 1 D−1 Y (ejω)= H ej(ω−2πk)/D X ej(ω−2πk)/D D Xk=0     C. A. Bouman: Digital Image Processing - January 20, 2021 4

Graphical View of Decimation for D =2 • Spectral content of signal X ejω  1

ω −π −π/2π/2π 3π/2 2π 5π/2

• Spectral content of filtered signal H ejω X ejω   1

ω −π −π/2π/2π 3π/2 2π 5π/2

• Spectral content of decimated signal 1 D−1 Y (ejω)= H ej(ω−2πk)/D X ej(ω−2πk)/D D Xk=0    

1/D

ω −2π −ππ 2π 3π 4π 5π C. A. Bouman: Digital Image Processing - January 20, 2021 5

Decimation for Images

• Extension to decimation of images is direct

• Apply 2-D Filter f(i,j)= h(i,j) ∗ x(i,j)

• Subsample result y(i,j)= f(Di,Dj)

• Ideal choice of filter is 1 h(m,n)= sinc(m/D)sinc(n/D) D2

• Problems: – Filter has infinite extent. – Filter is not strictly positive. C. A. Bouman: Digital Image Processing - January 20, 2021 6

Alternative Filters for Image Decimation

• Direct subsampling h(m,n)= δ(m,n) – Advantages/Disadvantages: ∗ Low computation ∗ Excessive • Block averaging h(m,n) = δ(m,n)+ δ(m +1,n) +δ(m,n +1)+ δ(m +1,n + 1) – Advantages/Disadvantages: ∗ Low computation ∗ Some aliasing • 1 h(m,n)= sinc(m/D, n/D) D2 – Advantages/Disadvantages: ∗ Optimal, if signal is band limited... ∗ High computation C. A. Bouman: Digital Image Processing - January 20, 2021 7

Decimation Filters

2−D Filter Impulse Response used for Block Averaging

1

0.8

0.6

0.4

0.2

0 40

30 35 30 20 25 20 15 10 10 5 0 0 Block averaging filter

2−D used for Ideal Subsampling

0.08

0.07

0.06

0.05

0.04

0.03

0.02

0.01

0

−0.01 40

30 35 30 20 25 20 15 10 10 5 0 0 Sinc filter C. A. Bouman: Digital Image Processing - January 20, 2021 8

Original Image

• Full resolution C. A. Bouman: Digital Image Processing - January 20, 2021 9

Image Decimation by 4 using Subsampling

• Severe aliasing C. A. Bouman: Digital Image Processing - January 20, 2021 10

Image Decimation by 8 using Subsampling

• More severe aliasing C. A. Bouman: Digital Image Processing - January 20, 2021 11

Image Decimation by 4 using Block Averaging

• Sharp, but with some aliasing C. A. Bouman: Digital Image Processing - January 20, 2021 12

Image Decimation by 4 using Sinc Filter

• Theoretically optimal, but not necessarily the best visual quality C. A. Bouman: Digital Image Processing - January 20, 2021 13

1-D Up-Sampling • Up-sampling by L x(n/L) if n = KL for some K y(n)=  0 otherwise or the alternative form ∞ y(n)= x(m)δ(n − mL) mX=−∞ • Example for L =3 Discrete time signal x(n) 1

0

−1 0 5 10 15 20 x(n) up−sampled by 3 1

0

−1 0 10 20 30 40 50 60 C. A. Bouman: Digital Image Processing - January 20, 2021 14

Up-Sampling in the Frequency Domain • Up-sampling by L ∞ y(n)= x(m)δ(n − mL) mX=−∞ • In the frequency domain Y (ejω)= X(ejωL) • Example for L =3 DTFT of x(n) 15

10

5

0 −4 −2 0 2 4 DTFT of y(n) 15

10

5

0 −4 −2 0 2 4 C. A. Bouman: Digital Image Processing - January 20, 2021 15

Interpolation in the Frequency Domain

ω x(n) L H(e j ) y(n)

• Interpolating filter has the form Y (ejω)= H(ejω) X(ejωL)

• Example for L =3 DTFT of y(n) 15

10

5

0 −4 −2 0 2 4 Interpolated Signal in Frequency 40

20

0 −4 −2 0 2 4 C. A. Bouman: Digital Image Processing - January 20, 2021 16

Interpolating Filter

ω x(n) L H(e j ) y(n)

• In the frequency domain jω H(e )= Lprect2π/L(ω) • In the time domain n h(n)= sinc L Interpolating filter in Time 1

0.5

0

−0.5 0 10 20 30 40 50 60 Interpolating filter in Frequency 3

2

1

0 −4 −2 0 2 4 C. A. Bouman: Digital Image Processing - January 20, 2021 17

Interpolation in the Time Domain

ω x(n) L H(e j ) y(n)

• In the frequency domain Y (ejω)= X(ejωL)

• Example for L =3 Discrete time signal x(n) 1

0

−1 0 5 10 15 20 Interpolated Signal in Time 1

0

−1 0 10 20 30 40 50 60 C. A. Bouman: Digital Image Processing - January 20, 2021 18

2-D Interpolation

x(n) (L,L) H(e j υ ,e j µ ) y(n)

• Up-sampling ∞ ∞ y(m,n)= x(k,l)δ(m − kL, n − lL) kX=−∞ l=X−∞ • In the frequency domain jµ jν H(e ,e )= prect2π/L(µ)prect2π/L(ν) h(m,n)= sinc (m/L, n/L) • Problems: sinc function impulse response – Infinite support; infinite computation – sidelobes; artifacts at edges C. A. Bouman: Digital Image Processing - January 20, 2021 19

Pixel Replication

x(n) (L,L) H(e j υ ,e j µ ) y(n)

• Impulse response of filter 1 for 0 ≤ m ≤ L − 1 and 0 ≤ n ≤ L − 1 h(m,n)=  0 otherwise • Replicates each L2 times C. A. Bouman: Digital Image Processing - January 20, 2021 20

Bilinear Interpolation

x(n) (L,L) H(e j υ ,e j µ ) y(n)

• Impulse response of filter h(m,n)=Λ(m/L)Λ(n/L)

• Results in linear interpolation of intermediate