Filters
Filters
Filters
Ahmed Elgammal
Dept. of Computer Science
Rutgers University
Outlines
Rutgers CS334
What is a Filter
Point operations are limited (why)
They cannot accomplish tasks like sharpening or
smoothing
Rutgers CS334
Rutgers CS334
Averaging filter
Rutgers CS334
Rutgers CS334
Rutgers CS334
Integer coefficient
Rutgers CS334
Properties
Commutativity
Linearity
(notice)
Associativity
Rutgers CS334
Properties
Separability
Rutgers CS334
10
Rutgers CS334
An Isotropic Gaussian
The picture shows a
smoothing kernel
proportional to
11
Rutgers CS334
Gaussian smoothing
Advantages of Gaussian filtering
rotationally symmetric (for large filters)
filter weights decrease monotonically from central
peak, giving most weight to central pixels
Simple and intuitive relationship between size of and
the smoothing.
The Gaussian is separable
Advantage of seperability
First convolve the image with a one dimensional
horizontal filter
Then convolve the result of the first convolution
with a one dimensional vertical filter
For a kxk Gaussian filter, 2D convolution requires
k2 operations per pixel
But using the separable filters, we reduce this to
2k operations per pixel.
12
Rutgers CS334
Separability
1
2
1
11
18
18
11
2
1
18
65
18
1
=
= 6 + 20 + 10 = 36
= 4 + 8 + 6 = 18
=2 + 6 + 3 = 11
65
Advantages of Gaussians
Convolution of a Gaussian with itself is another
Gaussian
so we can first smooth an image with a small Gaussian
then, we convolve that smoothed image with another
small Gaussian and the result is equivalent to smoother
the original image with a larger Gaussian.
If we smooth an image with a Gaussian having sd
twice, then we get the same result as smoothing the
image with a Gaussian having standard deviation (2)
13
Rutgers CS334
Nonlinear Filters
Linear filters have a disadvantage when used for
smoothing or removing noise: all image structures
are blurred, the quality of the image is reduced.
Examples of nonlinear filters:
Minimum and Maximum filters
14
Rutgers CS334
Median Filter
Much better in removing noise and keeping the structures
15
Rutgers CS334
16
Rutgers CS334
weights
Window
weights
Original image
Filtered image
weights
17
Rutgers CS334
Normalized Correlation
Convolution with a filter can be used to find templates in
the image.
Normalized correlation output is filter output, divided by
root sum of squares of values over which filter lies
Consider template (filter) M and image window N:
Window
Template
Original image
Filtered image
(Normalized
Correlation
Result)
Normalized Correlation
18
Rutgers CS334
Positive responses
Zero mean image, -1:1 scale
Positive responses
Zero mean image, -1:1 scale
19
Rutgers CS334
Figure from Computer Vision for Interactive Computer Graphics, W.Freeman et al, IEEE Computer Graphics and Applications,
1998 copyright 1998, IEEE
20