Fourier Transform & Image Enhancement in Frequency Domain
Smoothing
The Big Idea
Any function that periodically repeats itself can be expressed as a sum
of sines and cosines of different frequencies each multiplied by a
different coefficient – a Fourier series
The Big Idea (cont…)
Frequency
domain signal
processing
example in Excel
The Fourier Transform is an important image processing tool
• used to decompose an image into its sine and cosine components.
• The output of the transformation represents the image in the Fourier or
frequency domain, while the input image is the spatial domain equivalent.
• The physical relevance of fourier transform is that it tells the relative
amplitude of frequencies present in the signal
Difference between spatial domain and frequency domain.
• In spatial domain , we deal with images as it is. The value of the pixels of
the image change with respect to scene. Whereas in frequency domain ,
we deal with the rate at which the pixel values are changing in spatial
domain.
What do frequencies mean in an image ?
– High frequencies correspond to pixel values that change
rapidly across the image (e.g. text, texture, leaves, etc.)
– Strong low frequency components correspond to large
scale features in the image (e.g. a single, homogenous
object that dominates the image)
What is the advantage of carrying out filtering in the
frequency domain over spatial domain?
The primary reason is that in frequency domain, the process of filtering i.e.
convolution simplifies to multiplication. Hence, we use frequency domain for
filtering.
Basically the concept of spatial domain mathematics says that given a function
f(x,y) and a kernel h(x,y), the filtered output can be written as f(x,y)∗h(x,y) where
* represents the convolution operator.
**Convolution can be explained as placing the kernel over the signal and
basically summing up the element-wise products and replacing the anchor value
with the sum.
Contd…
On the other hand, in frequency domain, the output is simply given
by F(u,v)×H(u,v) where F(u,v) and H(u,v) are the Fourier
transforms of their respective functions.
This representation is both computationally and spacewise efficient
as both may be represented as sparse matrices as well in most cases.
f(x,y)∗h(x,y) F(u,v)×H(u,v)
And hence, we use frequency domain for filtering. Generally
though, for separable filters, it makes more sense to just use the
separated components one at a time.
DFT & Images
mages taken from Gonzalez & Woods, Digital Image Processing (2002)
The DFT of a two dimensional image can be
visualised by showing the spectrum of the images
component frequencies
DFT
DFT & Images (cont…)
mages taken from Gonzalez & Woods, Digital Image Processing (2002)
DFT
Scanning electron microscope Fourier spectrum of the image
image of an integrated circuit
magnified ~2500 times
Frequency Domain Filtering
In the Spatial Domain
input image mask enhanced image
And
=
enhanced image is the result of the convolution of the input image and the mask
Where is the impulse response
Frequency Domain Filtering
In Frequency domain
input
Image
(Fourier, DCT…)
DCT/DFT
Ie; Filter/Transfer Fn
= *
*]
Frequency Domain Filtering
• Frequency domain methods first transforms the images into a ‘transform domain’ or
frequency domain and then operate on the transformed images.
• After the process, the images are transformed back to spatial domain by applying inverse
transforms.
• These frequency domain approaches are more flexible and involve less computations when
comparing with spatial domain approaches.
• Therefore frequency domain is preferred for most of the image processing tasks.
• Frequency domain is just the space defined by the values of the Fourier Transform and the
frequency variables.
Properties
• The slowest varying frequency component (u=v=0) corresponds to the average gray level of
an image.
• The low frequencies correspond to the slowly varying components of an image
• The higher frequencies which are located far away from the origin correspond to the faster
gray level changes in the image.
Frequency Domain Filtering
Frequency Domain Filtering
Frequency Domain Filtering
Filtering in the frequency domain is the process of modifying the transform of an image using
a filter function and taking the inverse of the result to get the processed image.
Steps to be followed:
Step 1: Multiply the input image by (-1)x+y: to center the transform. This step is known as
preprocessing stage
Step 2: Compute Discrete Fourier Transform(DFT), F(u,v) of the image obtained from step 1
Step 3: Multiply F(u,v) by a filter function H(u,v).
This multiplication is done by an element-by-element basis. Ie, the first element of
H(u,v) multiplies the first element of F(u,v) and so on.
The function H(u,v) suppresses some frequencies and unchange the other frequencies
and hence it is called as a filter or filter transfer function
The output obtained from this step is represented as G(u,v) = H(u,v) . F(u,v)
Frequency Domain Filtering
Step 4: Compute the inverse DFT of the result in Step 3
This is used to obtain the filtered image. It is represented as,
Filtered image = F-1 [ G(uv) ]
Step 5: Obtain the real part of the result in Step 4
The inverse DFT has some parasitic imaginary components due to round-off errors.
Such components are neglected by this step.
Step 6: Multiply the result obtained from Step 5 by (-1) x+y . Step 5 and 6 are known as ‘post-
processing’ stages.
Thus the enhanced image g(x,y) is obtained.
Smoothing Frequency Filters
Smoothing in frequency domain is the process of attenuating a specified range of high-
frequency components in the transform of a given image. It is also known as blurring.
A filter that attenuates ie., weakens high frequencies and passes low frequencies is called a
low-pass filter.
In an image (a ) low frequencies in the Fourier transform correspond to the gray level
appearance over smooth area.
(b ) High frequencies correspond to detail such as edges and noises.
Therefore, a low pass filtered image would have less sharp detail than the original image, as
the high frequencies are removed. The image will appear smoother than the original.
Three types
• Ideal Low-pass filters (ILPF)
• Butterworth Low-pass filters (BLPF)
• Gaussian Low-pass filters (GLPF)
These filters cover the entire range of filter functions from very sharp to very smooth.
Smoothing Frequency Filters
• Ideal Low-pass filters (ILPF) [ very sharp ]
Simplest low pass filter. It cuts-off all the high frequency components of the Fourier
Transform which are located at a distance greater than a specified distance D 0 from the origin
of the centered transform.
D(u,v) is the distance [Euclidean]between the
point (u,v) and the origin of the frequency
rectangle
If the image size is M x N,
Centre of the frequency rectangular is at (u,v) =
(M/2,N/2),
Then,
In 3D view, the function of the filter is to pass all
the frequencies which are inside a circle of
radius D0 and attenuate all the frequencies
outside it.
Ideal Low Pass Filter (cont…)
mages taken from Gonzalez & Woods, Digital Image Processing (2002)
Result of filtering
Original with ideal low pass
image filter of radius 5
Result of filtering Result of filtering
with ideal low pass with ideal low pass
filter of radius 15 filter of radius 30
Result of filtering
Result of filtering
with ideal low pass
with ideal low pass
filter of radius 230
filter of radius 80
Ringing is an unwanted effect caused
by the blurring.
The concentric components of h(x,y)
are responsible for the ringing
characteristics of ILPF
Smoothing Frequency Filters
• Butterworth Low-pass filters (BLPF) [ tunable]
In Butterworth low pass filter, there is no clear cutoff frequency which decides the amount of
frequencies to be passed and the amount of frequencies to be filtered.
When the amount of high frequency content removed decreases, the image becomes finer in
texture.
When D(u,v)=D0 = H(u,v)=1/[1+(1)2n ] =
0.5=50%, which implies that 50% of the
frequencies from the maximum value is filtered.
Smoothing Frequency Filters
• Butterworth Low-pass filters (BLPF) [ tunable]
Butterworth Lowpass Filter (cont…)
mages taken from Gonzalez & Woods, Digital Image Processing (2002)
Result of filtering
Original with Butterworth filter
image of order 2 and cutoff
radius 5
Result of filtering with Result of filtering
Butterworth filter of with Butterworth
order 2 and cutoff radius filter of order 2 and
15 cutoff radius 30
Result of filtering with Result of filtering
Butterworth filter of with Butterworth filter
order 2 and cutoff radius of order 2 and cutoff
80 radius 230
Smoothing Frequency Filters
• Butterworth Low-pass filters (BLPF) [ tunable]
Ringing is an unwanted effect caused by the blurring. In BLPF, when the filter order ‘n’
increases, the ringing also increases. Hence should be considered for higher order filters and
can be ignored for lower orders.
Therefore, BLPF of order ‘n’=2
is preferred because, it provides
• Effective low pass filtering
and
• Acceptable ringing
characteristics
Smoothing Frequency Filters
• Gaussian Low-pass filters (GLPF) [ very smooth]
The transfer function of a 2D GLPF is given by,
where σ - > Measure of the Gaussian curve spread
If σ = D0 =>
Where D0 is the Cutoff frequency Spatial Gaussian Filter
A spatial Gaussian filter is
obtained by taking the inverse
Fourier Transform of H(u,v)
and D(u,v). The obtained
filter will have no ringing.
Gaussian Lowpass Filters (cont…)
mages taken from Gonzalez & Woods, Digital Image Processing (2002)
Result of filtering
Original with Gaussian filter
image with cutoff radius 5
Result of filtering Result of filtering
with Gaussian with Gaussian filter
filter with cutoff
radius 15
with cutoff radius 30
Result of filtering with Result of filtering
Gaussian filter with
with Gaussian filter
cutoff radius 85
with cutoff radius
230
Smoothing Frequency Filters
Applications of Low-pass filtering
Character Recognition
The characters of a text may be distorted or broken due to poor resolution
Human visual system can recognise these characters easily, but a machine recognition system
finds difficulty for the same.
Therefore low pass filters are used here to fill up the small gaps by blurring
Printing and Publishing Industry
Uused in a number or preprocessing steps
Unsharp masking
Cosmetic processing etc.[ step done before printing. It produces a smoother and softer looking
image from a sharp original image. The sharpness of the fine skin lines and small blemishes in
the human face can be reduced by this [skin blemishes -> dark patches on the face or areas of
discoloration on the skin]
Smoothing Frequency Filters
Applications of Low-pass filtering (Contd…)
Processing satellite and Aerial images
Due to the sensors aused for satellite and aerial image capturing, some dominant scan lines
may be present in the direction of the sensing of the scene.
Low pass filters are used to remove the effect of these scan lines by blurring so that large
features are easilyrecognised
Lowpass Filtering Examples
mages taken from Gonzalez & Woods, Digital Image Processing (2002)
A low pass Gaussian filter is used to connect broken text
Lowpass Filtering Examples (cont…)
mages taken from Gonzalez & Woods, Digital Image Processing (2002)
Different lowpass Gaussian filters used to remove
blemishes in a photograph
Summary: Low pass filtering (Frequency Domain)
Ideal filter
– D(u, v): distance from point (u, v) to the origin
– cutoff frequency (D0)
– radially symmetric about the origin
Butterworth filter
Gaussian lowpass filter
https://www.youtube.com/watch?v=guPIbJIZ7QI&t=1266s
https://www.youtube.com/watch?v=OOu5KP3Gvx0&t=103s