3 - Image Enhancement in Spatial Domain-I
3 - Image Enhancement in Spatial Domain-I
Domain
2
of
92
Digital image representation
Monochrome image (or simply image) refers to a
2- dimensional light intensity function f(x,y)
– x and y denote spatial coordinates
– the value of f(x,y) at (x,y) is proportional to the brightness
(or gray level) of the image at that point
3
of
92
Digital image representation
A digital image is an image f(x,y) that has been
discretized both in spatial coordinates and in
brightness
• Considered as a matrix whose row and column
indices represent a point in the image
• The corresponding matrix element value
represents the gray level at that point
• The elements of such an array are referred to as:
– image elements
– picture elements (pixels or pels)
4
of
92
Steps in image processing
The problem domain in this example consists of pieces of mail
and the objective is to read the address on each piece
Step 1: image acquisition
– Acquire a digital image using an image sensor
• a monochrome or color TV camera: produces an entire image of the
problem domain every 1/30 second
• a line-scan camera: produces a single image line at a time, motion past the
camera produces a 2-dimensional image
– If not digital, an analog-to-digital conversion process is required
– The nature of the image sensor (and the produced image) are
determined by the application
• Mail reading applications rely greatly on line-scan cameras
• CCD and CMOS imaging sensors are very common in many applications
5
of
92
Steps in image processing
• Step 2: preprocessing
– Key function: improve the image in ways that increase the
chance for success of the other processes
– In the mail example, may deal with contrast enhancement,
removing noise, and isolating regions whose texture indicates a
likelihood of alphanumeric information
6
of
Neighborhood-oriented
92
operations
• Arithmetic and logical operations may take place on a
subset of the image
– Typically neighborhood oriented
• Formulated in the context of mask operations (also
called template, window or filter operations)
• Basic concept:let the value of a pixel be a function of its
(current) gray level and the gray level of its neighbors (in
some sense)
7
of
Neighborhood-oriented
92
operations
• Consider the following subset of pixels in an image
• Suppose we want to filter the image by replacing the value at
Z5 with the average value of the pixels in a 3x3 region centered
around Z5
• Perform an operation of the form:
of
92
10
Image Enhancement Examples
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
11
92
Image Enhancement Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
12
Image Enhancement Examples (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
13
Image Enhancement Examples (cont…)
14
of
92
Spatial & Frequency Domains
There are two broad categories of image
enhancement techniques
– Spatial domain techniques
• Direct manipulation of image pixels
– Frequency domain techniques
• Manipulation of Fourier transform or wavelet
transform of an image
For the moment we will concentrate on
techniques that operate in the spatial
domain
15
of
Basic Spatial Domain Image
92 Enhancement
Most spatial domain enhancement operations
can be reduced to the form
Origin x
g (x, y) = T[ f (x, y)]
where f (x, y) is the
input image, g (x, y) is
the processed image (x, y)
and T is some
operator defined over
some neighbourhood
of (x, y) y Image f (x, y)
16
of
92
Point Processing
The simplest spatial domain operations
occur when the neighbourhood is simply the
pixel itself
In this case T is referred to as a grey level
transformation function or a point processing
operation
Point processing operations take the form
s=T(r)
where s refers to the processed image pixel
value and r refers to the original image pixel
value
17
of
Point Processing Example:
92 Negative Images
Negative images are useful for enhancing
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Original Negative
s = 1.0 - r
Image Image
18
of
Point Processing Example:
92 Negative Images (cont…)
Original Image Enhanced Image x
x
s = intensitymax - r
19
of
Point Processing Example:
92 Thresholding
Thresholding transformations are particularly
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
21
Intensity Transformations
22
of
92
Basic Grey Level Transformations
There are many different kinds of grey level
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
transformations
Three of the most
common are shown
here
– Linear
• Negative/Identity
– Logarithmic
• Log/Inverse log
– Power law
• nth power/nth root
23
of
92
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
Compresses the dynamic range of images
with large variations in pixel values
24
of
92
Logarithmic Transformations (cont…)
s = log(1 + r)
25
of
92
Logarithmic Transformations (cont…)
s = log(1 + r)
We usually set c to 1
Grey levels must be in the range [0.0, 1.0]
26
of
92
Power Law Transformations
Power law transformations have the following
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
form
s=c*rγ
Map a narrow range
of dark input values
into a wider range of
output values or vice
versa
Varying gives a whole
family of curves
27
of
92
Power Law Transformations (cont…)
Original Image Enhanced Image x
x
s=rγ
We usually set c to 1
Grey levels must be in the range [0.0, 1.0]
28
of
92
Power Law Example
29
of
92
Power Law Example (cont…)
γ = 0.6
1
Transformed Intensities
0.9
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
Old Intensities
30
of
92
Power Law Example (cont…)
γ = 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
31
of
92
Power Law Example (cont…)
γ = 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
32
of
92
Power Law Example (cont…)
The images to the
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
right show a
s = r 0.6
magnetic resonance
(MR) image of a
fractured human
s = r 0.4
spine
Different curves
highlight different
detail
33
of
92
Power Law Example
34
of
92
Power Law Example (cont…)
γ = 5.0
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
of
92
Power Law Transformations (cont…)
An aerial photo
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of a runway is
shown s = r 3.0
This time
power law
s = r 4.0
transforms are
used to darken
the image
Different curves
highlight
different detail
36
of
92
Gamma Correction
Many devices used for image capture, display and printing
respond according to a power law
• The exponent in the power-law equation is referred to as
gamma
• The process of correcting for the power-law response is
referred to as gamma correction
• Example: – CRT devices have an intensity-to-voltage
response that is
a power function (exponents typically range from 1.8-2.5)
– Gamma correction in this case could be achieved by
applying the transformation s=r1/2.5=r^0.4
37
of
92
Gamma Correction
Many of you might be familiar with gamma
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
38
More Contrast Issues
39
of
Piecewise Linear Transformation
92 Functions
Rather than using a well defined mathematical
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
– Similar to thresholding
– Other levels can be
suppressed or maintained
– Useful for highlighting features
in an image
43
of
92
Bit Plane Slicing
Often by isolating particular bits of the pixel
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
[10000000] [01000000]
[00100000] [00001000]
[00000100] [00000001]
45
of
92
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
[10000000] [01000000]
[00100000] [00001000]
[00000100] [00000001]
46
of
92
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
47
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
48
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
49
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
50
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
51
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
52
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
53
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
54
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of
92
55
Bit Plane Slicing (cont…)
56
of
92
Bit Plane Slicing (cont…)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Reconstructed image
using only bit planes 8 and
7
Reconstructed image
using only bit planes 8, 7
and 6
Reconstructed image
using only bit planes 7, 6
and 5