transforms and frequency filtering - cbakhalid/todb/frequency_domain_filteringtodb...• when...
Post on 06-Aug-2020
7 Views
Preview:
TRANSCRIPT
Transforms and
Frequency Filtering
Khalid NiaziCentre for Image Analysis
Swedish University of Agricultural Sciences
Uppsala University
2
khalid@cb.uu.se
Reading Instructions
• Chapter 4: Image Enhancement in the
Frequency Domain
• Book: Digital Image Processing by Gonzalez &
Woods, Third Edition, 2007
3
Image processing
g(x, y) = T[f(x, y)]
• Original image f.
• Result image g after transformation T.
• T can be performed
– point-wise (gray-level transformation)
1 x 1
– locally (in a small neighborhood)
m x n
– globally (the whole image)
M X N
khalid@cb.uu.se
4
Image representations
• An image is a function of x and y. f(x, y)
• One possible way to investigate its properties is to display the function values as grey-level
intensities; this is the “normal” representation.
• Another possibility is to transform the function values, e.g., to spatial frequencies through the
Fourier transform. It is still the same image, but in a different representation.
• This gives a partitioning of the frequencies in the image.
khalid@cb.uu.se
5
Frequency domain representation
• We need to know
– Frequency
– Sinusoids
– Euler’s formula
– …
khalid@cb.uu.se
6
Frequency domain representation
• Frequency: Cycles per second
• Sinusoids: Common name for Cosine and Sine
• Euler's formula
khalid@cb.uu.se
7
Frequency domain representation
• Using Euler’s formula one can write a Sinusoid
as,
0
khalid@cb.uu.se
8
Frequency domain representation
x(t) = x1(t) + x2(t) + x3(t) + x4(t)
x1(t) = 10 cos(2*pi*1*t+pi/32)
x2(t) = 6 cos(2*pi*1.5*t+pi/10)
x3(t) = 4 cos(2*pi*2.7*t+pi/7)
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
x4(t) = 2 cos(2*pi*3.4*t+pi/13)
time
khalid@cb.uu.se
9
Frequency domain representation
-4 -3 -2 -1 0 1 2 3 40
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
frequency
khalid@cb.uu.se
10
Frequency domain representation
• Conjugate symmetric pair of points in the
frequency domain of a signal corresponds to a
sinusoid in the spatial domain
• A one-dimensional sinusoid has frequency,
phase, and amplitude
• No time information in the frequency domain
khalid@cb.uu.se
11
Frequency domain representation
• Y[x, y] = sin[2π(Ux+ Vy)]
• Where x and y are horizontal and vertical dimensions
of the image Y. U and V represents the frequencies
along these dimensions.
• Here the image has two frequencies, i.e., horizontal
and vertical frequencies
• MATLAB demonstration
khalid@cb.uu.se
12
Frequency domain representation
• Conjugate symmetric pair of points in the
frequency domain of an image corresponds to a
two-dimensional sinusoid in the spatial domain
• A one-dimensional sinusoid has frequency,
phase, and amplitude and two dimensional
sinusoid also has a direction
• Two-dimensional sinusoids are directional in
nature
khalid@cb.uu.se
13
Fourier transform
• F(u, v) is generally complex:
• F(u, v) = ℜ(u, v) + ℑ(u, v) = |F(u, v)| exp ( φ(u, v))
• ℜ(u, v) is the real component of F(u, v).
• ℑ(u, v) is the imaginary component of F(u, v).
• |F(u, v)| is the magnitude function, also called the Fourier spectrum.
• φ(u, v) is the phase angle.
• F(u, v) is composed of an infinite sum of sine and cosine terms, where u
and v determines the frequency of its corresponding sine-cosine pair.
khalid@cb.uu.se
14
Summation of Fourier frequency
terms to fit a step function
khalid@cb.uu.se
15
Display of Fourier images
• The magnitude function, or Fourier spectrum,
• |F(u, v)|
• can be displayed as an intensity function, where the brightness is
• proportional to the amplitude.
• The spectrum most often has a large dynamic range, e.g.,
• 0–2.500.000. Only the brightest parts of the spectrum are visible.
• By a logarithmic transform an increase in visible detail is possible:
• D(u, v) = c log(1 + |F(u, v)|)
khalid@cb.uu.se
16
Display of Fourier images
khalid@cb.uu.se
17
The Fourier spectrum |F(u, v)|
• F(0, 0) is the mean grey-level in the image, i.e., the lowest frequency.
• The farther away from (u, v) = (0, 0) we get, the higher the frequencies
represented by F(u, v) are.
• F(u, v) contains information about low frequencies (areas with slowly
changing grey-level) if (u, v) is close to (0, 0).
• F(u, v) contains information about high frequencies (abrupt changes in
grey-level, such as edges and noise) if (u, v) is far away from (0, 0).
• F(0, 0) is usually centered in the image showing the Fourier spectrum.
khalid@cb.uu.se
18
Properties of the Fourier transform
• Separability
• Translation
• Periodicity
• Conjugate Symmetry
• Rotation
• Convolution
khalid@cb.uu.se
19
Separability
• The separability property is a great advantage for images with M = N.
• F(u, v) or f(x, y) can be obtained by two successive applications of the
simple 1D Fourier transform or its inverse, instead of by one application of
the more complex 2D Fourier transform.
• That is, first transform along each row, and then transform along each
column, or vice versa.
khalid@cb.uu.se
20
Translation
• A shift in
f(x, y) = f(x − x0, y − y0)does not affect the magnitude function |F(u, v)|:
• It only affects the phase angle φ(u, v).
• Keep in mind when displaying the magnitude function!
• MATLAB demonstration
khalid@cb.uu.se
21
Periodicity
• The discrete Fourier transform is periodic:
F(u, v) = F(u +M, v) = F(u, v + N) = F(u +M, v + N)
• Why Periodic?
• Only one period is necessary to reconstruct
f(x, y)
khalid@cb.uu.se
22
Conjugate Symmetry
khalid@cb.uu.se
23
Rotation Dependency
• Rotating f(x, y) by an angle α rotates F(u, v) by the same angle.
• Similarly, rotating F(u, v) rotates f(x, y) by the same angle.
khalid@cb.uu.se
24
Convolution theorem
• Convolution in the spatial domain
⇐⇒
multiplication in frequency domain
• f(x, y) ∗ g(x, y) = F−1{F(u, v) · G(u, v)}
and vice versa
• F(u, v) ∗ G(u, v) = F{f(x, y) · g(x, y)}
khalid@cb.uu.se
25
Examples
khalid@cb.uu.se
26
Examples
khalid@cb.uu.se
27
Enhancement in frequency domain
• Steps in filtering in the frequency domain
(simplified):
1. Compute the Fourier-transform of the image
to be enhanced.
2. Multiply the result by a frequency filter.
3. Compute the inverse Fourier-transform to
produce the enhanced image.
khalid@cb.uu.se
28
Enhancement in frequency domain
• When filtering images by a mask, convolution in the spatial
domain is used.
• We can get the frequency filter by computing the Fourier
transform of the spatial filter (the mask).
• Then, filtering by multiplying the Fourier transformed image
and the frequency filter is equal to filtering by convolution in
spatial domain.
khalid@cb.uu.se
29
Smoothing frequency-domain filters
• High frequencies are attenuated; noise and
edges are blurred.
• Ideal lowpass filter: ILPF
• Butterworth lowpass filter: BLPF
• Gaussian lowpass filter: GLPF
khalid@cb.uu.se
30
Ideal lowpass filtering
• Only values of F(u, v) near (u, v) = (0, 0)
remains after filtering Only low
frequencies remains after filtering
khalid@cb.uu.se
31
Gaussian lowpass filtering
The frequency filter must have the same size as the original image,
this is achieved by “filling up” the frequency filter with zeros.
khalid@cb.uu.se
32
Gaussian lowpass filtering
khalid@cb.uu.se
33
Sharpening frequency-domain
filters
• Low frequencies are attenuated; noise and
edges are enhanced.
• The reverse operation of lowpass filters.
• Ideal highpass filter: IHPF
• Butterworth highpass filter: BHPF
• Gaussian highpass filter: GHPF
• The Laplacian in the frequency domain
khalid@cb.uu.se
34
Ideal highpass filtering
• Only values of F(u, v) far from (u, v) = (0, 0) remains after filtering
Only high frequencies remains after filtering.
khalid@cb.uu.se
35
Gaussian highpass filter
• By taking one minus the Gaussian lowpass filter
(GLPF),
• the Gaussian highpass filter (GHPF) is achieved.
khalid@cb.uu.se
36
Gaussian highpass filter
khalid@cb.uu.se
37
Laplacian in frequency domain
khalid@cb.uu.se
38
Laplacian in frequency domain
khalid@cb.uu.se
39
Decimation-free directional filter
bank(DDFB)
khalid@cb.uu.se
40
DDFB
khalid@cb.uu.se
41
DDFB
khalid@cb.uu.se
42
DDFB
khalid@cb.uu.se
43
Directional analysis
khalid@cb.uu.se
44
Directional analysis
khalid@cb.uu.se
45
Directional analysis
khalid@cb.uu.se
46
DDFB
khalid@cb.uu.se
47
Directional analysis
khalid@cb.uu.se
48
Directional analysis
khalid@cb.uu.se
49
Directional analysis
name@cb.uu.se
50
Directional analysis
khalid@cb.uu.se
51
Directional analysis
khalid@cb.uu.se
52
Directional analysis
khalid@cb.uu.se
53
Directional analysis
khalid@cb.uu.se
54
Directional analysis
khalid@cb.uu.se
55
Directional analysis
khalid@cb.uu.se
56
Directional analysis
khalid@cb.uu.se
57
Design of DDFB
khalid@cb.uu.se
58
DDFB
• Divides an Image into its directional
components
• It is common practice to divide an image into
eight directional components. But it is mostly
dependent on the image information
• Noise is omni-directional
khalid@cb.uu.se
59
Image enhancement with DDFB
khalid@cb.uu.se
60
Image enhancement with DDFB
khalid@cb.uu.se
61
Image enhancement with DDFB
khalid@cb.uu.se
62
Next lecture
• Image Restoration
• Time1315hrs
• Date: 28/10/09
khalid@cb.uu.se
top related