Image Transformations,
Enhancement and
Frequency Domain Processing
◼ Image Transformations
1
2
Roughly, the term frequency in an image tells about the rate of
change of pixel values.
Step-1. Transform the image.
Step-2. Carry the task(s) in the transformed domain.
Step-3. Apply inverse transform to return to the spatial domain.
3
In spatial domain, we analyze the image w.r.t. the spatial location of pixels.
But in frequency domain we don’t analyze signal with respect to time, but with respect of
frequency.
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.
1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1
1 1 1 2 2 2 2 1
2 1 2 1 2 1 2
1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
1 1 1 1 1 1 1 1
1 1 1 1 2 2 2 2 1 2 1 2 1 2 1 2 2 1 2 1 2 1 2 1
2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 2 1 2 1 2 1 2 2 1 2 1 2 1 2 1
2 2 2 2 2 2 2 2 2 1 2 1 2 1 2 1 2
2 2 2 1 1 1 1 1 2 1 2 1 2 1 2
2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 2 1 2 1 2 1 2 2 1 2 1 2 1 2 1
➢ Rate of change of pixels in image1 is low w.r.t the rate of change of pixels in image2.
➢ First, we need to transform the image to its frequency distribution.
4
Transformation
A signal can be converted from time domain into frequency domain using
mathematical operators called transforms. There are many kind of
transformation that does this. Some of them are given below.
▪ Fourier Series
▪ Fourier transformation
▪ Laplace transform
▪ Z transform
Out of all these, we will thoroughly discuss Fourier series and Fourier
transformation in this lecture.
5
The French mathematician Jean Baptiste Joseph Fourier was born in 1768 in the town of
Auxerre, about midway between Paris and Dijon. The contribution for which he is most
remembered was outlined in a memoir in 1807 and published in 1822 in his book, La
Théorie Analitique de la Chaleur (The Analytic Theory of Heat).This book was translated
into English 55 years later by Freeman (see Freeman [1878]).
Basically, Fourier’s contribution in this field states that any periodic function can be
expressed as the sum of sines and/or cosines of different frequencies, each multiplied by a
different coefficient (we now call this sum a Fourier series). It does not matter how
complicated the function is; if it is periodic and satisfies some mild mathematical conditions,
it can be represented by such a sum. This is now taken for granted but, at the time it first
appeared, the concept that complicated functions could be represented as a sum of simple
sines and cosines was not at all intuitive (Fig. 4.1), so it is not surprising that Fourier’s ideas
were met initially with skepticism (=doubt).
Even functions that are not periodic (but whose area under the curve is finite) can be
expressed as the integral of sines and/or cosines multiplied by a weighing [Link]
formulation in this case is the Fourier transform, and its utility is even greater than the
Fourier series in many theoretical and applied disciplines.
6
Difference between Fourier series and transform:
Although both Fourier series and Fourier transform are given by Fourier , but the
difference between them is
Fourier series is applied on periodic signals and
Fourier transform is applied for non periodic signals.
Which one is applied on images
Now the question is that which one is applied on the images , the Fourier series or the
Fourier transform. Well, the answer to this question lies in the fact that what images are.
Images are non – periodic. And since the images are non periodic, so Fourier transform
is used to convert them into frequency domain.
7
Difference between the periodic motion and non-periodic motions
The difference between the periodic motion and non-periodic motions are listed below
Periodic motion Non-periodic motion
A motion repeating itself at regular A motion that repeats itself is
intervals is regarded as periodic motion. considered a non-periodic motion but
not at regular periods of time.
Example: Movement of earth Example: Vehicles
8
9
Frequency components
Any image in spatial domain can be represented in a frequency domain. But what do this
frequencies actually mean.
We will divide frequency components into two major components.
High frequency components
High frequency components correspond to edges in an image.
Low frequency components
Low frequency components in an image correspond to smooth regions.
In Frequency domain, after shifting the values to the center,
➢ All the values at the center are considered as low frequency values and
➢ All the values which are far from the center are considered as high frequency values.
10
Fourier Transform
• Fourier Series: Any function that
periodically repeats itself can be expressed
as the sum of sines/cosines of different
frequencies, each multiplied with a different
coefficient.
• Fourier Transform: Functions that
are not periodic, whose area under the
curve is finite, can be expressed as the
integral of sines and/cosines multiplied by a
weighting function.
1D Continuous Fourier Transform
• The Fourier Transform is an important tool in Image
Processing, and is directly related to filter theory, since a filter, which is a
convolution in the spatial domain, is a simple multiplication in the
frequency domain.
•1-D Continuous Fourier Transform
The Fourier transform, F(u), of a single variable continuous function, f(x), is defined by:
F (u) = f (x)e− j 2uxdx
−
Given Fourier transform of a function F(u), the inverse Fourier transform can be used to
obtain, f(x), by:
f (x) = F (u)e j 2uxdu
−
Note: F(u), is the frequency spectrum, where, u represents the frequency, and f(x) is the
signal where x represents time/space. j = −1
1D Continuous Fourier Transform
Time/Space domain 0 Sine wave
-1
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
300
250
200 Delta function
Frequency domain 150
100
50
0
0 20 40 60 80 100 120
1D Continuous Fourier Transform
0.5
0.4
Time/Space domain 0.3
0.2
Gaussian
0.1
0
0 5 10 15 20 25 30 35 40 45 50
4
Frequency domain 3
Gaussian
2
0
0 50 100 150 200 250
1D Continuous Fourier Transform
1.5
Time/Space domain 0.5
Sinc function
0
-0.5
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
4
Frequency domain Square wave
3
0
-100 -50 0 50 100
Fourier Transform pairs (spatial versus Frequency)
• 1-D Discrete Fourier Transform
The Fourier transform, F(u), of a discrete function of one variable, f(x), x=0, 1, 2, …, M-1,
is given by:
M −1
F (u) =
1
M
f (x)e − j 2ux / M
x=0
The inverse Discrete Fourier Transform can be used to calculate f(x), by:
M −1
f (x) = F (u)e j 2ux / M
u=0
Note: F(u), which is the Fourier trans
form of f(x) contains discrete complex quantities and it has the same number of
components as f(x).
e = cos + j sin
j
1D Discrete Fourier Transform
• 1-D Discrete Fourier Transform
Then; M −1
1
F (u) =
M
f (x)[cos 2ux / M − j sin 2ux / M ]
x=0
• The Fourier Transform generates complex quantities. The magnitude or the spectrum of
the Fourier transform is given by:
1/ 2
F(u) = R (u) + I (u)
2 2 R(u) is the Real Part and
I(u) is the Imaginary Part
• The Phase Spectrum of the transform refers to the angles between the real and imaginary
components and it is denoted by:
(u) = tan−1 I (u)
R(u)
1D Discrete Fourier Transform
•1-D Discrete Fourier Transform
•The Power Spectrum/spectral density is defined as the square of the Fourier spectrum and
denoted by
P(u) = F(u) = R2 (u) + I 2 (u)
2
• The power spectrum can be used, for example to separate a portion of a specified
frequency (i.e. low frequency) power from the power spectrum and monitor the effect.
Typically used to define the cut off frequencies used in lowpass and highpass filtering.
•We primarily use the Fourier Spectrum for image enhancement applications.
1D Discrete Fourier Transform
Double the amplitude in the
frequency domain
Double the area under the Double the area under the
curve in spatial domain curve in the frequency domain
EE-583: Digital Image Processing
Image Enhancement in the
Frequency Domain
2D Discrete Fourier Transform
The Fourier transform of a 2D discrete function (image) f(x,y) of size
MxN is given by:
MN x=0 y=0
x=0, 1, 2, …, M-1, and y=0, 1, 2, …, N-1.
EE-583: Digital Image Processing
Image Enhancement in the
Frequency Domain
2D Discrete Fourier Transform
The 2D Fourier Spectrum, Phase Spectrum and Power Spectrum can be
respectively denoted by:
F(u, v) = R (u, v) + I (u, v)
2 2
1/2 Magnitude/Fourier
Spectrum
−1 I (u, v)
(u, v) = tan
Phase Spectrum
R(u, v)
P(u, v) = F(u, v) = R 2 (u, v) + I 2 (u, v)
2
Power Spectrum
23
24
EE-583: Digital Image Processing
2D Discrete Fourier Transform
The F(u) not centered
Image Enhancement in the Frequency Domain
The centered F(u)
EE-583: Digital Image Processing
2D Discrete Fourier Transform
EE-583: Digital Image Processing
Origin = 0,0
2D Discrete Fourier Transform
f(x,y) F(u,v) – not centered
Centered + Log
Centered F(u,v) Transformed F(u,v)
Origin = 0,0
EE-583: Digital Image Processing
2D Discrete Fourier Transform
Consider the following 2 left images which are pure vertical cosine of 4 cycles and a pure
vertical cosine of 32 cycles.
f(x,y) F(u,v) Notice that the Fourier Spectrum for
each image at the right contains just a
single component, represented by 2
bright spots symmetrically placed
about the center.
f(x,y) F(u,v) The dot at the center that represents
the (0,0) frequency term or average
value of the image. Images usually
have a large average value/DC
component. Due to low frequencies
Fourier Spectrum images usually
have a bright blob of components near
the center.
© 2002 R. C. Gonzalez & R. E. Woods
EE-583: Digital Image Processing
2D Discrete Fourier Transform
Consider the following 2 left images with pure cosines in pure forward diagonal and mixed
vertical+horizontal.
One of the properties of the 2D FT is that if you rotate the image, the spectrum
will rotate in the same direction
f(x,y) F(u,v)
The sum of 2 sine functions, each
in opposite (vertical and
horizontal) direction.
f(x,y) F(u,v)
© 2002 R. C. Gonzalez & R. E. Woods
EE-583: Digital Image Processing
2D Discrete Fourier Transform
The center value (at the origin) of the Frequency Spectrum corresponds to the ZERO
frequency component which also referred to as the DC component in an image:
Substituting 0,0 to the origin, the Fourier transform function yields to the average/DC
component value as follows: M −1 N −1
f (x, y)
1
F (0,0) =
f(x,y) F(u,v) MN x=0 y=0 f(x,y) F(u,v)
The center/zero frequency
component (DC component) is
removed
© 2002 R. C. Gonzalez & R. E. Woods
EE-583: Digital Image Processing
2D Discrete Fourier Transform
The lines in an image often generate perpendicular lines in the spectrum
f(x,y) F(u,v)
f(x,y) F(u,v)
The sloped lines in the
spectrum are due to the sharp
transition from the sky to the
mountain
© 2002 R. C. Gonzalez & R. E. Woods
EE-583: Digital Image Processing
Filtering in the Frequency Domain
•Some Basic Properties of the Frequency Domain:
•Frequency is directly related to the rate of change. Therefore, slowest varying
component (u=v=0) corresponds to the average intensity level of the image.
Corresponds to the origin of the Fourier Spectrum.
f(x,y)
• Higher frequencies corresponds to the
faster varying intensity level changes in the
image. The edges of objects or the other
components characterized by the abrupt changes
in the intensity level corresponds to higher
frequencies.
F(u,v)
© 2002 R. C. Gonzalez & R. E. Woods
EE-583: Digital Image Processing
Filtering in the Frequency Domain
• Basic Steps for Filtering in the Frequency Domain:
© 2002 R. C. Gonzalez & R. E. Woods
EE-583: Digital Image Processing
Filtering in the Frequency Domain
• Basic Steps for Filtering in the Frequency Domain:
1. Multiply the input image by (-1)x+y to center the transform.
2. Compute F(u,v), the DFT of the image from (1).
3. Multiply F(u,v) by a filter function H(u,v).
4. Compute the inverse DFT of the result in (3).
5. Obtain the real part of the result in (4).
6. Multiply the result in (5) by (-1)x+y .
Given the filter H(u,v) (filter transfer function) in the frequency domain, the Fourier
transform of the output image (filtered image) is given by:
G(u, v) = H (u, v)F(u, v) Step (3)
The filtered image g(x,y) is simply the inverse Fourier transform of G(u,v).
g(x, y) = −1G(u, v) Step (4)
EE-583: Digital Image Processing
Filtering in the Frequency Domain
• Basics of Low Pass Filters in the Frequency Domain:
• lowpass filter: A filter that attenuates
high frequencies while passing the low
frequencies.
• Low frequencies represent the gray-
level appearance of an image over
smooth areas.
• highpass filter: A filter that
attenuates low frequencies while
passing the high frequencies.
• High frequencies represents
the details such as edges and noise.
EE-583: Digital Image Processing
Filtering in the Frequency Domain
• Consider the following filter transfer function:
0 if (u, v) = (M / 2, N / 2)
H (u, v) =
1 otherwise
• This filter will set F(0,0) to zero and leave all the other frequency components. Such a
filter is called the notch filter, since it is constant function with a hole (notch) at the origin.
EE-583: Digital Image Processing
Filtering in the Frequency Domain
• Smoothing Frequency Domain Filters: Ideal Lowpass Filters
1 if D(u, v) D0
H (u, v) = D(u,v) is the distance from the origin
0 if D(u, v) D0 D0 is the cutoff frequency
EE-583: Digital Image Processing
Filtering in the Frequency Domain
• Smoothing Frequency Domain Filters: Butterworth Lowpass Filters
1
H (u, v) = D(u,v) is the distance from the origin
D0 is the cutoff frequency.
1+[D(u, v) / D 0 ]2n
n is the order of the filter
EE-583: Digital Image Processing
Filtering in the Frequency Domain
• Smoothing Frequency Domain Filters: Gaussian Lowpass Filters
−D 2 (u,v)/ 2D 02 D(u,v) is the distance from the origin
H (u, v) = e D0 is the cutoff frequency.
EE-583: Digital Image Processing
Filtering in the Frequency Domain
•Comparison of Ideal, Butterworth and Gaussian Lowpass Filters having the
same radii (cutoff frequency) value.
Original image Ideal LP Filtered Butterworth LP Filtered Gaussian LP Filtered
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
• The high-frequency components are: edges and sharp transitions such as noise.
• Smoothing/blurring can be achieved by attenuating a specified range of high-
frequency components in the frequency domain.
• Given the Fourier transformed image F(u) , the filtered image G(u) can be
obtained by:
G(u, v) = H (u,v)F(u, v)
• Where H(u) is the filter transfer function.
• Smoothing can be achieved by lowpass filters. We will consider only 3 types of
lowpass filters:
• Ideal Lowpass filters,
• Butterworth Lowpass filters,
• Gaussian Lowpass filters
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
•Ideal Lowpass Filter (ILPF): Simply cuts off all the high frequencies higher
than the specified cutoff frequency. The filter transfer function:
1 if D(u, v) D0 D(u,v) is the distance from the origin
H (u, v) =
0 if D(u, v) D0 D0 is the cutoff frequency
Cutoff frequency
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
•Cutoff Frequency of an Ideal Lowpass Filter: One way of specifying the
cutoff frequency is to compute circles enclosing specified amounts of total image
power.
•Calculating PT which is the total power of the transformed image:
M −1 N −1
PT = P(u, v) u = 0, 1, ..., M − 1 , v = 0, 1, ..., N − 1
u=0 v=0
• The cutoff frequency Do can be determined by
specifying the percent of the total power enclosed by a
circle centered at the origin. The radius of the circle is the
cutoff frequency Do.
= 100 P(u, v) / PT u radius(D o ) , v radius(D o )
u v
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
• Cutoff Frequency of an Ideal Lowpass Filter:
Original Image Fourier Spectrum 15 pixels , = 92%
80 pixels , = 98%
230 pixels ,
= 99.5%
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
• Cutoff Frequency of an Ideal Lowpass Filter:
ILPF with cutoff=5, removed power=8%
Blurring effect is the result of LPIF
Original
Image
ILPF with cutoff=30, removed power=3.6%
cutoff=15,
r.d. power=5.4% Ringing effect is the problem of LPIF
ILPF with cutoff=230, removed power=0.5%
cutoff=80,
r.d. power=2%
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
•Blurring and Ringing properties of ILPF:
•The blurring and ringing properties of the ILPF can be explained by the help of
the convolution theorem:
• Given the Fourier transformed input image F(u) and output image
G(u) and the filter transfer function H(u),
G(u, v) = H (u, v)F(u, v)
•The corresponding process in the spatial domain with regard to the
convolution
theorem is given by:
g(x, y) = h(x, y) f (x, y)
• h(x,y) in the spatial domain, is the inverse Fourier transform of the
filter transfer function H(u,v).
• The spatial filter h(x,y) has two major characteristics:
• dominant component at the origin
•Concentric circular components about center component.
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
• Blurring and Ringing properties of ILPF:
1D Frequency Domain- H(u) 1D Spatial Domain- h(x)
inverse DFT
2D Frequency Domain- H(u,v) 2D Spatial Domain – h(x,y)
• The spatial domain filters center component is responsible for blurring.
• The circular components are responsible for the ringing artifacts.
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
•Blurring and Ringing properties of ILPF: Lets consider the following
convolution in the spatial domain:
Central components: causes blurring
* =
circular components: causes ringing effect
Input image - f(x,y) Spatial Filter – h(x,y) filtered image – g(x,y)
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
•Butterworth Lowpass Filter (BLPF): The transfer function of BLPF of
order n and with a specified cutoff frequency is denoted by the following filter
transfer function:
1
H (u, v) = D(u,v) is the distance from the origin
D0 is the cutoff frequency.
1+[D(u, v) / D0 ]2n n is the order of the filter
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
• Butterworth Lowpass Filter (BLPF):
•The BLPF with order of 1 does not have any ringing artifact.
•BLPF with orders 2 or more shows increasing ringing effects as the order
increases.
D0 =5, n=1 D0 =5, n=2 D0 =5, n=3 D0 =5, n=4
2D - Spatial domain representation of the BLPF.
1D - Profile through the centre of the Spatial domain filters.
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
•Butterworth Lowpass Filter (BLPF):
BLPF with cutoff=5, order=2
cutoff=15, BLPF with cutoff=30, order=2
order=2
BLPF with cutoff=230, order=2
cutoff=80,
order=2
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
•Gaussian Lowpass Filter (GLPF): The transfer function of GLPF is given as
follows:
2
− D 2 (u,v)/ 2D 0
H (u, v) = e
D(u,v) is the distance from the origin
D0 is the cutoff frequency.
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
•(GLPF): The inverse Fourier transform of the Gaussian Lowpass
cutoff=5 filter is also Gaussian in the Spatial
domain.
Original
Image
cutoff=30
cutoff=15
cutoff=230
cutoff=80
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
•Gaussian Lowpass Filter (GLPF): Refer to the improvement in the following
example.
EE-583: Digital Image Processing
Smoothing Frequency-Domain Filters
•Gaussian Lowpass Filter (GLPF): The following example shows a lady
younger. How? By using GLPF!
EE-583: Digital Image Processing
Sharpening Frequency-Domain Filters
•The high-frequency components are: edges and sharp transitions such as noise.
• Sharpening can be achieved by highpass filtering process, which
attenuates low frequency components without disturbing the high-frequency
information in the frequency domain.
•The filter transfer function, Hhp(u,v), of a highpass filter is given by:
Hhp (u, v) = 1− Hlp (u, v)
•Where Hlp(u,v), is the transfer function of the corresponding lowpass filter.
•We will consider only 3 types of sharpening highpass filters :
• Ideal Highpass filters,
• Butterworth Highpass filters,
• Gaussian Highpass filters
EE-583: Digital Image Processing
Sharpening Frequency-Domain Filters
•Ideal Highpass Filter (IHPF): Simply cuts off all the low frequencies lower
than the specified cutoff frequency. The filter transfer function:
0 if D(u, v) D0 D(u,v) is the distance from the origin
H (u, v) =
1 if D(u, v) D0 D0 is the cutoff frequency
Perspective plot Image representation Cross section of
of IHPF of IHPF IHPF
EE-583: Digital Image Processing
Sharpening Frequency-Domain Filters
• Ideal Highpass Filter (IHPF): The ringing artifacts occur at
low cutoff frequencies
D0 =15 D0 =30 D0 =80
EE-583: Digital Image Processing
Sharpening Frequency-Domain Filters
•Butterworth Highpass Filter (BHPF): The transfer function of BHPF of
order n and with a specified cutoff frequency is given by:
1 D(u,v) is the distance from the origin
H (u, v) = D0 is the cutoff frequency.
1+[D0 / D(u, v)]2n n is the order of the filter
Perspective plot Image representation Cross section of
of BHPF of BHPF BHPF
EE-583: Digital Image Processing
Sharpening Frequency-Domain Filters
• Butterworth Highpass Filter (BHPF): Smoother results are
obtained in BHPF when compared IHPF. There is almost no ringing
artifacts.
D0 =15, n=2 D0 =30, n=2 D0 =80, n=2
EE-583: Digital Image Processing
Sharpening Frequency-Domain Filters
•Gaussian Highpass Filter (GHPF): The transfer function of GHPF is given
by:
2
−D 2 (u,v)/ 2D 0 D(u,v) is the distance from the origin
H (u, v) = 1− e D0 is the cutoff frequency.
Perspective plot Image representation Cross section of
of BHPF of BHPF BHPF
EE-583: Digital Image Processing
Sharpening Frequency-Domain Filters
• Gaussian Highpass Filter (GHPF): Smoother results are obtained
in GHPF when compared BHPF. There is absolutely no ringing artifacts.
D0 =15 D0 =30 D0 =80
EE-583: Digital Image Processing
Sharpening Frequency-Domain Filters
• Comparison of Ideal, Butterworth and Gaussian High pass Filters
(D0 =30)
Ideal High pass Filter Butterworth High pass Filter Gaussian High pass Filter
HOMOMORPHIC FILTERING
◼ The illumination-reflectance model introduced in Section 2.3 can be used to
develop a frequency domain procedure for improving the appearance of an
image by simultaneous intensity range compression and contrast enhancement
◼ Image f (x, y) can be expressed as the product of its illumination, i(x, y), and
reflectance, r(x, y), components:
◼ This equation cannot be used directly to operate on the frequency components
of illumination and reflectance because the Fourier transform of a product is
not the product of the transforms.
64
Using a slightly modified form of the GHPF function
yields the homomorphic function
65
Steps in Homomorphic Filtering
▪ Apply log transformation to convert multiplication into addition.
▪ Compute the Fourier Transform (FFT) of the image.
▪ Apply a high-pass filter to enhance reflectance.
▪ Perform Inverse Fourier Transform (IFFT).
▪ Apply exponential transformation to restore the original scale.
66
UNSHARP MASKING, HIGH-BOOST FILTERING, AND HIGHFREQUENCY-
EMPHASIS FILTERING
Using frequency domain methods, the mask defined as
where HLP(u,v) is a lowpass filter transfer function, and F(u,v) is the
DFT of f(x, y).
67
➢When k=1, we have unsharp masking,
➢When k>1, the process is referred as highboost
filtering.
68