You are on page 1of 51

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

 Image Enhancement Methods


 Spatial Domain: Direct manipulation of pixels in an image
 Frequency Domain: Process the image by modifying the Fourier transform of an image

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 ) 

f (x, y) = the input image


g (x, y) = the processed/output image
T = some operator defined over some neighbourhood of (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

 r = gray level of f at (x,y)


 s = gray level of g at (x,y)

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

0 127 255 ... ...


input value input output
13
Point Processing using Look-up Tables

input output
... ...
cell index

... ...

contents
aapixel
pixelwith
with isismapped
mappedto to
this
thisvalue
value
... ... this
thisvalue
value
... ...

14
POINT PROCESSING

Contrast Stretching Thresholding

18
Point Processing Example:
Thresholding

1.0 r > threshold


s=
0.0 r <= threshold

19
Point Processing Example:
Thresholding
 Segmentation of an object of interest from a
background

1.0 r > threshold


s=
0.0 r <= threshold

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

 nth power/nth root

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

input image the range of


gray levels is compressed

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

Fourier spectrum: image values The result of log transformation


ranging from 0 to 1.5x106 with c = 1

28
Power Law Transformations
 Power law transformations have the following form

 Map a narrow range


of dark input values
into a wider range of
output values or vice

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)

 A variety of devices (image capture, printing, display) respond


according to a power law and need to be corrected

 Gamma () correction


The process used to correct the power-law response
phenomena

30
Power Law Transformations: Gamma
Correction

31
Power Law Transformations
Contrast Enhancement

The images to the


right show a magnetic
resonance (MR)
image of a fractured
human spine

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

MR image of Result after Result after Result after


fractured human spine Power law Power law Power law
transformation transformation transformation
c = 1,  = 0.6 c = 1,  = 0.4 c = 1,  = 0.3
36
Power Law Transformations
Contrast Enhancement

When the γ is reduced too


much, the image begins to
reduce contrast to the
point where the image
started to have very slight
“wash-out” look.

37
Power Law Transformations
Contrast Enhancement

Image has a washed-out


appearance – needs γ > 1

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

 Intensity level slicing

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

 If r1 = s1 & r2 = s2, no change in gray levels


 If r1 = r2, s1 = 0 & s2 = L-1, then it is a threshold function. The
resulting image is binary
41
Contrast Stretching

rr1 ==rrmin &&ss1 ==00


1 min 1
rr2 ==rrmax &&ss2 ==L-1
L-1
2 max 2

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

• 3.1 Image Enhancement &


Transformations
• 3.2 Basic Intensity
Transformation Functions
• 3.3 Histogram
Acknowledgements
 Statistical Pattern Recognition: A Review – A.K Jain et al., PAMI (22) 2000

Material in these slides has been taken from, the following resources

Pattern Recognition and Analysis Course – A.K. Jain, MSU


 Pattern Classification” by Duda et al., John Wiley & Sons.
 Digital Image Processing”, Rafael C. Gonzalez & Richard E. Woods, Addison-Wesley, 2002
 Machine Vision: Automated Visual Inspection and Robot Vision”, David Vernon, Prentice Hall,
1991
 www.eu.aibo.com/
 Advances in Human Computer Interaction, Shane Pinder, InTech, Austria, October 2008

51

You might also like