2D Signal Processing

advertisement
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Introduction to ……..
2D Signal Processing
lecture 2
Andrzej Leśniak
Professor at
Faculty of Geology Geophysics and
Environmental Protection
AGH University of Science and Technology
2D Signal Processing
Lectures2016, TU Freiberg
Signal processing in frequency domain
Pair of continuous Fourier transforms - 1D case
∞
F (u ) =
∫ f (x )e
−i 2πxu
dx
F (u ) = ℑ[ f (x )]
−∞
∞
f (x ) =
∫ F (u )e
i 2πux
du
−∞
Pair of continuous Fourier transforms - 2D case
∞ ∞
F (u , v) =
∫ ∫ f ( x, y )e
− i 2π ( ux + vy )
dxdy
− ∞− ∞
∞ ∞
f ( x, y ) =
∫ ∫ F (u, v)e
i 2π ( ux + vy )
dxdy
− ∞− ∞
F (u , v ) = F (u , v ) e jφ (u ,v )
F (u ) = F (u ) e jφ (u )
[
]
F (u ) = R 2 (u ) + I 2 (u )
φ (u ) = arctg
P(u ) = F (u )
12
[
]
F (u , v ) = R 2 (u , v ) + I 2 (u , v )
I (u, v )
R(u , v )
I (u )
R(u )
φ (u , v ) = arctg
2
P(u , v ) = F (u, v )
2
12
Andrzej Leśniak
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Summary of some important properties of the 2D Fourier transform. Proofs of most of them is
elemantary.
nr
Property
1
Fourier transform is linear
2
Scaling property
Expression
F [α f ( x, y) + β f ( x, y)] = α F (u, v) + β F (u, v)
F [ f (α x, β y )] =
3
Translation property
4
Modulation theorem
5
Differentiation property
6
Spectrum differentiation property
7
Integration property
8
Parceval theorem
F [ f ( x − α , y − β )] = e −2πi (uα + vβ ) F (u, v)
F [ f ( x ) cos α x ] =
1
[ F (ω − α ) + F (ω + α )]
2
 ∂ n f ( x, y ) 
n
F
 = (iu) F (u, v)
n
 ∂x

[
]
F (−ix) n f ( x, y ) =
Rayleigh theorem
10
Convolution theorem
∞ ∞
∫∫
∞ ∞
2
f ( x, y ) dxdy =
∞ ∞
∞ ∞
− ∞− ∞
−∞− ∞
f (x ) = f (x0 + x∆x )
F (u ) = F (u∆u )
1
∆u =
N ∆x
N −1
x =0
N −1
f ( x ) = ∑ F (u )e
u =0
u = 0,K N − 1
x = 0,K N − 1
i
−i
2π
ux
N
2π
ux
N
dudv
F [ f ( x, y ) ∗ g ( x, y )] = F (u, v) ⋅ G (u , v)
Example: transformation of the rectangle function
1
F (u ) =
N
∑ f (x )e
2
∫ ∫ f ( x, y) g ( x, y)dxdy = ∫ ∫ F (u)G(v)dudv
1D discrete Fourier transform
1
N
∫ ∫ F (u)
− ∞−∞
2D Signal Processing
F (u ) =
∂ n F (u, v)
∂u n

y x
1
F  ∫ ∫ f ( p, t )dpdt  =
F (u , v)
 − uv
 0 0
−∞− ∞
9
u v
F  , 
α β 
1
αβ
−1 = i
Lectures2016, TU Freiberg
eiθ = cos θ + i sin θ
N −1

2π
∑ f (x )cos N
x =0
ux + i sin
2π 
ux
N 
Andrzej Leśniak
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
2D discrete Fourier transform
F (u, v ) =
1
NM
M −1 N −1
∑∑ f (x, y )e
−i 2π (ux M + vy N )
x =0 y =0
M −1 N −1
f ( x, y ) = ∑∑ F (u, v )e i 2π (ux M + vy
N)
u = 0, K M − 1 v = 0, K N − 1
x = 0,K M − 1 y = 0,K N − 1
u =0 v =0
If function f(x,y) is real (the common case for digital
images) - the following formulas are true:
F (u, v ) = F ∗ (− u,−v )
F (u, v ) = F (− u,−v )
Amplitude spectrum is symmetrical and phase specrtum asymmetrical.
Comments : dwo different ways to present amplitude and phase spectrum:
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
2D rectangle function
Direct result of the magnitude spectrum calculation
Similarily to 1D case the
relation between sampling
rates in time and in frequency
domain can be written as:
∆u =
1
M∆ x
∆v =
1
N ∆y
To increase the resolution
in the frequency domain
we can add zeros to the
ends of the rows and
columns of image.
On the left the result of
expansion of the table
from size 30 x 30 to size
256 X 256
- point F(0,0) is located in up-left corner not in the
middle of the image
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Lectures2016, TU Freiberg
Andrzej Leśniak
It is common practice to multiply the
input image by the function (-1)x+y. It is
not difficult to show (using the property
of translation in frequency domain) that
the following exppression can be proved:
[
ℑ (− 1)
x+ y
]
f (x, y ) = F (u − M 2 , v − N 2)
Center of the fourier transform e.a.
point F(0,0) is now in the point with
coordinates u=M/2+1 i v=N/2+1
Average value of the image can be
evaluated as a center value of the
spectrum
F (0,0 ) =
1
NM
M −1 N −1
∑∑ f (x, y )e
x =0 y =0
− i 2π ( 0 x M + 0 y N )
=
1
NM
M −1 N −1
∑∑ f (x, y )
x=0 y =0
2D Signal Processing
Is the figure shape related to the image in magnitude spectrum
log F (ω1 , ω2 )
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
There is no simple relations – only for figures with high symmetry we can find somw
simmilarities
2D Signal Processing
In more complicated images there is difficult
to find some regularities. On some images the
edges can be seen.
Scanning electron microscopy (SEM) of
damadged integrated circuit.
In Fourier amplitude spectrum the picture of
the images with orientation of 450 are seen.
Lectures2016, TU Freiberg
Andrzej Leśniak
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Filtering in frequency domain
Basic steps :
1.
Multiply image f(x,y) by coefficients (-1)x+y to center the spectrum
2.
Compute discret two-dimensional Fourier transform F(u,v),
3.
Multiply spectrum F(u,v) by filter function (transfer function) H(u,v)
4.
Compute inverse discret two-dimensional Fourier transform F-1(u,v),
5.
Extract real part of the result
6.
Multiply the result by coefficients (-1)x+y to obtain the final result
2D Signal Processing
Lectures2016, TU Freiberg
Selected filters and their properties
Notch filter
for
0
H (u, v ) = 
1 others
(u, v ) = (M
2 , N 2)
Average value of the result of filtering is equal to 0. The
image on the left is normalized in the rage of [0,255].
Andrzej Leśniak
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Lectures2016, TU Freiberg
Andrzej Leśniak
Lowpass filter function and the
result of lowpass filtering .
The clear image averaging efect
is visible.
Highpass filter function and the
result of highpass filtering .
Usually H(0,0)=0 so the
average value of the result is
equal zero.
The image is darker than
original image and sharp.
The image should be
normalized or some values
should be added to it to
increase the energy of the
image.
2D Signal Processing
Relations between filtering in frequency and space (or time) domains
f ( x , y ) ∗ h ( x, y ) =
1
MN
mask
M −1 N −1
∑∑ f (m, n)h(x − m, y − n)
f (x, y ) ∗ h( x, y ) ⇔ F (u, v )H (u , v )
f (x, y )h( x, y ) ⇔ F (u , v ) ∗ H (u , v )
Two versions of the convolution
theorem
Definition of the impulse function
1 x = x0 ∧ y = y0
0 x ≠ x0 ∨ y ≠ y0
δ ( x0 − x, y0 − y ) = 
s( x0 , y0 ) =
def
s(0,0) =
def
F (u, v ) =
1
NM
M −1 N −1
∑∑ δ (x, y )e
− i 2π (ux M + vy N )
x =0 y =0
δ ( x , y ) ∗ h ( x, y ) =
1
MN
M −1 N −1
=
M −1 N −1
∑∑ s(x, y )δ (x
0
− x , y0 − y )
x =0 y =0
M −1 N −1
∑∑ s(x, y )δ (x, y )
x =0 y = 0
1
NM
1
∑∑ δ (m, n)h(x − m, y − n ) = MN h(x, y )
m =0 n =0
δ (x, y ) ∗ h( x, y ) ⇔ ℑ[δ (x, y )]H (u, v )
h(x, y ) ⇔ H (u , v )
Definition of the 2D convolution
m =0 n =0
Using the properties of the impulse function and and
convolution theorem we can established that the
filters in spatial and frequency domains constitute
the a Fourier transform pair
2D Signal Processing
Lectures2016, TU Freiberg
Model of the filtering in frequency domain
Andrzej Leśniak
G (u, v ) = F (u, v )H (u, v )
Ideal lowpass filter (perspective plot, image and radial cross section) – the filter cannot be
realized with electronic components – it can be only implemented in computer.
1 dla
H (u, v ) = 
0 dla
D – distance from point (u,v) to the centre of
the frequency rectangle
D(u, v ) ≤ D0
D(u, v ) > D0
D0 – cut-off frequency
Because the centre of the frequency rectangle was moved from point (0,0) to the point
(M/2, N/2) the distance from point (u,v) to the centre is equal to:
D(u , v ) =
(u − M 2)2 + (v − N 2)2
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
The image of size 500 x 500 piksels and its Fourier spectrum. Circles have radius equal to : 5,15,30, 80,
230 piksels and enclose 92.0, 94.6, 96.4, 98.0 and 99.5 % of the energy of the image.
M −1 N −1
PT (u, v ) = F (u, v )
2
PT = ∑∑ P(u , v ) PT – image amplitude spectrum
u =0 v =0
 M −1 N −1

 u =0 v =0

α =  ∑∑ P(u, v ) PT  ⋅100%
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Results of the ideal lowpass filtering with cut off frequencies set at radius values of 5, 15, 30, 80 i 230
pixels. For larger cut – off frequencies the averaging effect is smaller.
In figures 3,4,5 the ringing effect is clearly visible.
2D Signal Processing
Lectures2016, TU Freiberg
Real, lowpass Butterworth filter.
H (u, v ) =
1
2n
1 + (D(u, v ) D0 )
D(u , v ) =
(u − M 2)2 + (v − N 2)2
Andrzej Leśniak
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Lectures2016, TU Freiberg
Andrzej Leśniak
Original image and results of the
filtering with Butterworth low pass
filter of order 2 with cut off
frequencies at radius of 5, 15, 30,
80 i 230 pixels.
There is no ringing effect.
2D Signal Processing
Spatial representations of Butterworth low pass filter of order 1, 2, 5 and 20
with cut off frequencies at radius 5 pixels and corresponding grey levels
profiles through the center of the filters.
Ringing increases as a function of filter order.
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Real, lowpass Gauss filter.
H (u, v ) = e − D
2
(u , v )
2 D02
D0 ↔ σ
D(u , v ) =
(u − M 2)2 + (v − N 2)2
For D(u,v)=D0 transfer function reach the values 0.607
2D Signal Processing
Original image and results of the
filtering with Gaussian low pass filter
with cut off frequencies at radius of 5,
15, 30, 80 i 230 pixels.
There is no ringing effect.
Lectures2016, TU Freiberg
Andrzej Leśniak
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Example of application of lowpass filtering to the machine perception. Image on
the left is example of the text of poor resolution (fax transmission, photocopy,
historical material) We can see the distorted shapes and broken characters.
Application of the low pass filters fills the gaps . Although the characters after
filtering are blurred they can be easier recognized automatically.
Gaussian filter D0 = 80, image size 444 x 508
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Example of lowpass filtering in printing and publishing
industry („cosmetic” processing)
1)
The aim of the processing is to
obtain smoother and softerlooking results ex. Smooth sharp
of fine skin lines and small
blemishes.
Image of size 1028 x 732 pixels
2)
Gaussian filtering D0 = 100
3)
Gaussian filtering D0 = 80
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Highpass, sharpening filters
H HP (u , v ) = 1 − H LP (u , v )
Examples of the transfer
functions of highpass
sharpening filters:
1) Ideal filter
2) Butterworth filter
3) Gauss filter
perspective plot,
2D Signal Processing
image
radial cross section
Lectures2016, TU Freiberg
Spatial representations of the basic highpass filters and corresponding greylevels profiles:
1) Ideal filter
2) Butterworth filter
3) Gaussian filter
Andrzej Leśniak
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Results of ideal highpass filtering of testing image with cut-off frequency D0 equal to 15, 30 and
80 pixels.
0 dla
H (u, v ) = 
1 dla
D(u, v ) ≤ D0
D(u, v ) > D0
D0 – cut-off frequency
Ringing effect is clearly visible in the first and the second image.
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Results of Butterworth highpass filtering of testing image with cut-off frequency D0 equal to 15,
30 and 80 pixels and order n=2.
H (u, v ) =
1
2n
1 + (D0 D(u, v ))
D(u , v ) =
(u − M 2)2 + (v − N 2)2
Compare this formula to Butterworth lowpass filter
In that case there is no ringing effect in the images.
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Results of Gaussian highpass filtering of testing image with cut-off frequency D0 equal to 15, 30
and 80 pixels.
H (u , v ) = 1 − e − D
2
(u , v )
2 D02
D(u , v ) =
(u − M 2)2 + (v − N 2)2
In that case there is also no ringing effect in the images.
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
Bandpass and Bandstop filters
D(u , v ) < D0 − W 2
1

H (u, v ) = 0 D0 − W 2 ≤ D(u, v ) ≤ D0 + W 2
1
D(u, v ) > D0 + W 2

H (u, v ) =
1
 D(u, v )W 
1+  2
2
 D (u , v ) − D0 
Butterworth filter
2n
Ideal filter
W – width of the band
 1  D 2 (u , v ) − D 2  2 
0
 
H (u , v ) = 1 − exp − 
(
)
2
,
D
u
v
W


 
Gaussian filter
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
a) Image corrupted by the
sinusoidal noiseb) power
spectrum of the image;
isolated points rounded the
centar are spectrum of
sinusoidal noise c) transfer
function of the Butterworth
filter d) Image after filtration
Noise rejected from the image
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
2D notch filters
D0 – radius, u0,v0 – center of the filter ; Notice the necessary summetry condition
0 D1 (u , v ) ≤ D0 or D2 (u, v ) ≤ D0
H (u , v ) = 
other
1
[
]
D (u, v ) = [(u − M / 2 + u ) + (v − N / 2 + v ) ]
2 12
D1 (u , v ) = (u − M / 2 − u0 ) + (v − N / 2 − v0 )
2
2 12
2
2
H (u , v ) =
0
1


D02
1+ 

 D1 (u, v )D2 (u , v ) 
n
 D (u , v )D2 (u , v )
H (u, v ) = 1 − exp − 1

2 D02


0
2D Signal Processing
Lectures2016, TU Freiberg
Andrzej Leśniak
a)
Satelite image with horizontal
scannere lines
b)
Amplitude spectrum of image a)
c)
Notch filter that pass only noise
component, connected with
horizontal lines
d)
Inverse Fourier transform showing
noise component in spatial domain
e)
Result of the notch filter rejection
filtering – difference between image
a) and d)
Download