Digital Image Processing
Digital Image Processing
Image
Enhancement
Part IV
Nonlinear Filtering
• Nonlinear Filters
– Cannot be expressed as convolution
– Cannot be expressed as frequency shaping
• Definition
– Each pixel in an image has a probability pa or pb of being
contaminated by a white dot (salt) or a black dot (pepper)
X: noise-free image, Y: noisy image
255 with probability pa
noisy pixels
Y (m, n) = 0 with probability pb
X (m, n) clean pixels
with probability 1 - pa - pb
1 time
2 times
3 times
• Motivation
– Regular median filters change both “bad” and “good” pixels
• Idea
– Detect/classify “bad” and “good” pixels
– Filter “bad” pixels only
5 5 6 7 8 8
5 6 7 8 replicate 5 5 6 7 8 8 median 5 6 7 8
0 6 7 8 -padding 0 0 6 7 8 8 filtering 5 6 7 8
5 6 15 8 5 5 6 15 8 8 5 6 7 8
5 6 7 8 5 5 6 7 8 8 5 6 7 8
5 5 6 7 8 8
impulse cleaned!
Examples
{wi | i = 1, …, 9} = {0, 0, 0, ¼, ½, ¼, 0, 0, 0}
5 5 6 7 8 8
5 6 7 8 replicate 5 5 6 7 8 8 OS 5 6 7 8
0 6 7 8 -padding 0 0 6 7 8 8 filtering 5 6 7.25 8
5 6 15 8 5 5 6 15 8 8 5 6 7.25 8
5 6 7 8 5 5 6 7 8 8 5 6 7.25 8
5 5 6 7 8 8
Gradient
the term gradient is used for a gradual blend of colour which can
be considered as an even gradation from low to high values
At each image point, the gradient vector points in the direction of
largest possible intensity increase,
the length of the gradient vector corresponds to the rate of
change in that direction.
Two types of gradients, with blue arrows to indicate the direction
of the gradient
Sobel operators
Represents a rather inaccurate approximation of
the image gradient
The operator calculates the gradient of the image
intensity at each point
Giving the direction of the largest possible
increase from light to dark and the rate of change
in that direction
The result therefore shows how "abruptly" or
"smoothly" the image changes at that point
Image Sharpening based on First-Order Derivatives
For function f ( x, y ), the gradient of f at coordinates ( x, y )
is defined as
∂f
g x ∂x
∇f ≡ grad( f ) ≡ =
g y ∂f
∂y
M ( x, y ) ≈| g x | + | g y |
z1 z2 z3
M ( x, y ) =| z8 − z5 | + | z6 − z5 |
z4 z5 z6
z7 z8 z9
19
Image Sharpening based on First-Order Derivatives
Sobel Operators
M ( x, y ) ≈| ( z7 + 2 z8 + z9 ) − ( z1 + 2 z2 + z3 ) |
z1 z2 z3 + | ( z3 + 2 z6 + z9 ) − ( z1 + 2 z4 + z7 ) |
z4 z5 z6
z7 z8 z9
20
Image Sharpening based on First-Order Derivatives
21
Example
3/23/2019 22
Sobel Example
Grayscale
image of a
brick wall & a
bike rack
scale image
of a brick wall
& a bike rack
Combining Spatial Enhancement
Methods
Successful image
enhancement is
typically not achieved
using a single operation
Rather we combine a
range of techniques in
order to achieve a final
result
This example will focus
on enhancing the bone
scan to the right
Combining Spatial Enhancement
Methods
(a)
Laplacian filter of
bone scan (a)
(b)
Sharpened version of
bone scan achieved (c)
by subtracting (a)
and (b) Sobel filter of bone
scan (a) (d)
Combining Spatial Enhancement
Methods Result of applying a (h)
power-law trans. to
Images taken from Gonzalez & Woods, Digital Image Processing (2002)