Professional Documents
Culture Documents
Chapter 3
Example:
Contrast
enhancement
Image Negative
L-1 Original
digital
White mammogram
Output intensity
s L 1 r
Black
0 L-1
Black Input intensity White
Log Tr. of
Fourier
spectrum
Power-Law Transformations
s cr
Power-Law Transformations : Gamma Correction Application
Desired Image
image displayed
at
Monitor
After Image
Gamma displayed
correction at
Monitor
Power-Law Transformations : Gamma Correction Application
Ariel images
after Gamma
Correction
Contrast Stretching
Contrast means the difference Before contrast
enhancement
between the brightest and darkest
intensities
After
How to know where the contrast is enhanced ?
Notice the slope of T(r)
- if Slope > 1 Contrast increases
- if Slope < 1 Contrast decrease
- if Slope = 1 no change
s
r
Bit 7 Bit 6
Bit 5
Bit 3
Bit 2 Bit 1
Histogram
10
4 No. of
2 Students
0
A B+ B C+ C D+ D F
h(rk ) nk
- Histogram matching
To make histogram as the desire
Monotonically Increasing Function
Properties of Histogram
processing function
s T (r ) 1. Monotonically increasing
function
2. 0 T ( r ) 1 for 0 r 1
Probability Density Function
Histogram is analogous to Probability Density Function
(PDF) which represent density of population
Let s and r be Random variables with PDF ps(s) and pr(r ) respectively
and relation between s and r is
s T (r )
We get
dr
p s ( s ) pr ( r )
ds
Histogram Equalization
Let r
s T ( r ) pr ( w)dw
0
We get
dr 1
p s ( s ) pr ( r ) pr ( r )
ds ds
dr
pr ( r )
r
1
d pr ( w)dw
pr ( r )
1
pr ( r )
1
!
0
dr
Histogram Equalization
k
sk T ( rk ) pr ( rj )
j 0
k
nj
j 0 N
Original
image
After histogram equalization, the image
become a low contrast image
Histogram Matching : Algorithm
To transform image histogram to be a desired histogram
r T( ) s G-1( ) z
Histogram Matching : Algorithm (cont.)
s = T(r) v = G(z)
3 z = G-1(v)
4
Histogram Matching Example
Input image
Example histogram Desired Histogram
Intensity # pixels Intensity # pixels
(s) (z)
0 20 0 5
1 5 1 10
Original 2 25 2 15 User define
data 3 10 3 20
4 15 4 20
5 5 5 15
6 10 6 10
7 10 7 5
Total 100 Total 100
Histogram Matching Example (cont.)
1. Apply Histogram Equalization to both tables
sk = T(rk) vk = G(zk)
Histogram Matching Example (cont.)
2. Get a map
Actual Output
r s v z We get Histogram
r s s v v z r z z # Pixels
0 1 0 0 0 1 0 0
1 2 1 1 1 2 1 20
2 3 2 2 2 2 2 30
3 4 4 3 3 3 3 10
4 5 5 4 4 4 4 15
5 6 6 5 5 5 5 15
6 6 7 6 6 5 6 10
7 7 7 7 7 6 7 0
sk = T(rk) zk = G-1(vk)
Histogram Matching Example (cont.)
Desired histogram
Transfer function
Actual histogram
Histogram Matching Example (cont.)
After After
Original histogram histogram
image equalization matching
Local Enhancement : Local Histogram Equalization
Output image
Logic Operations
Application:
Crop areas
of interest
AND
OR
Error
image
Arithmetic Operation: Subtraction (cont.)
Application: Mask mode radiography in angiography work
Arithmetic Operation: Image Averaging
Application : Noise reduction
Degraded image
g ( x, y ) f ( x, y ) ( x, y )
(noise)
Image averaging
K
1
g ( x, y )
K
g ( x, y )
i 1
i
Pixel z
…
2 4 1 2 6 2
9 2 3 4 4 4 3 4 4
7 2 9 7 6 7 … 9 7 6 …
5 2 3 6 1 5 3 6 1
7 4 2 5 1 2
…
2 5 2 3 2 8
Basics of Spatial Filtering (cont.)
Step 2. Multiply every pixel by 1/9 and then sum up the values
…
3 4 4
… 9 7 6 …
1 1 1
3 6 1 y 3 4 4
9 9 9
…
1 1 1
9 7 6
9 9 9
X
1 1 1
1 1 1 3 6 1
1 Mask or 9 9 9
1 1 1 Window or
9
1 1 1 Template
Basics of Spatial Filtering (cont.)
Masking Window
Basics of Spatial Filtering (cont.)
Statistic parameters
Mean, Median, Mode,
Min, Max, Etc.
Moving
window
Output image
Order-Statistic Filters: Median Filter
Sharpening Spatial Filters
Intensity profile 1
0.5 Edge
p(x)
0
20 40 60 80 100 120 140 160 180 200
0.2
1st derivative
0.1
dp
dx 0
0 50 100 150 200
0.05
2nd derivative
2 0
d p
dx 2 -0.05
0 50 100 150 200
Laplacian Sharpening : How it works (cont.)
1.5
p(x) 0.5
-0.5
0 50 100 150 200
1.5
1
2
d p
p ( x ) 10 2 0.5
dx
0
-0.5
0 50 100 150 200
Before sharpening
p(x)
After sharpening
d2p
p ( x ) 10 2
dx
Laplacian Masks
2 2
2 P P
Used for estimating image Laplacian P 2 2
x y
-1 -1 -1 0 -1 0
-1 8 -1 -1 4 -1 The center of the mask
is positive
-1 -1 -1 0 -1 0
or
1 1 1 0 1 0
The center of the mask
1 -8 1 1 -4 1 is negative
1 1 1 0 1 0
p 2 P
2 P P 2 P
Laplacian Sharpening (cont.)
Mask for
2
P P
0 -1 0 -1 -1 -1
-1 5 -1 or -1 9 -1
Mask for 0 -1 0 -1 -1 -1
2 P
1 1 1
1 -8 1
1 1 1
or
0 1 0
1 -4 1
0 1 0
Unsharp Masking and High-Boost Filtering
-1 -1 -1 0 -1 0
-1 k+8 -1 -1 k+4 -1
-1 -1 -1 0 -1 0
Equation:
Intensity profile 1
dp
0.1
dx
0
0 50 100 150 200
First Order Partial Derivative:
Sobel operators
-1 0 1 -1 -2 -1
P P
-2 0 2 to compute 0 0 0 to compute
x y
-1 0 1 1 2 1
P P P
x y
First Order Partial Derivative: Image Gradient
Gradient magnitude
2 2
P P
P
x y
P
P y
P P
x
Image Enhancement in the Spatial Domain : Mix things up !
2 P
P
A B D smooth
+ -
Sharpening C E
Image Enhancement in the Spatial Domain : Mix things up !
Power
G
C E Law Tr.
F
A
Multiplication
H