Digital Image Processing
(CSC 352)
2022 – 2023
Lecture-4
Dr: Mary monir saied
Email: mmh04@fayoum.edu.eg
Digital Image Fundamentals
Image Enhancement
Fundamental Steps of DIP
3
Main points of Image Enhancement
Image
Enhancement
Spatial Frequency
domain Domain
4
Main points of Image Enhancement
Image
Enhancement
Spatial Frequency
domain Domain
Point Neighborhood
processing processing 5
Image Enhancement in the Spatial
Domain
6
Point Processing
Point
processing
intensity (gray Arithmetic Histogram
level) operations processing
transformations
Basic Intensity piecewise Linear
Transformation transformation functions.
Gray- Bit-
Linear Logarithmic Power-Law Contrast
level plane
Functions Functions Functions stretching
slicing slicing
Negative Identity nth power nth root
Inverse-
Log
log
7
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Gray-level slicing(intensity-level slicing)
Highlighting a specific range of intensities in an image. In other
words, we segment certain gray level regions from the rest of
the image.
Approach 1 Approach 2
Display in one value(e.g white) all Brightens or darkens the desired
the values in the range of interest , range of intensities but leaves all 8
and in another (e.g black) all other other intensity levels in the image
intensities unchanged
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Gray-level slicing(intensity-level slicing)
Approach 1
In the first type, we display the desired range of intensities in white and
suppress all other intensities to black or vice versa. This results in a binary
image. The transformation function for both the cases is shown below.
9
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Gray-level slicing(intensity-level slicing)
Approach 1
10
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Gray-level slicing(intensity-level slicing)
Approach 1
Example: If the pixel intensity in the old image is between (100 200) convert it in
the new image into 255 (white). Otherwise convert it to 0 (black).
11
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Gray-level slicing(intensity-level slicing)
Approach 2
In the second type, we brighten or darken the desired range of intensities(a to
b as shown below) and leave other intensities unchanged or vice versa. The
transformation function for both the cases, first where the desired range is
changed and second where it is unchanged, is shown below.
12
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Gray-level slicing(intensity-level slicing)
Approach 2
Example: If the pixel intensity in the old image is between (100 200) convert it in
the new image into 255 (white). Otherwise it leaves it the same.
13
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Gray-level slicing(intensity-level slicing)
Example:
Apply intensity level slicing to following image, where:
a. If the intensity in the image is between (50 100) convert it in the new
image into 255 and preserve the background.
b. If the intensity in the image is between (50 100) convert it in the new
image into 255 , else convert it to 0.
110 120 130 135
100 94 98 200
30 60 70 30
28 29 25 27 14
Original Image (r)
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Gray-level slicing(intensity-level slicing)
Solution:
a. If the intensity in the image is between (50 100) convert it in the new
image into 255 and preserve the background.
110 120 130 135 110 120 130 135
100 94 98 200 100 255 255 200
30 60 70 30 30 255 255 30
28 29 25 27 28 29 25 27
Original Image (r) Output Image (s)
15
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Gray-level slicing(intensity-level slicing)
Solution:
b. If the intensity in the image is between (50 100) convert it in the new
image into 255 , else convert it to 0.
110 120 130 135 0 0 0 0
100 94 98 200 0 255 255 0
30 60 70 30 0 255 255 0
28 29 25 27 0 0 0 0
Original Image (r) Output Image (s)
16
Point Processing
Point
processing
intensity (gray Arithmetic Histogram
level) operations processing
transformations
Basic Intensity piecewise Linear
Transformation transformation functions.
Gray- Bit-
Linear Logarithmic Power-Law Contrast
level plane
Functions Functions Functions stretching
slicing slicing
Negative Identity nth power nth root
Inverse-
Log
log
17
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Bit-plane Slicing
• Pixels are digital numbers, each one composed of 8
bits. Instead of highlighting gray-level range, we could
highlight the contribution made by each bit.
• This method is useful and used in image compression.
18
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Bit-plane Slicing
• Most significant bits contain the majority of visually
significant
19
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Bit-plane Slicing
20
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Bit-plane Slicing
[00000001] [00000010]
[00000100] [00001000] [00010000]
[00100000] [01000000] [10000000] 21
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Bit-plane Slicing
22
Point Processing
Point
processing
intensity (gray Arithmetic Histogram
level) operations processing
transformations
Basic Intensity piecewise Linear
Transformation transformation functions.
Gray- Bit-
Linear Logarithmic Power-Law Contrast
level plane
Functions Functions Functions stretching
slicing slicing
Negative Identity nth power nth root
Inverse-
Log
log
23
Histogram Processing
24
Histogram Processing
25
Histogram Processing
26
Histogram Processing
- Histogram Equalization
•As the low-contrast image’s histogram is narrow and
centered toward the middle of the gray scale, if we
distribute the histogram to a wider range the quality of
the image will be improved.
•Histogram Equalization is an image processing
technique used to improved contrast in images.
27
Histogram Processing
- Histogram Equalization
28
Histogram Processing
29
Histogram Processing
- Histogram Equalization
30
Histogram Processing
- Histogram Equalization
Notice that histogram
equalization does not
always produce a
good result
31
Histogram Processing
- Histogram Equalization
• Example:
32
Histogram Processing
- Histogram Equalization
• 1-Calculate the histogram.
• 2-Calculate running sum over the histogram .
• 3-Divide each value by the max value
• 4-Multiply by the new range
• 5-Round the results
33
Histogram Processing
- Histogram Equalization
34
Histogram Processing
- Histogram Equalization
35
Histogram Processing
- Histogram Equalization
36
Histogram Processing
- Histogram Equalization
37
Point Processing
Point
processing
intensity (gray Arithmetic Histogram
level) operations processing
transformations
Basic Intensity piecewise Linear
Transformation transformation functions.
Gray- Bit-
Linear Logarithmic Power-Law Contrast
level plane
Functions Functions Functions stretching
slicing slicing
Negative Identity nth power nth root
Inverse-
Log
log
38
Arithmetic Operation
Arithmetic operations
o Addition
o Subtraction
o Multiplication
39
Arithmetic Operation
Arithmetic operations
To apply the arithmetic operations between two images, we
simply operate on corresponding pixel values, which means that
the value of a pixel in the output image depends only on the
values of the corresponding pixels in the input images.
Hence, the images normally have to be of the same size. For
example to add image I1 and I2 to create I3 as shown in figure
below:
40
Arithmetic Operation
• Addition
Addition is used to combine the information in two images.
Or adding a constant value (scalar) to an image causes an
increase in its overall brightness.
41
Arithmetic Operation
• Addition
Addition is used to combine the information in two images.
42
Arithmetic Operation
• Addition
Addition is used to combine the information in two images.
43
Arithmetic Operation
• Addition
44
Arithmetic Operation
• Addition
45
Arithmetic Operation
• Addition (Brightness)
46
Arithmetic Operation
• Subtraction:
Subtraction of two images is often used to detect motion,
consider the case where nothing has changed in a scene; the
image resulting from subtraction of two sequential image is
filled with zero-a black image.
If something has moved in the scene, subtraction produces a
nonzero result at the location of movement.
Subtraction process also used to detect the defects in the
images.
Applications include Object tracking , Medical imaging.
Subtraction can result in a negative values for certain pixels.
47
Arithmetic Operation
• Subtraction:
48
Arithmetic Operation
• Subtraction:
The subtraction of two images is used for example to detect changes
The subtraction of two images is used for example to detect motion
49
Arithmetic Operation
• Subtraction:
50
Arithmetic Operation
• Subtraction:
51
Arithmetic Operation
• Subtraction:
52
Arithmetic Operation
• Multiplication:
53
Thank You
54