Docsity

Image Processing Basics - Lecture Notes | EECS 451, Study notes of Electrical and Electronics Engineering

Toggle sidebar
bg1
EECS 451 IMAGE PROCESSING: BASICS
Image: 2-D function x(i, j) where 0 ≤i, j ≤M−1 (for an M×Mimage).
System: Continuous
space (t,s) ˜x(t, s)→|A/D|
| {z }
SAMPLER
→|h(i, j)|
| {z }
FILTER
→ |D/A|
|{z}
INTERP−
OLATOR
→˜y(t, s).
D/A: ˜y(t, s) = 4 P∞
i=−∞ P∞
j=−∞ y(i, j)B
S2sin B(t−iT )
B(t−iT )
sin B(s−jT )
B(s−jT )(2D sinc).
Sample: t=iT, s =jT , S =2π
T, S > 2Bwhere 2B=image bandwidth.
Assume: X(ω1, ω2)) = FF{x(t, s)}= 0 for |ω1|> B and |ω2|> B.
LTI: If xn(i, j)→ |LT I | → yn(i, j), then Pcnxn(i, j)→ |LT I| → Pcnyn(i, j ).
h(i,j): If x(i, j)→ |h(i, j )| → y(i, j), then y(i, j ) = PPh(i−m, j−n)x(m, n).
h(i, j)=impulse response=point-spread function.
Stable: BIBO stable ⇔P∞
i=−∞ P∞
j=−∞ |h(i, j)|<∞.
2-D Z: Z{h(i, j)}=PPh(i, j)z−i
1z−j
2=H(z1, z2)=transfer function.
y(i, j) = h(i, j )∗ ∗x(i, j)→Y(z1, z2) = H(z1, z2)X(z1, z2).
DSFT: H(ejω1, ej ω2) = PPh(m, n)e−j(ω1m+ω2n)=H(z1, z2)|z1=ej ω1,z2=ejω2.
Inverse: h(m, n) = 1
4π2Rπ
−πRπ
−πH(ejω1, ej ω2)ej(ω1m+ω2n)dω1dω2.
Note: H(ejω1, ej ω2) is periodic in ω1and ω2with periods 2π.
Odd+ xe(i, j) = 1
2(x(i, j) + x(−i, −j)) = DS F T −1{RE[X(ej ω1, ejω2)]}.
Even xo(i, j) = 1
2(x(i, j)−x(−i, −j)) = D SF T −1{jIM[X(ejω1, ej ω2)]}.
Any x(i, j) = xe(i, j ) + xo(i, j). DSFT[real and even] is real and even.
Freq. cos(ω1i+ω2j)→ |h(i, j)| → |H(ej ω1, ejω2)|cos(ω1i+ω2j+ARG[H(ejω1, ejω2)]).
Resp. |H(ejω1, ej ω2)|=Gain; ARG[H(ejω1, ej ω2)]=Phase (shift).
2-D DFT: Xk1,k2=PN1−1
n1=0 PN2−1
n2=0 x(n1, n2)e−j2π(n1k1
N1+n2k2
N2),0≤k1≤N1−1
0≤k2≤N2−1.
Inverse: x(n1, n2) = 1
N1N2PN1−1
k1=0 PN2−1
k2=0 Xk1,k2ej2π(n1k1
N1+n2k2
N2),0≤n1≤N1−1
0≤n2≤N2−1.
Cyclic: y(i, j) = h(i, j )c
c
x(i, j)⇔Yk1,k2=Hk1,k2Xk1,k2.
0-pad: 2-D cyclic convolution can be 0-padded to 2-D linear convolution.
2-D FFT: N1[N2-point 1-D FFTs] to compute ˆx(n1, k2) from x(n1, n2).
AND N2[N1-point 1-D FFTs] to compute Xk1,k2from ˆx(n1, k2).
→N1N2
2log N2+N2N1
2log N1=N1N2
2log(N1N2) mults. (like 1-D).
pf3
pf4
pf5

Partial preview of the text

Download Image Processing Basics - Lecture Notes | EECS 451 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

EECS 451 IMAGE PROCESSING: BASICS

Image: 2-D function x(i, j) where 0 ≤ i, j ≤ M − 1 (for an M × M image). System: Continuousspace (t,s) x˜(t, s) → |A/D| ︸ ︷︷ ︸ SAMPLER

→ |h(i, j)| ︸ ︷︷ ︸ FILTER

→ |D/A|

INTERP OLATOR−

→ y˜(t, s).

D/A: y˜(t, s) = 4

i=−∞

j=−∞ y(i, j)^

( B

S

)2 sin B(t−iT ) B(t−iT )

sin B(s−jT ) B(s−jT ) (2D sinc). Sample: t = iT, s = jT, S = (^2) Tπ , S > 2 B where 2B=image bandwidth. Assume: X(ω 1 , ω 2 )) = FF{x(t, s)} = 0 for |ω 1 | > B and |ω 2 | > B. LTI: If xn(i, j) → |LT I| → yn(i, j), then

cnxn(i, j) → |LT I| →

cnyn(i, j).

h(i,j): If x(i, j) → |h(i, j)| → y(i, j), then y(i, j) =

h(i−m, j−n)x(m, n). h(i, j)=impulse response=point-spread function. Stable: BIBO stable ⇔

i=−∞

j=−∞ |h(i, j)|^ <^ ∞. 2-D Z: Z{h(i, j)} =

h(i, j)z 1 − iz 2 − j= H(z 1 , z 2 )=transfer function. y(i, j) = h(i, j) ∗ ∗x(i, j) → Y (z 1 , z 2 ) = H(z 1 , z 2 )X(z 1 , z 2 ). DSFT: H(ejω^1 , ejω^2 ) =

h(m, n)e−j(ω^1 m+ω^2 n)^ = H(z 1 , z 2 )|z 1 =ejω (^1) ,z 2 =ejω 2. Inverse: h(m, n) = (^4) π^12

∫ (^) π −π

∫ (^) π −π H(e

jω (^1) , ejω (^2) )ej(ω 1 m+ω 2 n)dω 1 dω 2.

Note: H(ejω^1 , ejω^2 ) is periodic in ω 1 and ω 2 with periods 2π. Odd+ xe(i, j) = 12 (x(i, j) + x(−i, −j)) = DSF T −^1 {RE[X(ejω^1 , ejω^2 )]}. Even xo(i, j) = 12 (x(i, j) − x(−i, −j)) = DSF T −^1 {jIM [X(ejω^1 , ejω^2 )]}. Any x(i, j) = xe(i, j) + xo(i, j). DSFT[real and even] is real and even. Freq. cos(ω 1 i+ω 2 j) → |h(i, j)| → |H(ejω^1 , ejω^2 )| cos(ω 1 i+ω 2 j+ARG[H(ejω^1 , ejω^2 )]). Resp. |H(ejω^1 , ejω^2 )|=Gain; ARG[H(ejω^1 , ejω^2 )]=Phase (shift).

2-D DFT: Xk 1 ,k 2 =

∑N 1 − 1

n 1 =

∑N 2 − 1

n 2 =0 x(n^1 , n^2 )e

−j 2 π( n N^1 k 11 + n N^2 k 22 ), 0 ≤k 1 ≤N 1 − 1 0 ≤k 2 ≤N 2 − 1.

Inverse: x(n 1 , n 2 ) = (^) N 11 N 2

∑N 1 − 1

k 1 =

∑N 2 − 1

k 2 =0 Xk^1 ,k^2 e

j 2 π( n N^1 k 11 + n N^2 k 22 ), 0 ≤n 1 ≤N 1 − 1 0 ≤n 2 ≤N 2 − 1. Cyclic: y(i, j) = h(i, j) c© ©cx(i, j) ⇔ Yk 1 ,k 2 = Hk 1 ,k 2 Xk 1 ,k 2. 0-pad: 2-D cyclic convolution can be 0-padded to 2-D linear convolution. 2-D FFT: N 1 [N 2 -point 1-D FFTs] to compute ˆx(n 1 , k 2 ) from x(n 1 , n 2 ). AND N 2 [N 1 -point 1-D FFTs] to compute Xk 1 ,k 2 from ˆx(n 1 , k 2 ). → N 1 N 22 log N 2 + N 2 N 21 log N 1 = N^12 N 2 log(N 1 N 2 ) mults. (like 1-D).

EECS 451 IMAGE PROCESSING: FILTERING

Example: h(i, j) =

 (^) → H(ejω^1 , ejω^2 ) =

sin(1. 5 ω 1 ) sin(0. 5 ω 1 )

sin(1. 5 ω 2 ) sin(0. 5 ω 2 )

(1 + 2 cos(ω 1 ))(1 + 2 cos(ω 2 ))

Note: Separable: h(i, j) = h 1 (i)h 2 (j) → H(ejω^1 , ejω^2 ) = H 1 (ejω^1 )H 2 (ejω^2 ). Point: Separable system/image→2-D problem decouples to 1-D problems. So? 2-D lowpass: h(i, j) = hL(i)hL(j) where hL(i) is 1-D lowpass filter.

Radial: H(ejω^1 , ejω^2 ) =

1 for

ω 12 + ω^22 < B 0 for

ω 12 + ω^22 > B 0 ≤ |ω 1 |, |ω 2 | ≤ π Note: H(ejω^1 , ejω^2 ) is circularly symmetric ”pill-box function.” Recall: H(ejω^1 , ejω^2 ) is periodic in ω 1 and ω 2 with periods 2π.

Then: h(i, j) = 2 BπJ^1 ( RBR ) where R =

i^2 + j^2. (Derivation: Lim p.57). Where: J 1 (·)=Bessel function of 1st^ kind of order 1. J^1 x(x ) ∼ sinc function.

Note: H(ejω^1 , ejω^2 ) = H(

ω 12 + ω^22 ) for

ω 12 + ω^22 < π → h(i, j) = h(

i^2 + j^2 ) If: H(ejω^1 , ejω^2 )=constant in rest of the region 0 ≤ |ω 1 |, |ω 2 | ≤ π. But: h(i, j) = h(

i^2 + j^2 ) does NOT → H(ejω^1 , ejω^2 ) = H(

ω^21 + ω 22 ). MEDIAN FILTERING For: Impulsive=“salt-and-pepper”=shot noise (arises from bit errors). while: Preserving image edges. NOTE: Example of nonlinear filtering. 1-D: y(n) = MEDIAN[x(n + 2), x(n + 1), x(n), x(n − 1), x(n − 2)]. Why? Preserves edges: Note this has no effect on step function u(n). 2-D: Apply 1-D median filter to each row, then to each column. EDGE DETECTION For: Enhancing edges. Why? Image segmentation, image understanding.

  1. ∇^2 x(i, j) = x(i + 1, j) + x(i − 1 , j) + x(i, j + 1) + x(i, j − 1) − 4 x(i, j).
  2. Find zero-crossings of Laplacian ∇^2 x(i, j) ⇔ gradient extrema.
  3. If σ x^2 (i, j) =

∑i+ i− 2

∑j+ j− 2 [x(m, n)^ −^ x¯(m, n)]

(^2) > η, declare ∃“edge.”

OR: Use gradients for directional edge detection:

  1. ∇x(i, j) = [x(i + 1, j) − x(i − 1 , j)] + [x(i + 1, j + 1) − x(i − 1 , j + 1)] +[x(i + 1, j − 1) − x(i − 1 , j − 1)] ≈ ∂x ∂i (central differences).
  2. If |∇x(i, j)| > η, declare ∃“edge” in vertical direction.
  3. Use only local maxima of |∇x(i, j)|: “edge thinning.”

load lena.mat;X=xx;N=2*randn(300,300);2D IMPULSE

50 100 150 200 250

50 100 150 200 250

H=.8.^abs(-22:22);H=H*H; POINT-SPREAD

10 20 30 40

10 20 30 40

Y=conv2(X,H);Y1=Y+N;BLURRED IMAGE

50 100 150 200 250 300

100

200

300

real(ifft2(fft2(Y)./fft2(H,300,300)));RECONSTRUCTION

50 100 150 200 250

50 100 150 200 250

real(ifft2(fft2(Y1)./fft2(H,300,300)));RECONSTRUCTION

50 100 150 200 250 300

100

200

300

FX(76:225,76:225)=0;real(ifft2(FX));RECONSTRUCTION

50 100 150 200 250 300

100

200

300