1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion •...

20
C. A. Bouman: Digital Image Processing - January 8, 2018 1 1-D Rate Conversion Decimation Reduce the sampling rate of a discrete-time signal. Low sampling rate reduces storage and computation requirements. Interpolation Increase the sampling rate of a discrete-time signal. Higher sampling rate preserves fidelity.

Transcript of 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion •...

Page 1: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 1

1-D Rate Conversion

• Decimation

– Reduce the sampling rate of a discrete-time signal.

– Low sampling rate reduces storage and computation

requirements.

• Interpolation

– Increase the sampling rate of a discrete-time signal.

– Higher sampling rate preserves fidelity.

Page 2: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 2

1-D Periodic Subsampling

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

y(n) = x(Dn)

Dx(n) y(n)

• Frequency domain representation

Y (ejω) =1

D

D−1∑

k=0

X(

ej(ω−2πk)/D)

• Problem: Frequencies above π/D will alias.

• Example when D = 2

aliasedsignal

aliasedsignal

ωπ−π −π/2 π/2

• Solution: Remove frequencies above π/D.

Page 3: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 3

Decimation System

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

• Apply the filter H(ejω) to remove high frequencies

– For |ω| < π

H(ejω) = rect

(

)

– For all ω

H(ejω) =

∞∑

k=−∞

rect

(

Dω − k2π

)

= prect2π/D(ω)

– Impulse response

h(n) =1

Dsinc(n/D)

• Frequency domain representation

Y (ejω) =1

D

D−1∑

k=0

H(

ej(ω−2πk)/D)

X(

ej(ω−2πk)/D)

Page 4: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 4

Graphical View of Decimation for D = 2

• Spectral content of signal

X(

ejω)

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

1

• Spectral content of filtered signal

H(

ejω)

X(

ejω)

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

1

• Spectral content of decimated signal

Y (ejω) =1

D

D−1∑

k=0

H(

ej(ω−2πk)/D)

X(

ej(ω−2πk)/D)

π 2π 4πω

1/D

−2π −π 3π 5π

Page 5: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 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

h(m,n) =1

D2sinc(m/D)sinc(n/D)

• Problems:

– Filter has infinite extent.

– Filter is not strictly positive.

Page 6: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 6

Alternative Filters for Image Decimation

• Direct subsampling

h(m,n) = δ(m,n)

– Advantages/Disadvantages:

∗ Low computation

∗ Excessive aliasing

• Block averaging

h(m,n) = δ(m,n) + δ(m + 1, n)

+δ(m,n + 1) + δ(m + 1, n + 1)

– Advantages/Disadvantages:

∗ Low computation

∗ Some aliasing

• Sinc function

h(m,n) =1

D2sinc(m/D, n/D)

– Advantages/Disadvantages:

∗ Optimal, if signal is band limited...

∗ High computation

Page 7: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 7

Decimation Filters

05

1015

2025

3035

0

10

20

30

400

0.2

0.4

0.6

0.8

1

2−D Filter Impulse Response used for Block Averaging

Block averaging filter

05

1015

2025

3035

0

10

20

30

40−0.01

0

0.01

0.02

0.03

0.04

0.05

0.06

0.07

0.08

2−D Sinc Filter used for Ideal Subsampling

Sinc filter

Page 8: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 8

Original Image

• Full resolution

Page 9: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 9

Image Decimation by 4 using Subsampling

• Severe aliasing

Page 10: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 10

Image Decimation by 8 using Subsampling

• More severe aliasing

Page 11: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 11

Image Decimation by 4 using Block Averaging

• Sharp, but with some aliasing

Page 12: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 12

Image Decimation by 4 using Sinc Filter

• Theoretically optimal, but not necessarily the best visual

quality

Page 13: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 13

1-D Up-Sampling

• Up-sampling by L

y(n) =

{

x(n/L) if n = KL for some K0 otherwise

or the alternative form

y(n) =

∞∑

m=−∞

x(m)δ(n−mL)

• Example for L = 3

0 5 10 15 20−1

0

1Discrete time signal x(n)

0 10 20 30 40 50 60−1

0

1x(n) up−sampled by 3

Page 14: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 14

Up-Sampling in the Frequency Domain

• Up-sampling by L

y(n) =

∞∑

m=−∞

x(m)δ(n−mL)

• In the frequency domain

Y (ejω) = X(ejωL)

• Example for L = 3

−4 −2 0 2 40

5

10

15DTFT of x(n)

−4 −2 0 2 40

5

10

15DTFT of y(n)

Page 15: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 15

Interpolation in the Frequency Domain

ωjH(e ) y(n)x(n) L

• Interpolating filter has the form

Y (ejω) = H(ejω)X(ejωL)

• Example for L = 3

−4 −2 0 2 40

5

10

15DTFT of y(n)

−4 −2 0 2 40

20

40Interpolated Signal in Frequency

Page 16: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 16

Interpolating Filter

ωjH(e ) y(n)x(n) L

• In the frequency domain

H(ejω) = Lprect2π/L(ω)

• In the time domain

h(n) = sinc(n

L

)

0 10 20 30 40 50 60−0.5

0

0.5

1Interpolating filter in Time

−4 −2 0 2 40

1

2

3Interpolating filter in Frequency

Page 17: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 17

Interpolation in the Time Domain

ωjH(e ) y(n)x(n) L

• In the frequency domain

Y (ejω) = X(ejωL)

• Example for L = 3

0 5 10 15 20−1

0

1Discrete time signal x(n)

0 10 20 30 40 50 60−1

0

1Interpolated Signal in Time

Page 18: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 18

2-D Interpolation

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

• Up-sampling

y(m,n) =

∞∑

k=−∞

∞∑

l=−∞

x(k, l)δ(m− kL, n− lL)

• In the frequency domain

H(ejµ, ejν) = prect2π/L(µ)prect2π/L(ν)

h(m,n) = sinc (m/L, n/L)

• Problems: sinc function impulse response

– Infinite support; infinite computation

– Negative sidelobes; ringing artifacts at edges

Page 19: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 19

Pixel Replication

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

• Impulse response of filter

h(m,n) =

{

1 for 0 ≤ m ≤ L− 1 and 0 ≤ n ≤ L− 10 otherwise

• Replicates each pixel L2 times

Page 20: 1-D Rate Conversion - Purdue Engineeringbouman/ece637/notes/pdf/Rate... · 1-D Rate Conversion • Decimation – Reduce the sampling rate of a discrete-time signal. – Low sampling

C. A. Bouman: Digital Image Processing - January 8, 2018 20

Bilinear Interpolation

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

• Impulse response of filter

h(m,n) = Λ(m/L)Λ(n/L)

• Results in linear interpolation of intermediate pixels