UNIT 2 IMAGE
ENHANCEMENT
•Key Terms:
Enhancement is the process of manipulating an image
result is more suitable than the original for a specific
so that the
• application.
Spatial domain: It refers to the image plane itself, image
processing
methods in this category are based on direct
manipulation of pixels
in an image.
• Transform domain: Image is transformed to transform
domain
• using particular
Intensity transform,and
transformations processing being done
spatial filtering are there,
then
two main
inverse transform
principals applied
in spatial to back the spatial domain. In
domain.
transform 2
Image Enhancement
•Examples
Contrast
Enhancement
• Edge Enhancement
• Noise Filtering
•• Sharpening
Magnifying
4
Image
Enhancement
5
Point
Processing
6
Spatial
Filtering/Neighborhood
7
Global
Processing
8
Spatial Domain
Techniques
9
Image Enhancement-Spatial
• Domain
Intensity transformation works directly on individual
pixels,
where as in spatial filtering, neighborhood of every
• pixel willdomain processes based on the following
Spatial
be considered for filtering. Ex. Image Smoothening.
equation:
where f(x,y) is the input image, g(x,y) is the output
image. T is
an operator on f defined over a neighborhood of
point (x,y). 10
Defining
Neighborhood
• The neighborhood is
moved from pixel to
pixel, operator T on
the
pixels yield the
output
• If at
the neighborhood
the location.
is at
border, it will
neglected be
or “0s”
will be
padded.
11
Intensity transformation and Spatial
filtering
• The procedure which described in previous is called
spatial
filtering. Also referred to as a spatial mask, kernel,
template, or window.
• The smallest possible neighborhood is of size 1 × 1.
In this
case, g depends only on the value of f at a single
point ( x , y ) 푠 = 푇
and T. This is called 푟
as
where are variables denoting intensity (gray-level
intensity or
of g and
푓mapping)
at point
푥transformation.
, 푦 respectively. 12
Intensity transformation and
Spatial
filtering
13
Types of Gray Level
Transformation
14
Intensity
transformation
15
Image
Negatives
• The negative of an image with intensity levels in
the
range 0, 퐿 − 1 is obtained by using the negative
transformation function here in the expression.
푠 = 퐿− 1− 푟
• Reversing the intensity levels of a digital image in
this
manner produces the equivalent of a
photographic
negative.
• This type of processing is used, for example, in 16
Image
Negatives
The original image is a digital mammogram showing a
small lesion
17
Log
Transformations
• The general form of the log
is
transformation
푠 = 푐 log 1
where c is a + 푟
constant and it is
assumed that
•r This
≥ 0. transformation maps a narrow
range
of low intensity values in the input
• into
The alog function has the
wider range of output levels.
important
characteristic that it compresses
the
dynamic range of pixel values. 18
Power-Law (Gamma)
• Transformations
Power-law transformations
have
the form 푠 = 푐푟 훾 where c
• and ꢀ are
The response of many devices
positive constants.
used
for image capture, printing,
• and
The exponent in a power-law
display
equationobey a power
is referred tolaw.
as
gamma.
The process used to correct
these
power-law response
phenomena is
called gamma correction or 19
Power-Law (Gamma)
Transformations
20
Power-Law (Gamma)
Transformations
21
22
23
24
Piece-wise
transformation
25
Piece-wise
transformation
26
Contrast
Stretching
• Low-contrast images can result from poor illumination, lack
of dynamic
range in the imaging sensor, or even the wrong setting of a
• lens
Contrast stretching expands the range of intensity levels in
anaperture
image soduring image acquisition.
that it spans the ideal full intensity range of the recording
medium or
display device.
27
Contrast
Stretching
28
Intensity-Level
•Slicing
There are
applications
in which it is of
interest
to highlight a
• specific
Some of
range of intensities
applications
these include
in
enhancing features
an
in image.
satellite imagery,
such
as masses of water,
and
enhancing flaws in
29
X-
Intensity-Level
Slicing
30
Bit-Plane
Slicing
• Pixel values are integers composed
of bits. Values in a 256-level
grayscale image are composed of 8
bits.
• Instead of highlighting intensity-
level ranges, we could highlight the
contribution made to total image
appearance by specific bits.
• An 8-bit image may be considered
as being composed of eight one-bit
planes, with plane 1 containing the
lowest-order bit of all pixels in the
image, and plane 8 all the highest-
order bits. 31
Bit-Plane
Slicing
32
Basics of Spatial
filtering
33
Basics of Spatial
filtering
34
Types of Spatial
filtering
35
Smoothing
• Smoothing is the process of reducing “sharp”
filters
in the gray levels of an
transitions
• image.
The important uses of
smoothing are,
. Removal of small details from an image
• Blurring:
extractio
before object
. Bridging
n of small gaps in lines or
curves
• Noise reduction:
. Linear or Averaging Filters
. Non-Linear or Order-Statistics
Filters
36
Smoothing by Linear
Filters
37
Smoothing by Linear
Filters
38
39
40
Applications
• Noise reduction
• Smoothing of false contours i.e outlines
• Blurring an image to highlight the objects of
interest
• Reducing irrelevant detail in the image
Drawbacks
• Edges of an image will have sharp transitions
which are
very important for the image. The smoothing
process blur
the edges which is undesired. 41
Smoothing by Non-Linear
Filters
42
43
Application
s
44
Sharpening Spatial
filters
45
Sharpening Spatial
filters
46
Sharpening Spatial
filters
• A basic definition of the first-order derivative of a one-
function f (x) is the
dimensional
difference
• We define the second-order derivative of f (x) as the
difference
47
Second Order derivatives
(or)
Laplacian Operators
48
Laplacian
Operators Filter mask used to implement the
digital Laplacian
49
Laplacian
Operators
50
51
Unsharp and High Boost
•Filtering
Subtracting an unsharp (smoothed) version of an
original
image the called unsharp
image
from
• masking.
The following are the
steps:
If k >1, High Boost Filtering, K=1 Unsharp 52
Filtering
Unsharp and High Boost
Filtering
53
Unsharp and High Boost Filtering
Example
54
First Order derivatives (or)
Gradient
Operators
55
Robert’s Cross
Operator
56
Sobel’s
Operator
57
Prewitt’s
Operator
58
Application of Gradient
Operators
59
Gradient using Sopel
Operator
60
Histogram
Processing
• The
gray
histogram of an image is a plot of the number of occurrences of
image against
levels in thethe gray-level
values.
• The histogram provides a convenient summary of the intensities in an
unablebut
image, to it
convey
is any information regarding spatial relationships
• between pixels.provides more insight about image contrast and
The histogram
brightnessImage
brightness. may be improved by modifying the histogram of
1.the
Theimage.
histogram of a dark image will be clustered towards the lower gray level.
2. The histogram of a bright image will be clustered towards higher gray level.
3. For a low-contrast image, the histogram will not be spread equally, that is, the
histogram will be narrow.
4. For a high-contrast image, the histogram will have an equal spread in the gray
level.
61
Why
Histograms?
• To reveal underexposed or over exposed
image in
objects
• sTo provide visual information for
statistical properties of
evaluating
• images
Information derived from histograms are
imagefor
useful processing
applications
62
Histogram
Example
63
Histogram
Processing
64
Histogram
Processing
• Mostly, we work with normalized histograms, which we refer to
simply as or image histograms.
histograms
• The sum of 푝푘 푟 for all values of k is always 1. The 푘
components
estimates ofofthe
푝 probabilities of intensity levels occurring in
an image. are simple to compute and are also suitable for fast
• Histograms
hardware
implementations, thus making histogram-based techniques a
• popular
Histogramtool for is related to image appearance. For example,
shape
real-time
Figure image processing.
in next
slide shows images with four basic intensity characteristics: dark,
light, low
contrast, and high contrast; the image histograms are also
shown. 65
66
67
Histogram
Equalization
68
Histogram
Equalization
69
Histogram
Equalization
70
Histogram
Equalization
71
Histogram
Equalization
72
Advantag
es
73
Uses of Histogram
Parameters
• Some statistical parameters directly obtained
histogra
from image
m:
• Moment
• Mean
• Variance and
• standard
deviation
74
Frequency Domain
Filtering
75
Frequency Domain
Filters
86
Basics of Fourier
Transform
76
Basics of Fourier
Transform
77
Basics of Fourier
Transform
78
Basics of Fourier
Transform
79
Steps in Frequency Domain
Filtering
80
Steps in Frequency Domain
Filtering
81
Steps in Frequency Domain
Filtering
82
Steps in Frequency Domain
Filtering
83
Steps in Frequency Domain
Filtering
84
Steps in Frequency Domain
Filtering
85
Frequency Domain
Filters
86
Frequency Domain
Filters
87
Ideal
LPF
88
Ideal
LPF
• (a) Perspective plot of an ideal lowpass-filter transfer function. (b) Function displayed as an image.
• (c) Radial cross section.
89
(a) Original image of size 688 × 688 pixels. (b)–(f) Results of filtering using ILPFs with cutoff
frequencies set at radii
values 10, 30, 60, 160, and 460, as shown in Fig. 4.40(b). The power removed by these filters
was 13.1, 7.2, 4.9, 2.4,
and 0.6% of the total, respectively. We used mirror padding to avoid the black borders 90
characteristic of zero padding,
Spatial
Representation
(a) Frequency domain ILPF transfer function. (b) Corresponding spatial domain kernel function. (c) Intensity profile
of a horizontal line through the center of (b).
91
Butterworth
LPF
(a) Perspective plot of a Butterworth lowpass-filter transfer function. (b) Function displayed as an
image.
(c) Radial cross sections of BLPFs of orders 1 through 4.
92
• (a) Original image of size 688 ×
688 pixels. (b)–(f) Results of
filtering using BLPFs with cutoff
frequencies at the radii shown in
Fig. and n = 2.25. We used
mirror padding to avoid the
black borders characteristic of
zero padding.
93
Spatial
Representation
(a)–(d) Spatial representations (i.e., spatial kernels) corresponding to BLPF transfer
functions of size 1000 × 1000
pixels, cut-off frequency of 5, and order 1, 2, 5, and 20, respectively. (e)–(h) Corresponding
intensity profiles
through the center of the filter functions. 94
Gaussian
LPF
(a) Perspective plot of a GLPF transfer function. (b) Function displayed as an
image. (c) Radial cross
sections for various values
of D0 .
95
(a) Original image of size 688
× 688 pixels. (b)–(f) Results of
filtering using GLPFs with
cutoff frequencies at the radii
shown in Fig. We used mirror
padding to avoid the black
borders characteristic of zero
padding.
96
Transfer functions of smoothing
filters
97
Sharpening
Filters
Subtracting a lowpass filter transfer function from 1 yields the
corresponding highpass filter transfer function in the frequency
domain:
• An ideal highpass filter (IHPF) transfer function is given by
98
• Top row: Perspective
plot, image, and, radial
cross section of an IHPF
transfer function.
• Middle and bottom rows:
The same sequence for
GHPF and BHPF transfer
functions.
99
100
• Top row: The
image
from Fig. filtered
with
IHPF, GHPF,
functions andD0
using
= 60 transfer
BHPF
in all cases (n = 2
for
• Second
the BHPF).
row:
Same sequence, but
using
D0 = 160.
101
SELECTIVE FILTERING
There are applications to process specific bands of frequencies or
small regions of the frequency rectangle.
Filters in the first category are called band filters.
If frequencies in the band are filtered out called a bandreject filter.
If the frequencies are passed, the filter is called a bandpass filter.
Filters in the second category are called notch filters.
These filters are further qualified as being notch reject or notch pass
filters, depending on whether frequencies in the notch areas are
rejected or passed.
In image processing, a "band pass filter" allows only a
specific range of frequencies to pass through an image,
highlighting features like edges or details within that
frequency band.
In image processing a "band reject filter" blocks a specific
range of frequencies, effectively removing unwanted
details like noise within that band from the image;
A band pass filter isolates certain features based on their
frequency, while a band reject filter removes specific
frequency components from an image.
BANDPASS_FILTER
The BANDPASS_FILTER function applies a
lowpass, bandpass, or highpass filter to a one-
channel image.
A bandpass filter is useful when the general
location of the noise in the frequency domain
is known.
The bandpass filter allows frequencies within
the chosen range through and attenuates
The following diagrams give a visual interpretation of the
transfer functions:
IDEAL
This keyword to use an ideal bandpass filter.
In ideal bandpass filters, frequencies within the given range are passed through
without attenuation and frequencies outside of the given range are completely
removed.
This behavior makes ideal bandpass filters very sharp.
The centered Fast Fourier Transform (FFT) is filtered by the following function,
where DL is the lower bound of the frequency band, DH is the upper bound of the
frequency band, and D(u,v) is the distance between a point (u,v) in the frequency
domain and the center of the frequency rectangle:
BUTTERWORTH
This keyword to the dimension of the Butterworth filter to apply to the
frequency domain.
With a Butterworth bandpass filter, frequencies at the center of the
frequency band are unattenuated and frequencies at the edge of the
band are attenuated by a fraction of the maximum value.
The Butterworth filter does not have sharp discontinuities between
frequencies that are passed and filtered.
The default for BANDPASS_FILTER is BUTTERWORTH=1.
The centered FFT is filtered by one of the following functions,
where D0 is the center of the frequency band, W is the width of the
frequency band, D=D(u,v) is the distance between a point (u,v) in the
frequency domain and the center of the frequency rectangle, and n is
the dimension of the Butterworth filter:
GAUSSIAN
This keyword to use a Gaussian bandpass filter.
In this type of filter, the transition between unfiltered and filtered
frequencies is very smooth.
The centered FFT is filtered by one of the following functions,
where D0 is the center of the frequency band, W is the width of the
frequency band, and D=D(u,v) is the distance between a
point (u,v) in the frequency domain and the center of the frequency
rectangle:
BANDREJECT_FILTER
The BANDREJECT_FILTER function applies a low-reject, high-
reject, or band-reject filter on a one-channel image.
A band reject filter is useful when the general location of the
noise in the frequency domain is known.
A band reject filter blocks frequencies within the chosen range
and lets frequencies outside of the range pass through.
The following diagrams give a visual interpretation of the
transfer functions:
IDEAL
This keyword to use an ideal band reject filter.
In this type of filter, frequencies outside of the given range are
passed without attenuation and frequencies inside of the given
range are blocked.
This behavior makes ideal band reject filters very sharp.
The centered Fast Fourier Transform (FFT) is filtered by the
following function, where DL is the lower bound of the frequency
band, DH is the upper bound of the frequency band, and D(u,v) is
the distance between a point (u,v) in the frequency domain and the
center of the frequency rectangle:
BUTTERWORTH
This keyword to the dimension of the Butterworth filter to apply to the frequency
domain.
With a Butterworth band reject filter, frequencies at the center of the frequency band
are completely blocked and frequencies at the edge of the band are attenuated by a
fraction of the maximum value.
The Butterworth filter does not have any sharp discontinuities between passed and
filtered frequencies.
Note: The default for BANDREJECT_FILTER is BUTTERWORTH=1.
The centered FFT is filtered by one of the following functions, where D0 is the center of
the frequency band, W is the width of the frequency band, D=D(u,v) is the distance
between a point (u,v) in the frequency domain and the center of the frequency
rectangle, and n is the dimension of the Butterworth filter:
Note: A low Butterworth dimension is close to Gaussian, and a high Butterworth dimension is close to Ideal.
GAUSSIAN
This keyword to use a Gaussian band reject filter.
In this type of filter, the transition between unfiltered and filtered
frequencies is very smooth.
The centered FFT is filtered by one of the following functions,
where D0 is the center of the frequency band, W is the width of the
frequency band, and D=D(u,v) is the distance between a point (u,v) in
the frequency domain and the center of the frequency rectangle:
Notch Filter
Notch filters are band-reject filters or stop-band filters designed to
provide maximum attenuation or rejection to a particular range of
frequencies for an image.
A band-reject filter with a narrow stop band is usually known as a
notch filter.
The notch filter has two regions
Passband region: frequency range with minimum attenuation level (typically close to 0 dB).
Reference
s:
• R.C. Gonzalez & R.E. Woods, Digital Image Processing, Addison
Wesley/Pearson education, 3rd
• edition, 2010.S Esakkirajan, T Veerakumar, Digital Image processing,
S Jayaraman,
Tata McGraw Hill,
• 1stedition, 2009.
NPTEL :: Electronics & Communication Engineering - NOC:Digital
Image Processing
139