Chapter 3 ppt part II
Chapter 3 ppt part II
of
39
Note:
The size of mask must be odd (i.e. 3×3, 5×5,
etc.) to ensure it has acenter. The smallest
meaningful size is 3×3.
16
of
39
Spatial Filtering cont..
• Classification on the basis of linearity:
There are two types:
1. Linear Spatial Filter
2. Non-linear Spatial Filter
• General Classification:
There are two types:
1. Smoothing Spatial Filter: Smoothing filter is used for blurring and noise reduction in the image.
• Blurring is pre-processing steps for removal of small details and Noise Reduction is
accomplished by blurring.
2. Sharpening Spatial Filter: It is also known as derivative filter.
• The purpose of the sharpening spatial filter is just the opposite of the smoothing spatial filter.
• Its main focus in on the removal of blurring and highlight the edges.
• It is based on the first and second order derivative.
17
of Linear Spatial Filtering
39
• For the 3×3 mask shown in the previous figure, the result (or response), R, of
linear filtering is:
• In general, linear filtering of an image f of size M×N with a filter mask of size
m×n is given by the expression:
Note:
Weighted average filter has different coefficients to give more
importance (weight) to some pixels at the expense of others.
The idea behind that is to reduce blurring in the smoothing process.
27
of
39
Averaging linear filters cont..
• Averaging linear filtering of an image f of size M×N with a
filter mask of size m×n is given by the expression:
To generate a complete filtered image this equation must be applied for x = 0,1, 2,..., M-1 and y =
0,1, 2,..., N-1.
28
of Example:- Applying standard averaging filter.
39
• The first order partial derivatives of the digital image f(x,y) are:
A B
39
of
39
1st Derivative
The formula for the 1st derivative of a function is as follows:
f
= f (x +1) − f (x)
x
It’s just the difference between subsequent values and
measures the rate of change of the function
40
of
39
1st Derivative (cont…)
8
7
6
5
4
3
2
1
0
5 5 4 3 2 1 0 0 0 6 0 0 0 0 1 3 1 0 0 0 0 7 7 7 7
0 -1 -1 -1 -1 0 0 6 -6 0 0 0 1 2 -2 -1 0 0 0 7 0 0 0
8
6
4
2
0
-2
-4
-6
-8
41
of
39
2nd Derivative
The formula for the 2nd derivative of a function is as follows:
f
2
=
f (x+ 1)+ f (x-1)-2 f (x)
2 x
Simply takes into account the values both before and after
the current value
42
of
39
Using Second Derivatives For Image Enhancement
1 -4 1
0 1 0
45
of
39
The Laplacian (cont…)
Applying the Laplacian to an image we get a new image
that highlights edges and other discontinuities
- =
Original Laplacian Sharpened
Image Filtered Image Image
This gives us a new filter which does the whole job for us in
one step
0 -1 0
-1 5 -1
0 -1 0
51
of
39
Simplified Image Enhancement (cont…)
52
of
39
Question?