Suez Canal University
Electrical Engineering Department
Image Processing
LEC. 2-6: IMAGE ENHANCEMENT
Ahmed.m.1986@[Link]
+201227059094
OUTLINES
Image Enhancement in the Spatial Domain
Image Enhancement in the Frequency Domain
Candidate Textbooks/References.
A. PROF. AHMED MAGDY 3/7/2026 2
3/7/2026 3
IMAGE
ENHANCEMENT
IN THE SPATIAL
DOMAIN
Image Enhancement in the Spatial Domain
Image Enhancement in the Spatial Domain
Convolution Example – Step 1
1 1 1 2 2 2 3
-1 2 1 2 1 3 3
-1 -1 1 2 2 1 2
h 1 3 2 2
1 1 1
-1 4
2 2 2 3 5
-1 -2
2 1 3 3
2 2 1 2
f*h
1 3 2 2
f 6
Convolution Example – Step 2
1 1 1 2 2 2 3
-1 2 1 2 1 3 3
-1 -1 1 2 2 1 2
h
1 3 2 2
1 1 1
-2
2 4
2 2 3 5 4
-2
2 -1
1 3 3
2 2 1 2
f*h
1 3 2 2
f 7
Convolution Example – Step 3
1 1 1 2 2 2 3
-1 2 1 2 1 3 3
-1 -1 1 2 2 1 2
h
1 3 2 2
1 1 1
2 -2
2 4
2 3
5 4 4
2 -1
1 -3
3 3
2 2 1 2
1 3 2 2
f
f*h 6
Convolution Example – Step 4
1 1 1 2 2 2 3
-1 2 1 2 1 3 3
-1 -1 1 2 2 1 2
h
1 3 2 2
1 1 1
2 2 -2
2 6
3 1 5 4 4 -2
2 1 -3
3 -3
3 1
2 2 1 2
1 3 2 2
f f*h 9
Convolution Example – Step 5
1 1 1 2 2 2 3
-1 2 1 2 1 3 3
-1 -1 1 2 2 1 2
1 3 2 2
h
1 2 2 2 3 5 4 4 -2
-1 4
2 1 3 3 9
-1 -2
2 2 1 2
1 3 2 2
f f*h 10
Convolution Example – Step6
1 1 1 2 2 2 3
-1 2 1 2 1 3 3
-1 -1 1 2 2 1 2
h 1 3 2 2
2 2 2 3
5 4 4 -2
-2
2 2
1 3 3
9 6
-2
2 -2
2 1 2
1 3 2 2
f
f*h 9
Image Enhancement in the Spatial Domain
12
Image Enhancement in the Spatial Domain
13
Problem 3.21
The three images shown were blurred using square averaging
masks of sizes n = 23,25, and 45, respectively. The vertical bars
on the left lower part of (a) and (c) are blurred, but a clear
separation exists between them. However, the bars have
merged in image (b), in spite of the fact that the mask that
produced this image is significantly smaller than the mask that
produced image (c). Explain this.
14
Image Enhancement in the Spatial Domain
15
Problem 3.22
Consider an application such as the one shown in Fig. 3.34,
in which it is desired to eliminate objects smaller than those
enclosed in a square of size q X q pixels.
Suppose that we want to reduce the average gray level of
those objects to one-tenth of their original average gray level.
In this way, those objects will be closer to the gray level of the
background and they can then be eliminated by thresholding.
Give the (odd) size of the smallest averaging mask that will
accomplish the desired reduction in average gray level in only
one pass of the mask over the image.
16
Problem 3.20
(a)In a character recognition application, text pages are reduced to binary
form using a thresholding transformation function of the form shown in
Fig. 3.2(b). This is followed by a procedure that thins the characters until
they become strings of binary 1's on a background of 0's. Due to noise, the
binarization and thinning processes result in broken strings of characters
with gaps ranging from 1 to 3 pixels. One way to "repair" the gaps is to run
an averaging mask over the binary image to blur it, and thus create bridges
of nonzero pixels between gaps. Give the (odd) size of the smallest
averaging mask capable of performing this task.
(b) After bridging the gaps, it is desired to threshold the image in order to
convert it back to binary form. For your answer in (a), what is the
minimum value of the threshold required to accomplish this, without
causing the segments to break up again?
17
Order‐Statistics Filters
◼ Median Filter
◼ Maximum Filter
◼ Minimum Filter
18
Order‐Statistics Filters
19
Sharpening Spatial Filters
20
Sharpening Spatial Filters – Laplacian Filter
◼ First derivative
◼ Second derivative
21
Sharpening Spatial Filters
22
Sharpening Spatial Filters
23
Image Enhancement in the Spatial Domain
24
Problem 3.23
In a given application an averaging mask is
applied to input images to reduce noise, and then
a Laplacian mask is applied to enhance small
details. Would the result be the same if the order
of these operations were reversed?
25
Image Enhancement in the Spatial Domain
26
Image Enhancement in the Spatial Domain
27
Image Enhancement in the Spatial Domain
28
Image Enhancement in the Spatial Domain
29
Gamma Correction
30
Gamma Correction
31
Gamma Correction
32
Contrast Stretching
33
Image Enhancement in the Spatial Domain
34
Histogram Equalization
35
Image Enhancement in the Spatial Domain
36
3/7/2026 37
IMAGE
ENHANCEMENT
IN THE
FREQUENCY
DOMAIN
Image Enhancement in the Frequency
Domain
38
Image Enhancement in the Frequency
Domain
39
Image Enhancement in the Frequency
Domain
40
The 1D Continuous Fourier Transform
The continuous Fourier transform
The inverse continuous Fourier transform
41
The 1D Discrete Fourier Transform (DFT)
The 1D discrete Fourier transform
The inverse 1D discrete Fourier transform
42
The 1D Discrete Fourier Transform (DFT)
43
The 1D Discrete Fourier Transform (DFT)
44
The 1D Discrete Fourier Transform (DFT)
45
The 1D Discrete Fourier Transform (DFT)
46
The 1D Discrete Fourier Transform (DFT)
47
The 1D Discrete Fourier Transform (DFT)
48
The 1D Discrete Fourier Transform (DFT)
49
The 2D Discrete Fourier Transform (DFT)
The 2D discrete Fourier transform
The 2D inverse discrete Fourier transform
50
The 2D Discrete Fourier Transform (DFT)
51
The 2D Discrete Fourier Transform (DFT)
52
Image Enhancement in the Frequency
Domain
53
Image Enhancement in the Frequency
Domain
54
Fourier Transform ‐ Examples
55
Fourier Transform ‐ Examples
56
Fourier Transform ‐ Examples
57
Fourier Transform ‐ Examples
58
Fourier Transform ‐ Examples
59
Fourier Transform ‐ Examples
60
Fourier Transform ‐ Examples
61
Fourier Transform ‐ Examples
62
Fourier Transform ‐ Examples
63
Fourier Transform ‐ Examples
64
Image Enhancement in the Frequency
Domain
65
The Fourier Image
Fourier spectrum |F(u,v)| Fourier spectrum log(1 + |F(u,v)|)
Image f
66
Frequency Bands
Image Fourier Spectrum
Percentage of image power enclosed in circles (small to large) :
90%, 95%, 98%, 99%, 99.5%, 99.9%
67
Image Enhancement in the Frequency
Domain
68
Image Enhancement in the Frequency
Domain
69
Image Enhancement in the Frequency
Domain
70
Image Enhancement in the Frequency
Domain
71
Image Enhancement in the Frequency
Domain
72
Laplacian Filter in the Frequency Domain
73
Problem 4.27
Suppose that you form a lowpass spatial filter
that averages the four immediate neighbors of
a point (x, y) but excludes the point itself.
(a)Find the equivalent filter H(u, v) in the
frequency domain.
74
(b)Show that your result is a lowpass filter.
Ideal Lowpass Filters
75
Ideal Lowpass Filters
76
Ideal Lowpass Filters
77
Ideal Lowpass Filters
78
Butterworth Lowpass Filters
79
Butterworth Lowpass Filters
80
Butterworth Lowpass Filters
81
Gaussian Lowpass Filters
82
Image Enhancement in the Frequency
Domain
83
Image Enhancement in the Frequency
Domain
84
Highpass Filters
85
Highpass Filters
86
Ideal Highpass Filters
87
Butterworth Highpass Filters
88
Gaussian Highpass Filters
89
Noise Removal
Noisy image
Fourier Spectrum Noise-cleaned image 90
Noise Removal
Noisy image Fourier Spectrum Noise-cleaned image
91
Image Enhancement in the Frequency Domain
92
Image Enhancement in the Frequency Domain
93
Image Enhancement in the Frequency Domain
94
Image Enhancement in the Frequency Domain
95
3/7/2026 96
ATTENDANCE
GO COURSE FILE
A. PROF. AHMED MAGDY
3/7/2026 97
THANKS
ANY QUESTION
A. PROF. AHMED MAGDY