3.
5 Smoothing (Lowpass) Spatial Filters
- Lowpass Gaussian Filter Kernels
Gaussian Kernel:
the only circularly symmetric kernels that are also separable.
(also called isotropic, meaning their response is independent of orientation)
Let
3.5 Smoothing (Lowpass) Spatial Filters
- Lowpass Gaussian Filter Kernels
Let
distance r
3.5 Smoothing (Lowpass) Spatial Filters
- Lowpass Gaussian Filter Kernels
Let
Example.
K = 1 and σ = 1
3.5 Smoothing (Lowpass) Spatial Filters
- Lowpass Gaussian Filter Kernels
Gaussian Kernel Gaussian Kernel
size 21x21 size 43x43
K = 1 and σ = 3.5 K = 1 and σ = 7
3.5 Smoothing (Lowpass) Spatial Filters
- Lowpass Gaussian Filter Kernels
Box lter Gaussian Kernel
size 21x21 size 43x43
Comparison K = 1 and σ = 7
much smoother around the edges
fi
3.5 Smoothing (Lowpass) Spatial Filters
- Lowpass Gaussian Filter Kernels
Some important properties of Gaussian kernels:
- Separable
- The meaningful largest kernel size for image processing is 6σ x 6σ
(e.g., a 43 x 43 kernel if σ = 7)
- because the values of a Gaussian function at a distance larger
than 3σ from the mean are small enough that they can be ignored.
Gaussian Kernel Gaussian Kernel
Difference image
size 43x43, σ = 7 size 85x85, σ = 7
3.5 Smoothing (Lowpass) Spatial Filters
- Lowpass Gaussian Filter Kernels
Some important properties of Gaussian kernels:
- Separable
- The meaningful largest kernel size for image processing is 6σ x 6σ
(e.g., a 43 x 43 kernel if σ = 7)
- because the values of a Gaussian function at a distance larger
than 3σ from the mean are small enough that they can be ignored.
- The product and convolution of two Gaussians are Gaussian
functions also.
3.5 Smoothing (Lowpass) Spatial Filters
- Lowpass Gaussian Filter Kernels
Example of applications for lowpass ltering: region extraction
Hubble Telescope image lowpass ltering with a thresholding the ltered
Gaussian kernel image
fi
fi
fi
3.5 Smoothing (Lowpass) Spatial Filters
- Lowpass Gaussian Filter Kernels
Example of applications for lowpass ltering: shading correction
(b) Estimate of the shading
(a) Image shaded Result of dividing (a) by (b)
patterns obtained using
lowpass ltering
fi
fi
3.5 Smoothing (Lowpass) Spatial Filters
- Order-Statistic (non-linear) Filters
Median Filter
-- the 50th percentile of a ranked set of numbers
-- effective for reducing impulse noise,
or salt-and-pepper noise
Max Filter
-- the 100th percentile filter
Min Filter
-- the 0th percentile filter
credit of this slide: Y. P. Hung
3.5 Smoothing (Lowpass) Spatial Filters
- Order-Statistic (non-linear) Filters
Median Filter
Min Filter Max Filter
source: http://www.southampton.ac.uk/~msn/book/new_demo/median/
3.5 Smoothing (Lowpass) Spatial Filters
- Order-Statistic (non-linear) Filters
Median Filter
-- the 50th percentile of a ranked set of numbers
-- effective for reducing impulse noise,
or salt-and-pepper noise
Max Filter
-- the 100th percentile filter
Min Filter
-- the 0th percentile filter
credit of this slide: Y. P. Hung
3.5 Smoothing (Lowpass) Spatial Filters
- Order-Statistic (non-linear) Filters
Salt-and-pepper 19 x 19 Gaussian
7x7 median lter
noise image lowpass lter, σ = 3
fi
fi
3.6 Sharpening (Highpass) Spatial Filters
- Foundation
First Derivative:
Second Derivative:
3.6 Sharpening (Highpass) Spatial Filters
- Foundation
• First derivative:
- Zero in areas of constant intensity
- Nonzero at the onset of an intensity step or ramp
- Nonzero along ramps
• Second derivative:
- Zero in areas of constant intensity
- Nonzero at the onset and end of an intensity step or ramp
- Zero along ramps of constant slope
for edge detection
for sharpening
3.6 Sharpening (Highpass) Spatial Filters
- Foundation
First derivative for edge detection
What is edge?
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
0
d2p
dx 2 -0.05
0 50 100 150 200
3.6 Sharpening (Highpass) Spatial Filters
- Foundation
Second derivative for sharpening
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
0
d2p
dx 2 -0.05
0 50 100 150 200
3.6 Sharpening (Highpass) Spatial Filters
- Foundation
Second derivative for sharpening Laplacian
1.5
p(x) 0.5
-0.5 Before sharpening
0 50 100 150 200
p(x)
1.5
1
2
d p
p( x ) − 10 0.5
dx 2
0
After sharpening
-0.5
0 50 100 150 200
d2p
p( x ) − 10 2
Laplacian sharpening results in larger intensity discontinuity dx
near the edge.
3.6 Sharpening (Highpass) Spatial Filters
- the Laplacian
The simplest isotropic derivative kernel is the Laplacian
¶ 2
f ¶ 2
f
Ñ2 f = 2 + 2
¶ x ¶ y
Discrete form: ¶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
We then have:
Ñ 2 f = [ f ( x + 1, y ) + f ( x - 1, y ) + f ( x, y + 1) + f ( x, y - 1)]
- 4 f ( x, y )
3.6 Sharpening (Highpass) Spatial Filters
- the Laplacian
Ñ 2 f = [ f ( x + 1, y ) + f ( x - 1, y ) + f ( x, y + 1) + f ( x, y - 1)]
- 4 f ( x, y )
The corresponding spatial lter:
Other Laplacian kernels:
fi
1.5
3.6 Sharpening
p(x)
(Highpass) Spatial Filters
1
0.5
- the Laplacian 0
-0.5
0 50 100 150 200
1.5
1
2
d p
Recall that p( x ) − 10 0.5
dx 2
0
-0.5
0 50 100 150 200
Laplacian sharpening results in larger intensity discontinuity
near the edge.
the Laplacian for image sharpening:
g ( x, y ) = f ( x, y ) - Ñ f 2
A general form in the book:
3.6 Sharpening (Highpass) Spatial Filters
- the Laplacian
Example of Laplacian image sharpening
Laplacian image
Original image
g ( x, y ) = f ( x, y ) - Ñ 2 f
Laplacian kernel
g ( x, y ) = f ( x, y ) - Ñ 2 f
3.6 Sharpening (Highpass) Spatial Filters
- the Laplacian
The entire enhancement can be combined into a single
ltering operation
g ( x, y ) = f ( x, y ) - Ñ 2 f
= f ( x, y ) - [ f ( x + 1, y ) + f ( x - 1, y )
+ f ( x, y + 1) + f ( x, y - 1) - 4 f ( x, y )]
= 5 f ( x, y ) - f ( x + 1, y ) - f ( x - 1, y )
- f ( x, y + 1) - f ( x, y - 1)
other variant:
fi
3.6 Sharpening (Highpass) Spatial Filters
- the Laplacian
Example of Laplacian image sharpening
credit of this slide: C. Nikou
3.6 Sharpening (Highpass) Spatial Filters
- Unsharp Masking and Highboost Filtering
Unsharp Masking
Steps:
(1) Blur the image
b(x,y)=Blur{f(x,y)}
(1)
(2) Subtract the blurred image
from the original (the result is
called the mask) (2)
gmask(x,y)=f(x,y)-b(x,y)
(3) Add the mask to the original (3)
g(x,y)=f(x,y)+k gmask(x,y)
k = 1: Unsharp Masking k > 1: Highboost Filtering
3.6 Sharpening (Highpass) Spatial Filters
- Unsharp Masking and Highboost Filtering
Original Image
Blurred Image
Mask
Unsharp Masking Result
Highboost Filtering Result
(k = 4.5)
3.6 Sharpening (Highpass) Spatial Filters
- the Gradient
First derivatives in image processing are implemented using the
magnitude of the gradient.
The magnitude (length) of this vector:
3.6 Sharpening (Highpass) Spatial Filters
- the Gradient
The magnitude (length) of this vector:
For practical reasons this can be simpli ed as:
The simplest approximation:
fi
3.6 Sharpening (Highpass) Spatial Filters
- the Gradient
Two other de nition:
Roberts Cross-
Gradient Operators
Sobel Operators
fi
3.6 Sharpening (Highpass) Spatial Filters
- the Gradient
Example of using the gradient for edge enhancement:
Original Image Sobel Operators
Sobel operators are typically used for edge detection.
3.7 Highpass, Bandreject, and
Bandpass Filters from Low Pass Filters
Skip this subchapter, because most of the
contents belongs to Chapter 4.
3.8 Combing 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 nal result.
credit of this slide: C. Nikou
fi
3.8 Combing Spatial Enhancement Methods
credit of this slide: C. Nikou
3.8 Combing Spatial Enhancement Methods
3.8 Combing Spatial Enhancement Methods
credit of this slide: C. Nikou
3.8 Combing Spatial Enhancement Methods
credit of this slide: C. Nikou
3.8 Combing Spatial Enhancement Methods
Original Image Final Image
Introduction to Image Processing
Ch 3. Intensity Transformations
and Spatial Filtering
Kuan-Wen Chen