Fourier series - Tony Nicol's teaching support

Download Report

Transcript Fourier series - Tony Nicol's teaching support

Digital Image Processing
Part 4
Frequency Domain Processing
Several images are from the book on the reading list: Digital Image Processing by Gonzalez and Woods
Fourier Transform
N 1
F ( j )   x(nT )e

j 2 knT
N
n 0
• Same function is used for one row of an image as for signals but the
variables are named differently by convention and they are not
functions of time. x is used for horizontal direction in the image and u
is horizontal direction in the DFT. f(x) is the pixel value and F(u) is
the Fourier value for that pixel. M is the pixel width of the image.
M 1
F (u)   f ( x)e
x 0

j 2ux
M
2D - DFT
• Images are 2 dimensional so the DFT of an
image has to be 2Dimensional
• Using v as the vertical transform coefficient and y
as the vertical position of the pixel:
M 1 N 1
F (u, v)   f ( x, y)e
x 0 y 0
 ux vy 
 j 2   
M N 
Power Spectrum and Phase
• This too is the same as for signals but is two
dimensional
Spectrum  F (u, v) 
R (u, v)  I
2

2
(u, v)
Power  F (u, v)  R 2 (u, v)  I 2 (u, v)
2
 I (u, v) 
Phase  (u, v)  tan 

R
(
u
,
v
)


1


Is phase important?
• The second image in each row shows the log of the magnitude
spectrum
• For the first image in the row the third image shows the phase
spectrum, scaled so that -π is dark and π is light.
• The final images are obtained by swapping the magnitude spectra
suggesting that the phase spectrum is more important for perception
than the magnitude spectrum.
Filtering
• Filtering in the frequency domain is
relatively straight forward
– FFT the image
– Multiply by the transfer function
– IFFT to restore the image
• Need to think in 3D. Consider the signal
and image frequency spectrum
comparison:
• Impulse signal and impulse image produce
high frequency components. Brightness
indicates amplitude for 2D spectrum
3D function plotted in 2D
Ideal low pass filter
• Seems like a great filter but transient
causes large ripple in the stop band
Image filtered with ILPF
• With the ideal filter
the effects of ringing
are clear to see
• Cut-off frequency is
increasing with each
image
Butterworth low pass filter
• Smooth the edges of the filter to reduce
ringing. The higher the order, the more
ringing
Butterworth at various orders
• Orders are 1,2,5 and 20. Ringing is apparent in the
higher order filters
Image filtered with BLPF
• Butterworth filter
using same cut-off
frequencies of
order 2
• No visible ringing
High pass filters
• Ideal, Butterworth and Gaussian comparison. Ripple
distortion can be seen inside the squares in the image
Spatial or frequency filtering?
• Spatial filters are an approximation of
frequency filters but if acceptable then
they are computationally less costly
• To represent a filter with a large pass
band, use a smaller mask
• Some complex filters can not be
implemented using convolution masks