Reja 03.2 Image Processing - Frequency Analysis1
Reja 03.2 Image Processing - Frequency Analysis1
2 Frequency Analysis
#104
6
4
f
1
0 20 40 60
x
1
Δ
0 Δ 0 Paul Dirac
Discrete pulse lim δ Δ (x) Dirac delta function 1902 - 1984
Δ→0
⎧ 1 ⎧ ∞ if x = 0
⎪ if 0 ≤ x ≤ Δ δ (x) = ⎨
δ Δ (x) = ⎨ Δ ⎩ 0 otherwise
⎪ 0 otherwise
⎩
= + + + +
... ...
= f (x)∗ δ (x)
As we let approach zero, the approximation becomes better and better, and the in the limit
equals . Therefore,
Also, as , the summation approaches an integral, and the pulse approaches the unit impulse:
Representing a Filter with Impulses
❖ Of course we can also code a filter h(x) using impulses.
❖ This is why we refer to h(x) as the impulse response function of the filter
= + + + +
... ...
Representing signals with impulses. Any signal can be expressed as a sum of scaled and
shifted unit impulses. We begin with the pulse or “staircase” approximation to a continuous
signal , as illustrated in Fig. 1. Conceptually, this is trivial: for each discrete sample of the
original signal, we make a pulse signal. Then we add up all these pulse signals to make up the
approximate signal. Each of these pulse signals can in turn be represented as a standard pulse
scaled by the appropriate value and shifted to the appropriate place. In mathematical notation:
๏ Fourier transforms
๏ Wavelet transforms
❖ These linear codes are simply linear transformations of the impulse code.
❖ We begin with the Fourier code, which arises naturally from linear systems theory.
Additivity
h (α f1 + β f2 ) = α h ( f1 ) + β h ( f2 )
Homogeneity
❖ These filter weights are simply the reversed impulse response function.
0 0 0 1 1 1 1 1 1 input (step)
❖ It turns out that any signal can alternatively be expressed exactly as an infinite
sum of sinusoids.
ransform
rm is simply
❖
is simply a In thea tabulation
limit
tabulation of the magnitude
as X→∞,
of the theand
magnitude andresponse
Fourier
phase phasebecomes
series response
at each at
theeach
Fourier transform.
Computer Vision: Algorithms and Applications (September 3, 2010 draft)
H(!) =H(!)
F = F {h(x)}
{h(x)} = Ae j = Aej ,
, (3.51) (3.51)
The aFourier
ransform is❖simply transform
tabulation of a signal
of the magnitude f(x) or
and phase filter h(x)
response is the response to a complex
at each
oonse
a complex sinusoid
to a complex
sinusoid of at
sinusoid each
frequencyfrequency
of frequency
! passed passed through
! through the filterthe filter h(x).
h(x).
form
pair pair is
is also also
often often
= written
written
H(!) Fas{h(x)}as = Aej , (3.51)
onse to a complex F
sinusoid F
of frequency ! passed through the(3.52)filter h(x).
h(x)
h(x) $ H(!). $ H(!). (3.52)
form pair is also often written as
y,) does
(3.51) does
not H
givenot ω
an(give
) isancalled
actual actualthe
formula fortransfer
formula function
for computing
computing ofthe
the Fourierthe filter h(x).
Fourier
transform. transform.
F
ae,recipe,
i.e., convolve the filter
i.e., convolve thewith
h(x) $ a sinusoid,
filter observe observe
with a sinusoid,
H(!). the magnitude and(3.52)and
the magnitude
Joseph Fourier
unately,
at. closed
Fortunately, form
closedequations
❖ Continuous for the Fourier
form domain:
equations transform
for the Fourier exist both
transform in both in
exist 1768 - 1830
y, (3.51) does not give an actual formula for computing the Fourier transform.
omain, Z 1 Z 1
recipe, i.e., convolve the filterj!x
with a sinusoid, observe the magnitude and
H(!) = = dx, j!x dx, (3.53)
t. Fortunately, closed1form equations for the Fourier transform exist both(3.53)
H(!) h(x)e h(x)e
in
1
omain, Z 1
ain,
e domain,
H(!) = h(x)e j!x dx, (3.53)
N 1
1 X11 N
X1 j 2⇡kx
H(k) =H(k) = h(x)e h(x)e N , j 2⇡kx
N , (3.54) (3.54)
e domain, N x=0 N
x=0
N
X1
fngth
the signal 1analysis. These
of the or region
signal
H(k) =or of
region of analysis.
h(x)e
formulas
j 2⇡kx
These
N
apply both to filters, filters,
, formulas apply both to (3.54)
dnals or images,
to signals such asN
or images, s(x)
such
x=0or s(x)
as g(x).or g(x). space
f the Fourier
form of the transform
Fourier (3.54) is(3.54)
transform known is as the Discrete
known as the Fourier Trans-
Discrete Fourier Trans-
ngth of the signal or region of analysis. These formulas apply both to filters,
whileEECS
etothat (3.54) can
4422/5323
while beComputer
(3.54) evaluated
can be for any for
Vision
evaluated valueany ofvalue
k, it only
of k,makes
it !1sense
only 6makes sense J. Elder
signals or images, such as s(x) or g(x).
Fourier Transforms
cos 8π x 0 0
1
-1
0 1 0
0 4 8
x(t) 1 |X(f)|
1
cos16π x 0
-1 0
0 1 0 4 8
Time (sec) Frequency (Hz)
F [ cos 6π x ] F [ sin 6π x ]
cosine sine
real part
-8 0 8 -8 0 8
imaginary part
-8 0 8 -8 0 8
amplitude
-8 0 8 -8 0 8
Frequency (Hz) Frequency (Hz)
phase 0 π/2
Figure 10: Fourier transforms of sine and cosine signals. The amplitudes are the same, but the
phases are different.
Do not be put off by the negative frequencies in the plots. The equations for theJ.Fourie
EECS 4422/5323 Computer Vision Elder
!18
End of Lecture
Oct 3, 2018
ve defined the Fourier transform, what are some of its properties and how
able 3.1 lists a number of useful properties, which we describe in a little
❖ Discrete domain:
N /2 2 π kx
1
∑
j
h(x) = H (k)e N
N k==N /2
Joseph Fourier
1768 - 1830
space
Fourier Pairs
Name Signal Transform
1.0 1.0
impulse (x)
0.5 0.5
-1.0000 -0.5000
0.0
0.0000 0.5000 1.0000
, 1 -0.5000
0.0
0.0000 0.5000
-0.5 -0.5
1.0 1.0
shifted
(x
0.5 0.5
u) , e j!u
impulse -1.0000 -0.5000
0.0
0.0000 0.5000 1.0000 -0.5000
0.0
0.0000 0.5000
(phase plot)
-0.5 -0.5
1.0 1.0
box(x/a)
0.5 0.5
-0.5 -0.5
1.0 1.0
-0.5 -0.5
1.0 1.0
p
G(x; ) 2⇡
G(!; 1
)
0.5 0.5
-0.5 -0.5
1.0 1.0
p
Laplacian 0.5
2
( x4 1
)G(x; ) 2⇡
! 2 G(!; 1
)
0.5
-0.5 -0.5
1.0 1.0
p
cos(!0 x)G(x; ) 2⇡
G(! ± !0 ; 1
)
0.5 0.5
-0.5 -0.5
(1 + )
1.5 1.5
unsharp 1.0
(1 + ) (x) p
1.0
mask
0.5
0.0 G(x; ) , 2⇡
G(!; 1
)
0.5
0.0
-1.0000 -0.5000 0.0000 0.5000 1.0000 -0.5000 0.0000 0.5000
-0.5 -0.5
1.0 1.0
windowed rcos(x/(aW ))
(see Figure 3.29)
0.5 0.5
-0.5 -0.5
Table 3.2 Some useful (continuous) Fourier transform pairs: The dashed line in the Fourier
EECS 4422/5323 Computertransform
Vision of the shifted impulse indicates its
!25(linear) phase. All other transforms have zero J. Elder
3.4 Fourier transforms 139
0.8
0.6
1
1 1 1 3 (1 + 2 cos !)
0.4
1
box-3 3 0.2
0.0
0 0.1 0.2 0.3 0.4 0.5
-0.2
-0.4
1.0
0.8
0.6
1
1 1 1 1 1
0.4
1
box-5 5 5
(1 + 2 cos ! + 2 cos 2!) 0.2
0.0
0 0.1 0.2 0.3 0.4 0.5
-0.2
-0.4
1.0
0.8
0.6
1
1 2 1 2 (1 + cos !)
0.4
1
linear 4 0.2
0.0
0 0.1 0.2 0.3 0.4 0.5
-0.2
-0.4
1.0
0.8
0.6
1
1 4 6 4 1 4 (1 + cos !)2
0.4
1
binomial 16 0.2
0.0
0 0.1 0.2 0.3 0.4 0.5
-0.2
-0.4
1.0
0.8
0.6
1
1 0 1
0.4
0.0
0 0.1 0.2 0.3 0.4 0.5
-0.2
-0.4
1.0
0.8
0.6
1
1 2 1 2 (1 cos !)
0.4
1
corner 2 0.2
0.0
0 0.1 0.2 0.3 0.4 0.5
-0.2
-0.4
Table 3.3 Fourier transforms of the separable kernels shown in Figure 3.14.
EECS 4422/5323 Computer Vision !26 J. Elder
Computer Vision: Algorithms and Applications (September 3, 2010 draft)
Computer
Computer Vision: Vision:and
Algorithms Algorithms and (September
Applications Applications3,(September
2010 draft) 3, 2010 draft)
2 Two-dimensional Fourier transforms The 2D Fourier Transform
2 Two-dimensional
mensional Fourier transforms
Fourier transforms
The extension
❖ insights
formulas and we have to 2D images
developed and filters is straightforward.
for one-dimensional signals and their trans-
formulas we andhave
insights we have fordeveloped for one-dimensional signals and their trans-
msinsights
translate directly developed
to two-dimensional one-dimensional
images. Here, signals
insteadandoftheir
just trans-
specifying a hor-
ms translate
rectly directly to two-dimensional images. Here, instead of just specifying a hor-
tal or to two-dimensional
vertical frequency !images. or ! , Here,
we instead
can create of anjust specifying
oriented a
sinusoidhor-of frequency
tal or ❖
vertical The 2D
frequency Fourier
!
x
or transform
!
y
, we can tabulates
create an the amplitude
oriented sinusoid andof phase of sinusoidal gratings for
frequency
l!frequency
y ), !x or !y , we can create an oriented sinusoid of frequency
x y
!y ), all combinations of horizontal and vertical frequency:
s(x, y) = sin(!x x + !y y). (3.62)
s(x, y) = sin(! s(x,xy) + =
! sin(!
y). x x + !y y). (3.62) (3.62)
corresponding two-dimensionalxFouriery transforms are then
gcorresponding
two-dimensional two-dimensional Z 1Fourier
Fourier transforms Z 1aretransforms
then are then
H(!
Z 1x ,Z!y1 ) = Z 1 Z 1h(x, y)e j(!x x+!y y) dx dy, (3.63)
H(!x , !y ) = H(!x , !y ) h(x, = 1 j(!x x+!y y)
y)e
1 xh(x,
j(! x+!yy)e y)
dx dy, dx dy, (3.63) (3.63)
1 1
in the discrete domain, 1 1
indomain,
the discrete domain,
M 1N 1
1 X X kx x+ky y
H(kx , M ky )1=N 1 1 M X 1N X 1h(x, y)e j2⇡
kx x+ky,y
MN (3.64)
H(k X
1 x , ky ) = X M N j2⇡
(3.64)
j2⇡ h(x, y)e , (3.64)
k x x+k y y MN
H(kx , ky ) = h(x, x=0 y=0
y)e ,
M N x=0 y=0M N x=0 y=0
M N
❖ This noise can often be approximated as a zero-mean, additive and stationary random
process.
f ( x, y ) = g ( x, y ) + n ( x, y )
Optical image
= +
❖ The problem is to find the optimal filter h(x,y) that will maximize the accuracy of the
filtered image in the least squares sense.
❖ To solve this problem, we assume that the optical image g(x,y) and the noise n(x,y)
are both independent, stationary, random processes whose power spectral densities
are known
( ) ( ) (
= E ⎡ F ω x ,ω y ) ⎤
2 2
Pf ω x , ω y = F ω x , ω y
⎢⎣ ⎥⎦
( ) ( ) (
= E ⎡ G ω x ,ω y ) ⎤
2 2
Pg ω x , ω y = G ω x , ω y
⎢⎣ ⎥⎦
( ) ( ) (
= E ⎡ N ω x ,ω y ) ⎤
2 2
Pn ω x , ω y = N ω x , ω y
⎢⎣ ⎥⎦
ωy
ωx
g ( x, y ) ( )
2
log G ω x , ω y
EECS 4422/5323 Computer Vision !33 J. Elder
Noise Spectral Density
❖ In contrast, the expected energy in image noise tends to be more flat (white) across
spatial frequency
Image
Noise Log Fourier
Log Energy
Fourier Energy
ωy
ωx
n ( x, y ) ( )
2
log N ω x , ω y
EECS 4422/5323 Computer Vision !34 J. Elder
The Wiener Filter
❖ When the frequency distribution of the image energy and the noise energy differ, we
can improve the signal-to-noise ratio (SNR) by boosting the Fourier amplitudes where
the image is strong relative to the noise and attenuating the Fourier amplitudes where
it is relatively weak.
H (ω , ω ) =
( )
Pg ω x , ω y
=
P (ω , ω )
g x y
, where
P (ω , ω ) P (ω , ω ) + P (ω , ω )
x y
f x y g x y n x y
P (ω , ω ) is the power spectral density of the optical image before noise was added
g x y
P (ω , ω ) is the power spectral density of the optical image before noise was added
g x y
❖ The Wiener filter minimizes the expected mean square error (MSE) of the estimated
image relative to the original image before noise was added.
❖ Note that this optimality is general - it does not depend upon either the noise or the
image being Gaussian. (Be careful with the textbook here.)
P (ω , ω ) is the power spectral density of the optical image before noise was added
g x y
❖ To calculate the Wiener filter we need to know the power spectral density of the
optical image and of the noise.
P (ω , ω ) P (ω , ω ) + P (ω , ω )
x y
f x y g x y n x y
P (ω , ω ) is the power spectral density of the optical image before noise was added
g x y
๏ Then
H (ω x , ω y ) =
(α /ω )
2
1
= 2 , where β = α / σ n is the SNR.
(α / ω )2 + σ n2 1+ (ω / β )
β →∞
(
lim H ω x , ω y = 1 ) (
lim H ω x , ω y
β →0
) =⎜ ⎟
⎝ω ⎠
-=1.58
1
0.8
0.6
h
0.4
0.2
0
-2 0 2
!x (cycles per pixel)
❖ Note that:
๏ h(r) is the inverse Hankel transform of H(ω), not the Fourier transform.
๏ h(r) has no analytic form, but the discrete form of h(x, y) can be determined by taking
the inverse Fourier transform of H(ωx,ωy).
⎛ ⎞
⎜ The Hankel transform of β 2
1 ⎟
e− β r is actually
⎜ 2π
( ) ⎟
3/2
⎝ 1+ (ω / β ) 2
⎠
h
0.4 0.4 0.1 0.1
0.2 0.2 0 0
0 0 -0.1 -0.1
-2 0 2-2 0 -5 2 0 -5 5 0 5
!x (cycles per ! (cycles per pixel) x (pixels)
pixel)
x
x (pixels)
EECS 4422/5323 Computer Vision !40 J. Elder
State of the Art
❖ Deep convolutional neural networks
๏ Zhang, K., Zuo, W., Chen, Y., Meng, D., and Zhang, L. (2017). Beyond a Gaussian
denoiser: Residual learning of deep CNN for image denoising. IEEE Transactions on
Image Processing, 26(7):3142–3155.
๏ Wang, R. and Tao, D. (2016). Non-local auto-encoder with collaborative stabilization for
image restoration. IEEE Transactions on Image Processing, 25(5):2117–2129.