Professional Documents
Culture Documents
2
2
s = T (r)
Contrast Thresholding
stretching
Basic Gray Level Transformation
Image Negative
s=L-1-r
Log Transformations
s = c log(1+r)
s = cr
s = r2.5
S=255(r/255)1/r
r = [1 10 20 30 40 210 220 230 240 250 255]
s( = 2.5) = [0 0 0 1 2 157 176 197 219 243 255]
s( =.4) = [28 70 92 108 122 236 240 245 249 253 255]
Power-Law Transformations - Gamma Correction
Power-Law Transformations
c=1
= 0.6
c=1
= 0.4 c=1
= 0.3
Power-Law Transformations
c=1
=3
c=1 c=1
=4 =5
Piecewise-Linear Transformation
Functions
• Advantage
• Arbitrarily complex
• Disadvantage
• More user input
• Type of Transformations
• Contrast stretching
• Gray-level slicing
• Bit-plane slicing
Contrast Stretching
Objective: Increase the dynamic range of the gray levels in the
image
S=(r-a)*((d-c)/(b-a)) +c
piecewise Linear transformation functions.
Exercise on Contrast stretching and thresholding
Exercise:
the following matrix represents the pixels values of a 8-bit image (r) , apply
thresholding transform assuming that the threshold m=95, find the resulting image
pixel values.
Image (r)
90 91 99 100
82 96 85 90
Gray-Level Slicing
Objective: Highlighting a specific range of gray levels in an image.
Bit-Plane Slicing
255 138 30
65 12 201
180 111 85
LSB MSB
MSB plane 255 1 1 1 1 1 1 1 1
1 1 0 138 0 1 0 1 0 0 0 1
0 0 1 30 1 1 1 1 1 0 0 0
1 0 0 65 1 0 0 0 0 0 1 0
12 0 0 1 1 0 0 0 0
LSB plane 201 1 0 0 1 0 0 1 1
1 0 1 183 1 1 1 0 1 1 0 1
1 0 1 111 1 1 1 1 0 1 1 0
1 1 1 85 1 0 1 0 1 0 1 0
Bit-Plane Slicing
Bit-Plane Slicing
Histogram Processing
Histogram
The histogram of a digital image with gray levels in
the range [0, L-1] is a discrete function
h(rk) = nk,
where rk is the kth gray level and nk is the number of
pixels in the image having gray level rk.
Normalized Histogram
Dividing each value of the histogram by the total number
of pixels in the image, denoted by n.
p(rk) = nk /n.
Normalized histogram provide useful image statistics.
Histogram Processing
Histogram Equalization
Histogram equalization is used to enhance image contrast and gray-level
detail by spreading the histogram of the original image.
s = T ( r ) 0 r 1,
where r and s are normalized pixel intensities
1
Histogram Equalization
Objective of histogram equalization
Transform the histogram function of the original
image pr(r) to a uniform histogram function.
ps(s) = 1 0 s 1
Equalizer ps(s)
pr(r)
Transformation
where nk is the number of pixels having grey level k, and N is the total number of pixels in
the image.
Note that
3 bit
64 x 64 image
Global Histogram
0.98
0.002 Local Histogram
178
255
Local Histogram Enhancement
Histogram Statistics for Image Enhanc.
Contrast manipulation using local statistics, such as the mean and
variance, is useful for images where part of the image is acceptable,
but other parts may contain hidden features of interest.
Histogram Statistics for Image Enhanc.
Let (x,y) be the coordinates of a pixel in an image, and let Sxy
denote a neighborhood (sub-image) of specified size, centered at
(x,y).
mS xy rs,t p(rs,t )
( s ,t )S xy
S xy
2
[rs,t mS xy
]2
p ( rs ,t ).
( s ,t )S xy
The local mean and variance are the decision factors to whether apply
local enhancement or not.
Histogram Statistics for Image Enhanc.
MG: Global mean
DG: Global standard
deviation
E, k0, k1, k2: Specified
parameters
(x,y) E
(x,y)
Image Mean
125 135 145 135 .. 174 164
168 175 158 149 .. 187
210 231 215 129 ..
187 192 145 200 ..
Histogram Statistics for Image Enhanc.
Arithmetic Operations
Addition, Subtraction, Multiplication, and Division
Logic Operations
AND, OR, NOT
Enhancement Using AND and OR Logic Op.
AND
OR
Original
4
Upper-order
Bit
HE of
Error Error
Enhancement Using Arithmetic Op. _ SUB
Mask Mode Radiography
Problem:
The pixel intensities in the difference image can range from -255 to 255.
Solutions:
1) Add 255 to every pixel and then divide by 2.
2) Add the minimum value of the pixel intensity in the difference image
to every pixel and then divide by 255/Max. Max is the maximum
pixel value in the modified difference image.
Enhancement Using Arithmetic Op. Averaging
Original image Noise with zero mean
g ( x , y ) f ( x, y ) ( x, y )
1 k
g ( x , y ) g i ( x, y )
k i 1
E g ( x, y ) f ( x, y )
1 2
g ( x, y ) ( x, y )
2
k
Enhancement Using Arithmetic Op. Averaging
Gaussian Noise
f(x,y) g(x,y) mean = 0
variance = 64
K=8 K = 16
x
- +
K = 128
K = 32
Enhancement Using Arithmetic Op. Averaging
K=8
Difference images
between original K = 16
image and images
obtained from Notice the
averaging. mean and
K = 32 variance
of the
difference
images
K = 128 decrease as K
increases.
Basics of Spatial Filtering - Linear
a b
g ( x, y) w(s, t ) f ( x s, y t )
s a t b
Basics of Spatial Filtering
Response, R, of an m n mask at any point (x, y)
mn
R wi zi
i 1
Example
Computation for the median is a nonlinear operation.
Smoothing Spatial Filtering - Linear
Averaging (low-pass) Filters
Smoothing filters are used
- Noise reduction
- Smoothing of false contours
- Reduction of irrelevant detail
Box Weighted
filter average
Smoothing Spatial Filtering _ Linear
Averaging (low-pass) Filters
n = filter size
n=3
n=5 n=9
n = 35
n = 15
Smoothing Spatial Filtering
Averaging & Threshold
filter size Thrsh = 25% of
n = 15 highest intensity
Smoothing Spatial Filtering
Order Statistic Filters
Order-statistics filters are nonlinear spatial filters whose
response is based on ordering (ranking) the pixels contained in
the image area encompassed by the filter, and then replacing
the value of the center pixel with the value determined by the
ranking result.
3 3 Median filter [10 125 125 135 141 141 144 230 240] = 141
3 3 Max filter [10 125 125 135 141 141 144 230 240] = 240
3 3 Min filter [10 125 125 135 141 141 144 230 240] = 10
1 9
9 1
zi
Image Blurred Image
1 9
9 1
z
Robert operator
Sobel operators
Use of First Derivative for Edge Extraction
Gradient
-1 0 1 -1 -2 -1
-2 0 2 0 0 0
f(x,y) = [40, 140]
-1 0 1 1 2 1
…. 0 0 0 0 0 0
…. 0 200 400 400 400 400 ……
…. 0 400 600 400 400 400 …...
…. 0 400 400 0 0 0
…. 0 400 400 0 0 0
…. 0 400 400 0 0 0
…0 0 0 0 0
-1 -1 …0 100 200 200 200
1 1 …0 200 0 0 0
…0 200 0 0 0
Use of First Derivative for Edge Extraction
Gradient
2nd Derivative _ Laplacian
f f 2 2
f 2 2
2
x y
2 f
f ( x 1, y ) f ( x 1, y ) 2 f ( x, y )
x 2
2 f
f ( x, y 1) f ( x, y 1) 2 f ( x, y )
y 2
2 f [ f ( x 1, y ) f ( x 1, y ) f ( x, y 1) f ( x, y 1) 4 f ( x, y )]
Use of 2nd Derivative for Enhancement
Laplacian
2
f 2
f
f 2 2
2
x y
Use of 2nd Derivative for Enhancement
Laplacian
0 1 0
f(x,y) = [90, 100]
1 -4 1
0 1 0
…0 0 0 0 …
…0 10 0 0 …
… 10 -40 10 0 …
…0 10 0 0 …
…0 0 0 0 …
Use of 2nd Derivative for Enhancement
Laplacian
1 1 1
1 -8 1
1 1 1
f ( x, y ) 2 f ( x, y )
g ( x, y )
f ( x , y ) 2
f ( x, y )
Use of 2nd Derivative for Enhancement
Laplacian
2 f [ f ( x 1, y) f ( x 1, y) f ( x, y 1) f ( x, y 1) 4 f ( x, y)]
0 1 0
g(x,y) = f(x,y) - 1 -4 1 =
0 1 0
f ( x, y )
2
Un-sharp Masking and High-boost Filtering
Un-sharp Masking and High-boost Filtering
(b)
Combining Spatial
Enhancement Methods
Combining Spatial
Enhancement Methods