0% found this document useful (0 votes)
7 views

3 - Image Enhancement in Spatial Domain-I

Uploaded by

ribek37130
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

3 - Image Enhancement in Spatial Domain-I

Uploaded by

ribek37130
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

Image Enhancement in Spatial

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:

• and assign to z5 the value of z


8
of
Neighborhood-oriented
92
operations
• In the more general form, the operation may look like:

• This equation is widely used in image processing


• Proper selection of coefficients (weights) allows for operations
such as
– noise reduction
– region thinning
– edge detection
9
of
92
What Is Image Enhancement?
Image enhancement is the process of
making images more useful
The reasons for doing this include:
– Highlighting interesting detail in images
– Removing noise from images
– Making images more visually appealing
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

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)

white or grey detail embedded in dark


regions of an image
– Note how much clearer the tissue is in the
negative image of the mammogram below

Original Negative
s = 1.0 - r
Image Image
18
of
Point Processing Example:
92 Negative Images (cont…)
Original Image Enhanced Image x
x

y Image f (x, y) y Image f (x, y)

s = intensitymax - r
19
of
Point Processing Example:
92 Thresholding
Thresholding transformations are particularly
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

useful for segmentation in which we want to


isolate an object of interest from a
background

1.0 r > threshold


s=
0.0 r <= threshold
20
of
Point Processing Example:
92 Thresholding (cont…)
Original Image Enhanced Image x
x

y Image f (x, y) y Image f (x, y)

1.0 r > threshold


s=
0.0 r <= threshold
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…)

Log functions are particularly useful when


Images taken from Gonzalez & Woods, Digital Image Processing (2002)

the input grey level values may have an


extremely large range of values
In the following example the Fourier
transform of an image is put through a log
transform to reveal more detail

s = log(1 + r)
25
of
92
Logarithmic Transformations (cont…)

Original Image Enhanced Image x


x

y Image f (x, y) y Image f (x, y)

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

y Image f (x, y) y Image f (x, y)

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)

correction of computer monitors


Problem is that
display devices do
not respond linearly
to different
intensities
Can be corrected
using a log
transform
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)

function we can use arbitrary user-defined


transforms
The images below show a contrast stretching
linear transform to add contrast to a poor
quality image
40
of
Piecewise Linear Transformation
92 Functions
• Rather than using a well defined mathematical function we can use
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

arbitrary user-defined transforms


• Contrast stretching expands the range of intensity levels in an image so it
spans a given (full) intensity range
• Control points (r1,s1) and (r2,s2) control the shape of the transform T(r)
• r1=r2, s1=0 and s2=L-1 yields a thresholding function
The contrast stretched image shown in the previous slide is obtained using
the transformation obtained from the equation of the line having following
points
• (r1,s1)=(rmin,0) and (r2, s2)=(rmax,L-1)
41
of
92
Gray Level Slicing
• Used to highlight a specific range of intensities in an
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

image that might be of interest


•Two common approaches
– Set all pixel values within a range of interest to one
value (white) and all others to another value (black)
Produces a binary image
– Brighten (or darken) pixel values in a range of interest
and leave all others unchanged
42
of
92
Gray Level Slicing
Highlights a specific range of grey levels
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)

values in an image we can highlight


interesting aspects of that image
– Higher-order bits usually contain most of the
significant visual information
– Lower-order bits contain
subtle details
44
of
92
Bit Plane Slicing (cont…)
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

You might also like