1-D Rate Conversion

advertisement
C. A. Bouman: Digital Image Processing - January 12, 2015
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.
C. A. Bouman: Digital Image Processing - January 12, 2015
2
1-D Periodic Subsampling
• Time domain subsampling of x(n) with period D
y(n) = x(Dn)
x(n)
y(n)
D
• Frequency domain representation
D−1
X 1
Y (ejω ) =
X ej(ω−2πk)/D
D
k=0
• Problem: Frequencies above π/D will alias.
• Example when D = 2
aliased
signal
−π −π/2
aliased
signal
π/2
π
• Solution: Remove frequencies above π/D.
ω
C. A. Bouman: Digital Image Processing - January 12, 2015
3
Decimation System
H(e j ω)
x(n)
y(n)
D
• Apply the filter H(ejω ) to remove high frequencies
– For |ω| < π
H(ejω ) = rect
∞
X
Dω
2π
– For all ω
H(ejω ) =
k=−∞
rect D
ω − k2π
2π
= prect2π/D (ω)
– Impulse response
1
sinc(n/D)
D
• Frequency domain representation
h(n) =
D−1
X 1
H ej(ω−2πk)/D X ej(ω−2πk)/D
Y (ejω ) =
D
k=0
C. A. Bouman: Digital Image Processing - January 12, 2015
4
Graphical View of Decimation for D = 2
• Spectral content of signal
X e
jω
1
−π −π/2
π/2
π
3π/2 2π
ω
5π/2
• Spectral content of filtered signal
jω
jω
H e X e
1
−π −π/2
π/2
π
3π/2 2π
ω
5π/2
• Spectral content of decimated signal
D−1
X 1
j(ω−2πk)/D
j(ω−2πk)/D
jω
X e
H e
Y (e ) =
D
k=0
1/D
−2π −π
π
2π 3π
4π 5π
ω
C. A. Bouman: Digital Image Processing - January 12, 2015
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
sinc(m/D)sinc(n/D)
2
D
• Problems:
– Filter has infinite extent.
– Filter is not strictly positive.
5
C. A. Bouman: Digital Image Processing - January 12, 2015
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
1
sinc(m/D, n/D)
2
D
– Advantages/Disadvantages:
∗ Optimal, if signal is band limited...
∗ High computation
h(m, n) =
6
C. A. Bouman: Digital Image Processing - January 12, 2015
7
Decimation Filters
2−D Filter Impulse Response used for Block Averaging
1
0.8
0.6
0.4
0.2
0
40
35
30
30
25
20
20
15
10
10
5
0
0
Block averaging filter
2−D Sinc Filter used for Ideal Subsampling
0.08
0.07
0.06
0.05
0.04
0.03
0.02
0.01
0
−0.01
40
35
30
30
25
20
20
15
10
10
0
5
0
Sinc filter
C. A. Bouman: Digital Image Processing - January 12, 2015
Original Image
• Full resolution
8
C. A. Bouman: Digital Image Processing - January 12, 2015
Image Decimation by 4 using Subsampling
• Severe aliasing
9
C. A. Bouman: Digital Image Processing - January 12, 2015
Image Decimation by 8 using Subsampling
• More severe aliasing
10
C. A. Bouman: Digital Image Processing - January 12, 2015
11
Image Decimation by 4 using Block Averaging
• Sharp, but with some aliasing
C. A. Bouman: Digital Image Processing - January 12, 2015
12
Image Decimation by 4 using Sinc Filter
• Theoretically optimal, but not necessarily the best visual
quality
C. A. Bouman: Digital Image Processing - January 12, 2015
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
∞
X
x(m)δ(n − mL)
y(n) =
m=−∞
• Example for L = 3
Discrete time signal x(n)
1
0
−1
0
5
10
15
x(n) up−sampled by 3
20
1
0
−1
0
10
20
30
40
50
60
C. A. Bouman: Digital Image Processing - January 12, 2015
14
Up-Sampling in the Frequency Domain
• Up-sampling by L
y(n) =
∞
X
x(m)δ(n − mL)
m=−∞
• In the frequency domain
Y (ejω ) = X(ejωL)
• Example for L = 3
DTFT of x(n)
15
10
5
0
−4
−2
0
DTFT of y(n)
2
4
−2
0
2
4
15
10
5
0
−4
C. A. Bouman: Digital Image Processing - January 12, 2015
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
Interpolated Signal in Frequency
4
40
20
0
−4
−2
0
2
4
C. A. Bouman: Digital Image Processing - January 12, 2015
16
Interpolating Filter
x(n)
L
H(e j ω)
y(n)
• In the frequency domain
H(ejω ) = Lprect2π/L(ω)
• In the time domain
h(n) = sinc
n
L
Interpolating filter in Time
1
0.5
0
−0.5
0
10
20
30
40
50
Interpolating filter in Frequency
60
3
2
1
0
−4
−2
0
2
4
C. A. Bouman: Digital Image Processing - January 12, 2015
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
Interpolated Signal in Time
20
1
0
−1
0
10
20
30
40
50
60
C. A. Bouman: Digital Image Processing - January 12, 2015
18
2-D Interpolation
(L,L)
x(n)
H(e j υ,e j µ)
y(n)
• Up-sampling
y(m, n) =
∞
∞
X
X
x(k, l)δ(m − kL, n − lL)
k=−∞ l=−∞
• 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
C. A. Bouman: Digital Image Processing - January 12, 2015
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 pixel L2 times
C. A. Bouman: Digital Image Processing - January 12, 2015
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 pixels
Download