Lect-4 Digital Image Processing
Lect-4 Digital Image Processing
Lecture # 4
Spatial Enhancement-I
1
Image Enhancement
4
Image Enhancement
5
Image Enhancement
6
Image Enhancement
Process
Processan
animage
imageso
sothat
thatthe
theresult
resultisismore
moresuitable
suitablethan
thanthe
theoriginal
originalimage
imagefor
foraa
specific
specificapplication
application
This
ThisChapter
Chapter––Spatial
SpatialDomain
Domain
7
Types of image enhancement
operations
8
Types of image enhancement
operations
Point/Pixel operations
Output value at specific coordinates
(x,y) is dependent only on the input
value at (x,y)
Local operations
The output value at (x,y) is dependent
on the input values in the
neighborhood of (x,y)
Global operations
The output value at (x,y) is dependent
on all the values in the input image
9
Basic Concepts
Most spatial domain enhancement
operations can be generalized as:
g ( x, y ) T f ( x, y )
10
Point Processing
In
In aa digital
digital image,
image, point
point == pixel
pixel
Point
Point processing
processing transforms
transforms aa
pixel’s
pixel’s value
value asas function
function of
of its
its
value
value alone;
alone;
ItIt does
does not
not depend
depend on on the
the values
values
of
of the
the pixel’s
pixel’s neighbors.
neighbors.
11
Point Processing
Neighborhood of size 1x1:
g depends only on f at (x,y)
T: Gray-level/intensity transformation/ mapping function
s T (r )
12
Point Processing using Look-up Tables
AAlook-up
look-uptable
table(LUT)
(LUT)
implements
implementsaafunctional
functional
mapping.
mapping.
E.g.: index value
255
... ...
101 64
output value
102 68
127
103 69
104 70
105 70
106 71
0
input output
... ...
cell index
... ...
contents
aapixel
pixelwith
with isismapped
mappedto to
this
thisvalue
value
... ... this
thisvalue
value
... ...
14
POINT PROCESSING
18
Point Processing Example:
Thresholding
19
Point Processing Example:
Thresholding
Segmentation of an object of interest from a
background
20
Point Processing Example:
Intensity Scaling
s T (r ) a.r
21
Point Processing Transformations
There are many different kinds of grey level transformations
Three of the most
common are shown
here
Linear
Negative/Identity
Logarithmic
Log/Inverse log
Power law
22
Point Processing Example:
Negative Images
Reverses the gray level order
For L gray levels, the transformation has the form:
Negative images are useful for enhancing white or grey detail embedded in dark regions of an image
s ( L 1) r
23
Point Processing Example:
Negative Images
24
Logarithmic Transformations
The general form of the log transformation is
s c log(1 r )
The log transformation maps a narrow range of low input grey level values into a wider range of output values
The inverse log transformation performs the opposite transformation
25
Logarithmic Transformations
Properties
For lower amplitudes of
input image the range of
gray levels is expanded
For higher amplitudes of
26
Logarithmic Transformations
Application
This transformation is suitable for the case when the dynamic range of a processed image far exceeds the capability
of the display device (e.g. display of the Fourier spectrum of an image)
Also called “dynamic-range compression / expansion”
27
Logarithmic Transformations
28
Power Law Transformations
Power law transformations have the following form
s c r
versa
Varying γ gives a whole
family of curves
29
Power Law Transformations
For < 1: Expands values of dark pixels, compress
values of brighter pixels
For > 1: Compresses values of dark pixels, expand
values of brighter pixels
If =1 & c=1: Identity transformation (s = r)
30
Power Law Transformations: Gamma
Correction
31
Power Law Transformations
Contrast Enhancement
32
Power Law Transformations
Contrast Enhancement
γ = 0.6
1
0.9
0.8
Transformed Intensities
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Old Intensities
33
Power Law Transformations
Contrast Enhancement
γ = 0.4
1
0.9
Transformed Intensities
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Original Intensities
34
Power Law Transformations
Contrast Enhancement
γ = 0.3
1
0.9
Transformed Intensities
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1
Original Intensities
35
Power Law Transformations
Contrast Enhancement
37
Power Law Transformations
Contrast Enhancement
38
Image Enhancement
Aerial Result of
Power law
Image
transformation
c = 1, = 3.0
(suitable)
Result of
Power law
Result of transformation
Power law c = 1, = 5.0
transformation (high contrast,
c = 1, = 4.0 some regions are
(suitable) too dark)
39
Piecewise Linear Transformation
Functions
Contrast stretching
40
Contrast Stretching
Objective
Increase the dynamic range of the gray levels for low contrast images
Rather than using a well defined mathematical function we
can use arbitrary user-defined transforms
42
Contrast Stretching
43
Grey Level Slicing
Highlights range
[A,B] of gray Highlights range
levels and reduces [A,B] but
all others to a preserves all
contrast level other gray
levels
44
Grey Level Slicing
45
Histogram of a Grayscale Image
46
Histogram of a Grayscale Image
Let
Let II be
be aa 1-band
1-band (grayscale)
(grayscale) image.
image.
I(r,c)
I(r,c) is
is an
an 8-bit
8-bit integer
integer between
between 00 and
and
255.
255.
Histogram,
Histogram, hhI,I, of
of I:I:
aa256-element
256-elementarray,
array,hhI I
hhI (g) = number of pixels in I that have value g.
I (g) = number of pixels in I that have value g.
for
for gg==0,1,
0,1,2,
2, 3,
3,…,
…, 255
255
47
HISTOGRAM
• A discrete function h(rk)=nk
– rk is the kth gray level
– nk is the number of pixels having gray level rk in the
image
• Ex:
nk
6
5
0 1 2 3 4
1 3 3 0 3
0 1 3 0 2
1
3 0 3 1 rk
0 1 2 3
48
UNIQUENESS
49
Readings from Book (3 Edn.)
rd
51