2. Image Enhancement Concepts…
• As the name suggests, improves the look of the
Image, The main goal of enhancement is to
process an image so that the result is “more
suitable” than the original image for specific
application.
• The words “suitable” and “specific” are
significant and show that image enhancement
is purely subjective processing
3. Image Enhancement Concepts…
Another important phenomenon in image
enhancement is “cosmetic procedure” which
means it doesn’t add any extra information to
the original image.
It simply improves the subjective quality of
images by working with the existing data.
Enhancement process does not increase the
inherent information content in the image. But
it slightly increases the dynamic range
4. Image enhancement can be done
into two domains.
Image Enhancement
Spatial Domain Frequency Domain
5. Domains
Spatial domain :
It refers to the image plane itself and
techniques in this category are based as direct
manipulation of pixels in an image.
Frequency domain :
In this method, signal is transformed to
F-domain i.e. frequency domain (There are
certain aspects of the image which are hidden
in spatial domain and gets unhidden in
frequency domain).
Techniques in this category are based on
modifying the Fourier transform of an Image
6. Basics of Spatial Processing
As discussed earlier spatial domain
processing means operation that
are performed directly on the
pixels of an Image.
Spatial operations
-Point Processing
-Neighborhood processing
13. Contrast stretching (Widely used)
Low contrast images can result due to:
(i) Low / Poor illumination.
(ii) Low range of imaging sensor.
(iii) Wrong setting of lens aperture during image
acquisition etc.
The concept behind contrast stretching is to
increase the dynamic range of the gray levels in
the image being processed.
14. • The graph above shows transformation used for contrast
stretching. The locations of points (r1,s1) and (r2,s2) control
the shape of the transformation function.
• If r1 = s1 and r2 = s2 , then transformation is a linear function
and thus form identity transformation.
• If r1 = r2 , s1 = 0 and s2 = L –1 the transformation
becomes a thresholding function that creates a binary
image. (only two grey levels)
Contrast stretching (Widely used)
15. The slope of curve in the above graph
can change depending on the input
image and application (because
enhancement works on subjection
criteria.) for output – Image (5).
The formulation for output image (s) of
the above graph is as :
S = ar, 0 ≤ r ≤ r1
b(r – r1) + S1, r1 ≤ r ≤ r2
c(r – r2) + S2 , r2 ≤ r ≤ L-1
where a, b and c are slopes for the lines O-P , P-Q and Q-R respectively
which are subject to change as per the application and viewer.
The values of r1, r2 are chosen depending upon image .i.e. choosing
that grey levels (r1 and r2) where in the pixels occur most frequently,
so that they would be stretched to improve the overall visual effect.
Contrast stretching (Widely used)
16. Numericals !!!
(a) Original low contrast image (b) Image after contrast
stretching
Contrast stretching (Widely used)
17. As mentioned earlier with,
r1 = r2 = T
if , s1 = 0 and
s2 = L-1
then we get extreme contrast stretching which is called as
thresholding
(a) (b) (c)
Thresholding graphs for different values of threshold (T)
Concept of Thresholding :
18. The formulation for the output image S is given by,
S = 0 , r ≤ T
L – 1 , r > T
The above transformation is useful when one needs to separate
bright objects of interest from a darker background.
Note that a thresholded image is a low contrast image as it has only
black & white grey levels (0 & L - 1).
The values of T can be chosen depending on application & viewer.
Concept of Thresholding
:
19. (a) Original image (b) Image after thresholding
r1 = r2 = 100
s1 = 0, s2 = 255
Another example of image thresholding is given below.
(a) Original image (b) Image after thresholding
Concept of Thresholding :
20. Histogram Processing
What is histogram? :
A graphical display of numerical data in the form of upright bars,
with the area of each bar representing frequency
Definition :
“Histogram of an image represents the relative frequently of
occurrence of the various grey levels in an image.
How to Plot Histogram ?
(1) As already said, “histogram is a plot of number of grey
levels in an image to the respective number of pixels in
image to that grey level.”
(2)∴ x–axis → Grey levels
y–axis → Numbers of pixels in each grey levels.
21.
22.
23. Thus it is a plot of nk verses rk. Many a times it is also a plot of P(rk)
verses rk
Where, P(rk ) = Probability of occurrence of that grey levels.
P(rk ) = nk/n
rk=kth grey level
nk=Number of pixel in the kth grey level
n=Total number of pixels in an image
The histogram thus plotted will be known as normalize histogram
(since nk is divided by n i.e. normalised by n- number of
pixels.)
Example
25. What Information do we get from Histogram ?
Histogram is Discrete !!! (not continuous) !!!
• Thus histogram of a digital image with grey levels
(0 to L–1) is a discrete function nk plotted against r.
• The histogram of a whole image contains global
description of the appearance of the picture. Just
by looking at the histogram of the image, great deal
of information can be obtained.
• For example, we can get the basic grey level
characteristics. i.e.
(i) Dark
(ii) Light
(iii) Low contrast
(iv) High contrast
26. Contrast stretching (Widely used)
Low contrast images can result due to:
(i) Low / Poor illumination.
(ii) Low range of imaging sensor.
(iii) Wrong setting of lens aperture during image
acquisition etc.
The concept behind contrast stretching is to
increase the dynamic range of the gray levels in
the image being processed.
27. • The graph above shows transformation used for contrast
stretching. The locations of points (r1,s1) and (r2,s2) control
the shape of the transformation function.
• If r1 = s1 and r2 = s2 , then transformation is a linear function
and thus form identity transformation.
• If r1 = r2 , s1 = 0 and s2 = L –1 the transformation
becomes a thresholding function that creates a binary
image. (only two grey levels)
Contrast stretching (Widely used)
28. The slope of curve in the above graph
can change depending on the input
image and application (because
enhancement works on subjection
criteria.) for output – Image (5).
The formulation for output image (s) of
the above graph is as :
S = ar, 0 ≤ r ≤ r1
b(r – r1) + S1, r1 ≤ r ≤ r2
c(r – r2) + S2 , r2 ≤ r ≤ L-1
where a, b and c are slopes for the lines O-P , P-Q and Q-R respectively
which are subject to change as per the application and viewer.
The values of r1, r2 are chosen depending upon image .i.e. choosing
that grey levels (r1 and r2) where in the pixels occur most frequently,
so that they would be stretched to improve the overall visual effect.
Contrast stretching (Widely used)
29. Numericals !!!
(a) Original low contrast image (b) Image after contrast
stretching
Contrast stretching (Widely used)
30. As mentioned earlier with,
r1 = r2 = T
if , s1 = 0 and
s2 = L-1
then we get extreme contrast stretching which is called as
thresholding
(a) (b) (c)
Thresholding graphs for different values of threshold (T)
Concept of Thresholding :
31. The formulation for the output image S is given by,
S = 0 , r ≤ T
L – 1 , r > T
The above transformation is useful when one needs to separate
bright objects of interest from a darker background.
Note that a thresholded image is a low contrast image as it has only
black & white grey levels (0 & L - 1).
The values of T can be chosen depending on application & viewer.
Concept of Thresholding
:
32. (a) Original image (b) Image after thresholding
r1 = r2 = 100
s1 = 0, s2 = 255
Another example of image thresholding is given below.
(a) Original image (b) Image after thresholding
Concept of Thresholding :
33. Histogram Processing
What is histogram? :
A graphical display of numerical data in the form of upright bars,
with the area of each bar representing frequency
Definition :
“Histogram of an image represents the relative frequently of
occurrence of the various grey levels in an image.
How to Plot Histogram ?
(1) As already said, “histogram is a plot of number of grey
levels in an image to the respective number of pixels in
image to that grey level.”
(2)∴ x–axis → Grey levels
y–axis → Numbers of pixels in each grey levels.
34.
35.
36. Thus it is a plot of nk verses rk. Many a times it is also a plot of P(rk)
verses rk
Where, P(rk ) = Probability of occurrence of that grey levels.
P(rk ) = nk/n
rk=kth grey level
nk=Number of pixel in the kth grey level
n=Total number of pixels in an image
The histogram thus plotted will be known as normalize histogram
(since nk is divided by n i.e. normalised by n- number of
pixels.)
Example
38. What Information do we get from Histogram ?
Histogram is Discrete !!! (not continuous) !!!
• Thus histogram of a digital image with grey levels
(0 to L–1) is a discrete function nk plotted against r.
• The histogram of a whole image contains global
description of the appearance of the picture. Just
by looking at the histogram of the image, great deal
of information can be obtained.
• For example, we can get the basic grey level
characteristics. i.e.
(i) Dark
(ii) Light
(iii) Low contrast
(iv) High contrast
39. Smoothing Filters
Smoothing filters are used for blurring and noise
reduction
Blurring :
Used for removal of small details from an image prior
to object extraction and bridging of small gaps in
lines or curves.
Noise reduction :
is achieved by blurring with an linear filter.
40. Smoothing Linear Filter (Low pass
spatial filtering)
As discussed earlier, low pass filter smoothes and removes
the sharp edges and thus smoothing operation is also called
as low pass filtering operation.
A low pass filter, as the name suggests reduces or eliminate
high frequency components while leaving low frequencies
untouched
(Noise is normally a high frequency signal and low pass
filtering removes this noise.)
High frequency components characterize edges and other
sharp details in an image and so the overall effect of low pass
filtering is image blurring.
41. Concept behind smoothing
The output of smoothing linear spatial filter is
simply the average of pixels contained in the
neighborhood of the filter mark. Therefore this
filters are generally called as averaging filters.
We replace the value of every pixel in an image by
the average of the gray levels in the neighborhood
defined by the filter mask. This results in an image
which reduces sharp transition in grey levels.
42. Advantages :
Noise typically has sharp transitions in gray levels
=> they are high frequency signals. This smoothing
operation helps in noise reduction.
Reduction of ‘irrelevant detail’
Disadvantages :
For application where sharp edges are important,
averaging filters (smoothing filter) have undesirable
side effect of blurring the edges which is not good.
43. Smoothing Spatial Filters
One of the simplest spatial filtering operations we can perform
is a smoothing operation
– Simply average all of the pixels in a
neighbourhood around a central value
– Especially useful
in removing noise
from images
– Also useful for
highlighting gross
detail
1
/9 1
/9 1
/9
1
/9 1
/9 1
/9
1
/9 1
/9 1
/9
Simple
averaging filter
44. Smoothing Spatial Filtering
1
/9 1
/9 1
/9
1
/9 1
/9 1
/9
1
/9 1
/9 1
/9
Origin x
y Image f (x, y)
e = 1/9*106 +
1/9*104 + 1/9*100 + 1/9*108 +
1/9*99 + 1/9*98 +
1/9*95 + 1/9*90 + 1/9*85
Filte
r
Simple
3*3
Neighbourhoo
d
106
10
4
9
9
9
5
10
0
10
8
9
8
9
0
8
5
1
/9 1
/9 1
/9
1
/9
1
/9 1
/9
1
/9 1
/9 1
/9
3*3
Smoothing
Filt
er
104 100 108
99 106 98
95 90 85
Original
Image
Pixels
*
= 98.3333
The above is repeated for every pixel in the
original image to generate the smoothed
45. Weighted Smoothing
Filters
More effective smoothing filters can be
generated by allowing different pixels in
the neighbourhood different weights in
the averaging
function
– Pixels closer to the
central pixel are
more important
– Often referred to as
a
weighted averaging
1/16 2/16 1/16
2/16 4/16 2/16
1/16 2/16 1/16
Weighted
averaging filter
46. Spatial filtering for image sharpening
Operation of Image Differentiation
• Enhance edges and discontinuities (magnitude of
output gray level >>0)
• De-emphasize areas with slowly varying gray-level
values (output gray level: 0)
Mathematical Basis of Filtering for Image Sharpening
• First-order and second-order derivatives
• Approximation in discrete-space domain
• Implementation by mask filtering
50. Various situations encountered for
derivatives
• Ramps or steps in the 1D profile normally characterize
the edges in an image
• f ″ is nonzero at the onset and end of the ramp:
produce thin (double) edges
• f ′ is nonzero along the entire ramp produce thick
edges
52. Comparison between f" and f´
• f´ generally produce thicker edges in an image
• f" have a stronger response to fine detail
• f´ generally have a stronger response to a gray-level step
• f" produces a double response at step changes in gray level
• f" responses given similar changes in gray-level values line >
point > step
• For image enhancement, f" is generally better suited than f´
• Major application of f´ is for edge extraction;
f´ used together with f" results in impressive enhancement
effect
12/10/2023
Digital Image Processing 52
58. Laplacian Operator
• Applying the laplacian to an image we get a new
image that highlight edges and other discontinuities.
59. But That Is Not Very Enhanced
• The result of a Laplacian filtering is
not an enhanced image.
• We have to do more work in order to
get our final image
• Subtract the Laplacian result from the
original image to generate our final sharpened enhanced
image.
61. The Gradient (1st order derivative)
• First Derivatives in image processing are implemented
using the magnitude of the gradient.
• The gradient of function f(x,y) is
62. Gradient
• The magnitude of this vector is given by
-1 1
1
-1
Gx
Gy
This mask is simple, and no isotropic.
Its result only horizontal and vertical.
63. Robert’s Method
• The simplest approximations to a first-order
derivative that satisfy the conditions stated in that
section are
z1 z2 z3
z4 z5 z6
z7 z8 z9
Gx = (z9-z5) and Gy = (z8-z6)
64. Robert’s Method
• These mask are referred to as the Roberts cross-
gradient operators.
-1 0
0 1
-1
0
0
1
65. Sobel’s Method
• Mask of even size are awkward to apply.
• The smallest filter mask should be 3x3.
• The difference between the third and first rows of the 3x3
mage region approximate derivative in x-direction, and the
difference between the third and first column approximate
derivative in y-direction.