Univ of Utah, CS6640 2011 1
Filtering in the Fourier Domain
Ross Whitaker SCI Institute, School of Computing
University of Utah
Univ of Utah, CS6640 2011 2
Fourier Filtering
• Low-pass filtering • High-pass filtering • Band-pass filtering • Sampling and aliasing • Tomography • Optimal filtering and match filters
Univ of Utah, CS6640 2011 3
Some Identities to Remember
Univ of Utah, CS6640 2011 4
Fourier Spectrum
Fourier spectrum Origin in corners
Retiled with origin In center
Log of spectrum
Image
Univ of Utah, CS6640 2011 5
Fourier Spectrum–Rotation
Univ of Utah, CS6640 2011 6
Phase vs Spectrum
Image Reconstruction from phase map
Reconstruction from spectrum
Univ of Utah, CS6640 2011 7
Low-Pass Filter • Reduce/eliminate high frequencies • Applications
– Noise reduction • uncorrelated noise is broad band • Images have sprectrum that focus on low
frequencies
86%
88%
90%
92%
94%
96%
98%
100%
0% 10% 20% 30% 40% 50% 60% 70% 80%
Univ of Utah, CS6640 2011 8
Ideal LP Filter – Box, Rect
Cutoff freq Ringing – Gibbs phenomenon
Univ of Utah, CS6640 2011 9
Extending Filters to 2D (or higher)
• Two options – Separable
• H(s) -> H(u)H(v) • Easy, analysis
– Rotate • H(s) -> H((u2 + v2)1/2) • Rotationally invariant
Univ of Utah, CS6640 2011 10
Ideal LP Filter – Box, Rect
Univ of Utah, CS6640 2011 11
Ideal Low-Pass Rectangle With Cutoff of 2/3
Image Filtered Filtered + HE
Univ of Utah, CS6640 2011 12
Ideal LP – 1/3
Univ of Utah, CS6640 2011 13
Ideal LP – 2/3
Univ of Utah, CS6640 2011 14
Butterworth Filter
Control of cutoff and slope Can control ringing
Univ of Utah, CS6640 2011 15
Butterworth - 1/3
Univ of Utah, CS6640 2011 16
Butterworth vs Ideal LP
Univ of Utah, CS6640 2011 17
Butterworth – 2/3
Univ of Utah, CS6640 2011 18
Gaussian LP Filtering ILPF BLPF GLPF
F1
F2
Univ of Utah, CS6640 2011 19
High Pass Filtering
• HP = 1 - LP – All the same filters as HP apply
• Applications – Visualization of high-freq data (accentuate)
• High boost filtering – HB = (1- a) + a(1 - LP) = 1 - a*LP
Univ of Utah, CS6640 2011 20
High-Pass Filters
Univ of Utah, CS6640 2011 21
High-Pass Filters in Spatial Domain
Univ of Utah, CS6640 2011 22
High-Pass Filtering with IHPF
Univ of Utah, CS6640 2011 23
BHPF
Univ of Utah, CS6640 2011 24
GHPF
Univ of Utah, CS6640 2011 25
HP, HB, HE
Univ of Utah, CS6640 2011 26
High Boost with GLPF
Univ of Utah, CS6640 2011 27
High-Boost Filtering
Univ of Utah, CS6640 2011 28
Band-Pass Filters
• Shift LP filter in Fourier domain by convolution with delta
LP
BP Typically 2-3 parameters - Width - Slope - Band value
Univ of Utah, CS6640 2011 29
Band Pass - Two Dimensions
• Two strategies – Rotate
• Radially symmetric – Translate in 2D
• Oriented filters
• Note: – Convolution with delta-pair in FD is
multiplication with cosine in spatial domain
Univ of Utah, CS6640 2011 30
Band Bass Filtering
Univ of Utah, CS6640 2011 31
Radial Band Pass/Reject
Univ of Utah, CS6640 2011 32
Band Reject Filtering
Univ of Utah, CS6640 2011 33
Band Reject Filtering
Univ of Utah, CS6640 2011 34
Band Reject Filtering
Univ of Utah, CS6640 2011 35
Discrete Sampling and Aliasing • Digital signals and images are discrete
representations of the real world – Which is continuous
• What happens to signals/images when we sample them? – Can we quantify the effects? – Can we understand the artifacts and can we limit
them? – Can we reconstruct the original image from the
discrete data?
Univ of Utah, CS6640 2011 36
A Mathematical Model of Discrete Samples
Delta functional
Shah functional
Univ of Utah, CS6640 2011 37
A Mathematical Model of Discrete Samples
Discrete signal
Samples from continuous function
Representation as a function of t • Multiplication of f(t) with Shah
• Goal – To be able to do a continuous Fourier
transform on a signal before and after sampling
Univ of Utah, CS6640 2011 38
Fourier Series of A Shah Functional
u
Univ of Utah, CS6640 2011 39
Fourier Transform of A Discrete Sampling
u
Univ of Utah, CS6640 2011 40
Fourier Transform of A Discrete Sampling
u
Energy from higher freqs gets folded back down into lower freqs – Aliasing
Frequencies get mixed. The original signal is not recoverable.
Univ of Utah, CS6640 2011 41
What if F(u) is Narrower in the Fourier Domain?
u
• No aliasing! • How could we recover the original signal?
Univ of Utah, CS6640 2011 42
What Comes Out of This Model
• Sampling criterion for complete recovery • An understanding of the effects of
sampling – Aliasing and how to avoid it
• Reconstruction of signals from discrete samples
Univ of Utah, CS6640 2011 43
Shannon Sampling Theorem
• Assuming a signal that is band limited:
• Given set of samples from that signal
• Samples can be used to generate the original signal – Samples and continuous signal are equivalent
Univ of Utah, CS6640 2011 44
Sampling Theorem • Quantifies the amount of information in a
signal – Discrete signal contains limited frequencies – Band-limited signals contain no more
information then their discrete equivalents • Reconstruction by cutting away the
repeated signals in the Fourier domain – Convolution with sinc function in space/time
Univ of Utah, CS6640 2011 45
Reconstruction • Convolution with sinc function
Univ of Utah, CS6640 2011 46
Sinc Interpolation Issues
• Must functions are not band limited • Forcing functions to be band-limited can
cause artifacts (ringing)
f(t) |F(s)|
Univ of Utah, CS6640 2011 47
Sinc Interpolation Issues
Ringing - Gibbs phenomenon Other issues:
Sinc is infinite - must be truncated
Univ of Utah, CS6640 2011 48
Aliasing • High frequencies appear as low frequencies
when undersampled
Univ of Utah, CS6640 2011 49
Aliasing
16 pixels 8 pixels
0.9174 pixels
0.4798 pixels
Univ of Utah, CS6640 2011 50
Overcoming Aliasing
• Filter data prior to sampling – Ideally - band limit the data (conv with sinc
function) – In practice - limit effects with fuzzy/soft low
pass
Univ of Utah, CS6640 2011 51
Antialiasing in Graphics
• Screen resolution produces aliasing on underlying geometry
Multiple high-res samples get averaged to create one screen sample
Univ of Utah, CS6640 2011 52
Antialiasing
Univ of Utah, CS6640 2011 53
Interpolation as Convolution • Any discrete set of samples can be
considered as a functional
• Any linear interpolant can be considered as a convolution – Nearest neighbor - rect(t) – Linear - tri(t)
Univ of Utah, CS6640 2011 54
Convolution-Based Interpolation • Can be studied in terms of Fourier Domain • Issues
– Pass energy (=1) in band – Low energy out of band – Reduce hard cut off (Gibbs, ringing)
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
1.2
-6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6
Univ of Utah, CS6640 2011 55
Tomography
Univ of Utah, CS6640 2011 56
Tomography Formulation
Attenuation
Log gives line integral
Line with angle theta
Volume integral
Univ of Utah, CS6640 2011 57
Fourier Slice Theorem 1D FT
Projection to 1D 1D Slice 2D FT
Optimal Filtering
• Systems model
• Ergodic signals – Drawn from a ensemble – Average over ensemble is constant – Average over time is ensemble average – -> Expected value of power spectrum
describes ensemble Univ of Utah, CS6640 2011 58
Optimal/Weiner Filter
• Power spectrum of signal, noise are known • H(u) is known • Filter that minimizes the expected
squared error of reconstruction is:
Univ of Utah, CS6640 2011 59
Optimal/Weiner Filter
Univ of Utah, CS6640 2011 60
Image Registration • Find dx and dy that best matches two images • Cross correlation can give the best translation
between two images • Algorithms
– SD -> FD (mult) -> SD – look for peak – SD -> FD -> find the best fit for a phase shift
• Issues – Boundaries, overlap, intensity variations, high
intensity edges
Univ of Utah, CS6640 2011 61
Normalized Cross Correlation
• Subtract the mean of the image and divide by the S.D. – This maps the image to the unit sphere – A single integral is the dot product of these to
vectors • angles between the two normalized images
– Helps alleviate intensity differences
Univ of Utah, CS6640 2011 62
Phase Correlation
Univ of Utah, CS6640 2011 63
Phase Correlation
Univ of Utah, CS6640 2011 64
For Midterm – Pseudocode
• High level code to describe algorithm • Make up reasonable key words • Key idea – convey the algorithm • Can adopt syntax from any major
programming language – Be consistent
Univ of Utah, CS6640 2011 65
Psuedocode
Univ of Utah, CS6640 2011 66
Psuedocode
Univ of Utah, CS6640 2011 67