0% found this document useful (0 votes)
3 views

Lec 3 Image Processing

Image processing

Uploaded by

sh1637
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Lec 3 Image Processing

Image processing

Uploaded by

sh1637
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Digital Image Processing

(CSC 352)
2022 – 2023
Lecture-3
Dr: Mary monir saied
Email: [email protected]
Digital Image Fundamentals
Image Enhancement
Fundamental Steps of DIP

3
Agenda
Introduction
Image Enhancement – Point Processing
Simple intensity (gray level) transformations
Basic Intensity Transformation
1. Linear Functions:
2. Logarithmic Functions:
3. Power-Law Functions:
piecewise Linear transformation functions.
1. Contrast stretching
2. Gray-level slicing
3. Bit-plane slicing
Histogram processing
Histogram equalization 4
Arithmetic operations
Introduction
What is Image Enhancement
 Images are obtained from various sensor outputs.

 Sometimes, they are NOT suitable for use in


applications, e.g. X-ray images.

 Image enhancement – A set of image processing


operations applied on images to produce good
images useful for a specific application.

6
What is Image Enhancement
 The principal objective of enhancement
 Process an image so that the result is more
suitable than the original image for a specific
application.
 The suitability depends on each specific application
 A method useful for enhancing a certain image
may not necessarily be the best approach for
enhancing other types of images.
 Regardless of the method used, however, image
enhancement is one of the most interesting and
visually appealing areas of image processing. 7
What is Image Enhancement

• Image enhancement is the process of making


images more useful visually.

 Reasons for doing this include:


– Highlighting interesting detail in images.
– Removing noise from images.
– Making images more visually appealing.
8
What is Image Enhancement

9
What is Image Enhancement

10
Domains of Image Enhancement

 It is a mathematical procedure
done in data (digital images)
that converts it from one
domain to another, usually
doing Fourier's.

11
Domains of Image Enhancement– (cont.)

12
Domains of Image Enhancement

13
Image Enhancement Methods
 Spatial Domain Methods (Image Plane)
Techniques are based on direct manipulation of pixels in an
image

 Frequency Domain Methods


Techniques are based on modifying the Fourier transform of
the image.

 Combination Methods
There are some enhancement techniques based on various
combinations of methods from the first two categories
14
 In this chapter, we are going to discuss spatial domain
techniques
Spatial domain

15
Spatial domain
Spatial domain processes:

 Two categories of spatial domain processing:


1. Point processing
 Intensity transformation
 Histogram processing
 Arithmetic operation
16
2. Neighborhood processing
 Next week
Point Processing

17
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
18
Point Processing
Gray-level (Intensity) Transformation Functions
 Here, T is called intensity transformation function or ( gray
level function)

 s, r : denote the intensity of g and f at any point (x,y) .

19
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
20
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
 Three basic types of functions used frequently for image
enhancement:

21
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Linear Functions:
1- Image Negatives
• The negative of an image with gray level in the range [0, L-1],
where L = Largest value in an image, is obtained by using the
negative transformation’s expression:

s = L-1- r
• Which reverses the intensity levels of an input image , in this
manner produces the equivalent of a photographic negative.
• The negative transformation is suitable for enhancing white or 22
gray detail embedded in dark regions of an image, especially
when the black area are dominant in size.
Intensity Transformation Functions
Linear Functions:
1- Image Negatives
s
L-1

23
L-1
r
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Linear Functions:
1- Image Negatives s = L-1- r

24
Intensity Transformation Functions
Linear Functions:
1- Image Negatives

Advantages of negative : 25
 Produces an equivalent of a photographic negative.
 Enhances white or gray detail embedded in dark regions.
Intensity Transformation Functions
Linear Functions:
1- Image Negatives
Example:
Compute the negative of the following 4-bit/pixel image

2 10 4 13 5 11
15 14 13 0 1 2
7 3 6 8 12 9
Original image Output image

Solution: 26
S=L – 1 – r
L= 16
S= 15 - r
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Linear Functions:
2- Image Identity

s=r
 Output intensities
are identical to
input intensities.

27
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Linear Functions:
2- Image Identity
 Identity transition is shown by a straight line. In this transition, each
value of the input image is directly mapped to each other value of output
image. That results in the same input image and output image. And
hence is called identity transformation. It has been shown below:
s s=r
L-1
 This function doesn’t have an
effect on an image, it was
included in the graph only for
completeness.
28

0 L-1
r
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
29
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
 Logarithmic Functions:
1- Log Transform
• The general form of the
log transformation:
s = c log (1+r)
Where c is a constant, and r ≥ 0
• Log curve maps a narrow
range of low gray-level
values in the input image
into a wider range of the
output levels. 30
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
 Logarithmic Functions:
1- Log Transform L-1

Output intensity level, s


 Expand the values of dark
pixels.
 Compress the higher value
of lighter pixels.

0 Input intensity level, r L-1

31
s = c log(1+ r)
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Logarithmic Functions:
1- Log Transform

32
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Logarithmic Functions:
2- Inverse Log Transform
 Do opposite to the log
transformations
 Used to expand the values of
high pixels in an image while
compressing the darker-level
values

33
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Logarithmic Functions:
2- Inverse Log Transform
L-1
Output intensity level, s

0 34
0 L-1
Input intensity level, r
Intensity Transformation Functions

InvLog Log

35
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
36
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
 Power-law Functions:

• The general form of the


power-law functions:

s = c. 𝒓𝜸
Where c and 𝜸 are
positive constants.

 Power-law curves with fractional values of 𝜸 map a values into a wider range
37
of outputs, with the opposite being true for higher values of input levels.
 C= 𝜸=1 identity function
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Power-law Functions:

38

Histograms… (Gamma Correction)


Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Power-law Functions:

Gamma < 1

Narrow Dark Range Wider Dark Range


39
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Power-law Functions:

 Different power
values highlight
different details.

40
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Power-law Functions:

41
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Power-law Functions:

γ = 5.0

42
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
Power-law Functions:

43
Intensity Transformation Functions
1-Basic Intensity Transformation Functions
 Power-law Functions:
Normal
• power-law Gamma < 1
transformations New Range
are useful for
general-purpose
contrast
manipulation Gamma > 1

Old Range
Intensity Transformation Graph
 If 𝜸< 1: the mapping is weighted toward brighter output values. 44
 If 𝜸= 1: the mapping is linear.
 If 𝜸 > 1: the mapping is weighted toward dark output values.
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
45
Intensity Transformation Functions
2-piecewise Linear transformation functions.
 Principle Advantage:
Some important transformations can be formulated only as a
piecewise function.

 Principle Disadvantage:
Their specification requires more user input that previous
transformations.

 Types of Piecewise transformations are:


• Contrast Stretching
• Gray-level Slicing 46
• Bit-plane slicing
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
47
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching
• One of the simplest piecewise linear functions is a contrast-
stretching transformation, which is used to enhance the low
contrast images.

48
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching
 Contrast can be simply explained as the difference between
maximum and minimum pixel intensity in an image.
 The following example shows three 8-bit images with different
contrast level
100 100 100 100 0 5 7 9 100 106 109 100
100 100 100 100 20 10 30 60 120 122 135 140
100 100 100 100 100 130 180 190 110 115 117 120
100 100 100 100 200 221 230 255 130 136 145 150

Contrast level Contrast level Contrast level 49


100-100=0 255-0=255 150-100=50
No contrast High-contrast Low-contrast
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching
 Low contrast images may result from:
 Poor illumination
 Wrong setting of lens aperture during image acquisition.

50
 The idea behind contrast stretching is to increase the dynamic
range of the gray levels in the image being processed.
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching
 Improves the contrast in an
image by stretching the
range of intensity values to
span a desired range of
values.

 Contrast stretching is also known as normalization.


51
 The quality of image is enhanced by stretching the range
of intensity values.
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching
Contrast stretching, which means that the bright pixels
in the image will become brighter and the dark pixels will
become darker, this means: higher contrast image.

52

Original image Contrast Enhanced image


Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching

𝑠𝑚𝑎𝑥 − 𝑠𝑚𝑖𝑛 𝑠 − 𝑠𝑚𝑖𝑛 53


=
𝑟𝑚𝑎𝑥 − 𝑟𝑚𝑖𝑛 𝑟 − 𝑟𝑚𝑖𝑛
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching

𝑠𝑚𝑎𝑥 − 𝑠𝑚𝑖𝑛 54
𝑠= × (𝑟 − 𝑟𝑚𝑖𝑛 ) + 𝑠𝑚𝑖𝑛
𝑟𝑚𝑎𝑥 − 𝑟𝑚𝑖𝑛
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching: example
Input image: 8-bit image have range [100-151]
After contrast stretching: the new range become [0 -255]
Using the following equation:

𝑠𝑚𝑎𝑥 − 𝑠𝑚𝑖𝑛
𝑠= × (𝑟 − 𝑟𝑚𝑖𝑛 ) + 𝑠𝑚𝑖𝑛
𝑟𝑚𝑎𝑥 − 𝑟𝑚𝑖𝑛

 Where r is the input intensity, 𝑟𝑚𝑖𝑛 and 𝑟𝑚𝑎𝑥 are the


input intensity range [100-151], s is the output
intensity after contrast stretching, 𝑠𝑚𝑖𝑛 and 𝑠𝑚𝑎𝑥 are 55
the new intensity range [0-255].
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching
Example:
Input image: 8-bit image have range [100-151]
After contrast stretching: the new range become [0 -255]
Using the following equation:
𝑠𝑚𝑎𝑥 − 𝑠𝑚𝑖𝑛
𝑠= × (𝑟 − 𝑟𝑚𝑖𝑛 ) + 𝑠𝑚𝑖𝑛
𝑟𝑚𝑎𝑥 − 𝑟𝑚𝑖𝑛
100 105 107 100 a=r1=rmin=100
120 125 120 130 b=r2=rmax=151
115 117 112 118 s1=smin=0
56
130 140 145 151 s2=smax=255
Input image
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching
Ans.:
Input image: 8-bit image have range [100-151]
Output image: the new range become [0 -255]

𝑠𝑚𝑎𝑥 − 𝑠𝑚𝑖𝑛
𝑠= × (𝑟 − 𝑟𝑚𝑖𝑛 ) + 𝑠𝑚𝑖𝑛
𝑟𝑚𝑎𝑥 − 𝑟𝑚𝑖𝑛
𝟐𝟓𝟓 − 𝟎
𝒔= × 𝒓 − 𝟏𝟎𝟎 + 𝟎 = 𝟓 × 𝒓 − 𝟏𝟎𝟎
𝟏𝟓𝟏 − 𝟏𝟎𝟎 57
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching
Ans.:
𝟐𝟓𝟓 − 𝟎
𝒔= × 𝒓 − 𝟏𝟎𝟎 + 𝟎 = 𝟓 × 𝒓 − 𝟏𝟎𝟎
𝟏𝟓𝟏 − 𝟏𝟎𝟎
If r=100 s=0
If r=105 s=25 100 105 107 100
If r=107 s=35 120 125 120 130
If r=112 s=60 115 117 112 118
If r=115 s=75
If r=117 s=85 130 140 145 151
If r=118 s=90
If r=120 s=100 Input image
If r=125 s= 125
If r= 130 s= 150
If r=140 s=200 58
If r=145 s=225
If r=151 s=255
Intensity Transformation Functions
2-piecewise Linear transformation functions.
• Contrast Stretching
Ans.:

100 105 107 100


After
0 25 35 0
Contrast Stretching
120 125 120 130 100 125 100 150
115 117 112 118 75 85 60 90
130 140 145 151 150 200 225 255
Input image Output image
59
Thank You
60

You might also like