0% found this document useful (0 votes)
13 views45 pages

Transformsch3 04 3

The document discusses image enhancement techniques in the spatial domain, focusing on methods to enhance hidden information and filter important features. It covers various transformations such as image negatives, logarithmic transformations, power law transformations, and piecewise linear transformations, including their applications and effects on image quality. Additionally, it addresses histogram processing and equalization as tools for improving image contrast and visibility.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views45 pages

Transformsch3 04 3

The document discusses image enhancement techniques in the spatial domain, focusing on methods to enhance hidden information and filter important features. It covers various transformations such as image negatives, logarithmic transformations, power law transformations, and piecewise linear transformations, including their applications and effects on image quality. Additionally, it addresses histogram processing and equalization as tools for improving image contrast and visibility.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 45

Image ENHANCEMENT

in the
SPATIAL DOMAIN

Based on Slides by Dr. Rolf Lakaemper


Most of these slides base on the
textbook

Digital Image Processing


by Gonzales/Woods/Eddins
Chapter 3
Introduction

Image Enhancement ?
• Enhance otherwise hidden information
• Filter important image features
• Discard unimportant image features

Spatial Domain ?
• Refers to the image plane (the ‘natural’
image)
• Direct image manipulation
Remember ?

A 2D gray value - image is a 2D -> 1D


function,

v = f(x,y)
Remember ?

As we have a function, we can apply


operators to this function, e.g.

T(f(x,y)) = f(x,y) / 2

Operator Image (= function !)


Remember ?

T transforms the given image f(x,y)


into another image g(x,y)

T
f(x,y) g(x,y)
Spatial Domain

The operator T can be defined over

• The set of pixels (x,y) of the image


• The set of ‘neighborhoods’ N(x,y) of
each pixel
• A set of images f1,f2,f3,…
Spatial Domain

Operation on the set of image-pixels

6 8 2 0 3 4 1 0
12 200 20 10 6 100 10 5

(Operator: Div. by 2)
Spatial Domain

Operation on the set of


‘neighbourhoods’ N(x,y) of each pixel
6 8 (Operator: sum)

12 200

6 8 2 0 226

12 200 20 10
Spatial Domain

Operation on a set of images f1,f2,…

6 8 2 0

12 200 20 10

(Operator: sum) 11 13 3 0
14 220 23 14

5 5 1 0
2 20 3 4
Spatial Domain

Operation on the set of image-pixels


Remark: these operations can also be seen as operations on the
neighborhood of a pixel (x,y), by defining the neighborhood as the
pixel itself.

• The easiest case of operators


• g(x,y) = T(f(x,y)) depends only on the value
of f at (x,y)
• T is called a

gray-level or intensity transformation


function
Transformations

Basic Gray Level Transformations

• Image Negatives
• Log Transformations
• Power Law Transformations
• Piecewise-Linear Transformation
Functions

For the following slides L denotes the max. possible gray value of the
image, i.e. f(x,y) [0,L]
Transformations

Image Negatives: s = L-1-r

s=L-1-r
Output gray level

Input gray level


Logarithmic Transformations
The general form of the log
transformation is
s = c * log(1 + r)
C is constant and r≥0

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

Expand the values of dark pixels and compress the higher level values
Logarithmic Transformations (cont…)
Log functions are particularly useful when 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)
Logarithmic Transformations (cont…)

Original Image x Enhanced Image 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]
Power Law Transformations

Power law transformations have the following 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
Application: Devices for image capture, printing, display
Power Law Transformations Contd...

• varying gamma () obtains family


of possible transformation curves
 > 1
• Compresses dark values
• Expands bright values
 < 1
• Expands dark values
• Compresses bright values
Power Law Transformations (cont…)
Original Image x Enhanced Image 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]
Gamma Correction

• CRT Intensity to voltage transformation: power function, γ = 1.8 to 2.5


• CRT produces image that are darker than the intended
• How do we ensure there is consistency in:
a)Images recorded by different cameras for given light input
b)Light emitted by different display devices for same image?
Gamma Correction Contd.

• What is the relation between:


Camera: Light on sensor vs. “intensity” of corresponding
pixel Display: Pixel intensity vs. light from that pixel

• Relation between pixel value and corresponding


physical quantity is usually complex, nonlinear
Gamma Correction Contd.

Gamma correction of computer monitors:

Problem is that
display devices do
not respond linearly
to different
intensities

Can be corrected
using a log
transform
Gamma Correction Contd.
Example: Power Law Targeting
Contrast Enhancement

Spine with a
fracture Dislocation
Power Law Example (cont…)

γ = 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
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
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
Power Law Example (cont…)


The images to the
right show a s = r 0.6
magnetic resonance
(MR) image of a
s=
fractured human

s = r 0.4
r 0.3
spine

Different curves
highlight different
detail
Another Power Law Example
Washed out Image: Compression of Intensity level is desirable
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
Power Law Transformations (cont…)


An aerial photo
of a runway is
shown s = r 3.0

This time
power law

s = r 4.0
s=
transforms are r 5.0
used to darken
the image

Different curves
highlight
different detail
Piecewise Linear Transformation Functions

Rather than using a well defined mathematical function we
can use arbitrary complex user-defined transforms
(Advantage).

The images shows a contrast stretching linear transform to
add contrast to a poor quality image.

If r1=s1, r2=s2, Linear and no change in intensity.

If r1=r2, s1=0 & s2=L-1: Transformation is thresholding
function to create binary image.

Intermediate values produce various degrees of spread in
the intensity level. Thus contrast is affected.

Here, r1 ≤ r2 and s1 ≤ s2, so the function is single valued and monotonically increased.
Contrast Stretching by (r1, s1) = (rmin, 0) and (r2, s2) = (rmax, L-1),
where rmin = minimum intensity level, rmax = maximum intensity level
Therefore stretching of intensity level to the full intensity range [0, L-1]

Thresholding function: (r1, s1) = (m, 0) and (r2, s2) = (m, L-1)
where m is the mean intensity level
Transformations

Piecewise Linear Transformations


Piecewise Linear Transformations

Thresholding Function

g(x,y) = L if f(x,y) > t,


0 else
t = ‘threshold level’
Output gray level

Input gray level


Piecewise Linear Transformations

Gray Level Slicing

Purpose: Highlight a specific range of grayvalues

Two approaches:

1. Display high value for range of interest, low value


else (‘discard background’)

2. Display high value for range of interest, original


value else (‘preserve background’)
Piecewise Linear Transformations

Gray Level Slicing


Image Histogram

(3, 8, 5)
Image histogram is a vector

If f:[1, n]x[1, m]  [0, 255] is a gray value image,


then H(f): [0, 255]  [0, n*m] is its histogram,
where H(f)(k) is the number of pixels (i, j) such that
F(i, j)=k

Similar images have similar histograms

Warning: Different images can have similar histograms

255
d H ( f ), H ( g )    H ( f )(i)  H ( g )(i)
2

i 0
Histograms

Histogram Processing
1 4 5 0

3 1 5 1
Number of Pixels

gray level
Hr

Hg Hb
Histogram Equalization
Let h=[n1, n2, …, nG] be an image histogram,
i.e., h(rk)=nk for rk is kth intensity level in interval [0,G]
Normalized histogram is a probability density function
(PDF) :
p(rk) = h(rk) / n = nk / n
- probability of occurrence of intensity level r k, where n is the
total number of pixels.
Equalized histogram is a cumulative distribution function
(CDP):

k k nj
T (rk )  p (rj ) 
j 1 j 1 n
k k nj
T (rk )  p (rj ) 
j 1 j 1 n

You might also like