Transformsch3 04 3
Transformsch3 04 3
in the
SPATIAL DOMAIN
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 ?
v = f(x,y)
Remember ?
T(f(x,y)) = f(x,y) / 2
T
f(x,y) g(x,y)
Spatial Domain
6 8 2 0 3 4 1 0
12 200 20 10 6 100 10 5
(Operator: Div. by 2)
Spatial Domain
12 200
6 8 2 0 226
12 200 20 10
Spatial Domain
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
• 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
s=L-1-r
Output gray level
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…)
s = log(1 + r)
We usually set c to 1
Grey levels must be in the range [0.0, 1.0]
Power Law Transformations
s=rγ
We usually set c to 1
Grey levels must be in the range [0.0, 1.0]
Gamma Correction
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
Thresholding Function
Two approaches:
(3, 8, 5)
Image histogram is a vector
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