Title: Computer Vision
1Computer Vision
- Spring 2006 15-385,-685
- Instructor S. Narasimhan
- Wean 5403
- T-R 300pm 420pm
2- Image Processing and Filtering
- (continued)
- Lecture 6
3Images are Discrete and Finite
4Averaging
Lets think about averaging pixel values
Which is faster?
5Averaging
The convolution kernel
6Gaussian Smoothing
Gaussian kernel
(truncate, if necessary)
Use two 1D Gaussian filters
7Gaussian Smoothing
- A Gaussian kernel gives less weight to pixels
further from the center of the window - This kernel is an approximation of a Gaussian
function
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 90 0 90 90 90 0 0
0 0 0 90 90 90 90 90 0 0
0 0 0 0 0 0 0 0 0 0
0 0 90 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 2 1
2 4 2
1 2 1
8Gaussian Smoothing
original
9Mean vs. Gaussian filtering
10Gaussian Smoothing
by Charles Allen Gillbert
by Harmon Julesz
http//www.michaelbach.de/ot/cog_blureffects/index
.html
11Gaussian Smoothing
http//www.michaelbach.de/ot/cog_blureffects/index
.html
12Border Problem
13Border Problem
- Ignore
- Output image will be smaller than original
- Pad with constant values
- Can introduce substantial 1st order derivative
values - Pad with reflection
- Can introduce substantial 2nd order derivative
values
14Median Filter
- Smoothing is averaging
- (a) Blurs edges
- (b) Sensitive to outliers
(a)
(b)
- Sort values around the pixel
- Select middle value (median)
- Non-linear (Cannot be implemented with
convolution)
15Salt and pepper noise
Gaussian noise
3x3
5x5
7x7
16Correlation
template
How do we locate the template in the image?
Cross-correlation
17Cross-correlation
Note
Auto-correlation
18Normalized Correlation
- Account for energy differences
19Image Processing in the Fourier Domain
Magnitude of the FT
Does not look anything like what we have seen
20Image Processing in the Fourier Domain
Magnitude of the FT
Does not look anything like what we have seen
21Convolution is Multiplication in Fourier Domain
F(sx,sy)
f(x,y)
h(x,y)
H(sx,sy)
g(x,y)
G(sx,sy)
22Low-pass Filtering
Let the low frequencies pass and eliminating the
high frequencies.
Generates image with overall shading, but not
much detail
23High-pass Filtering
Lets through the high frequencies (the detail),
but eliminates the low frequencies (the overall
shape). It acts like an edge enhancer.
24Boosting High Frequencies
25Most information at low frequencies!
26Fun with Fourier Spectra
27Image as a Discrete Function
28Digital Images
- The scene is
- projected on a 2D plane,
- sampled on a regular grid, and each sample is
- quantized (rounded to the nearest integer)
Image as a matrix
29Sampling Theorem
Continuous signal
Shah function (Impulse train)
Sampled function
30Sampling Theorem
Sampled function
31Nyquist Theorem
Aliasing
32Aliasing
33Alias n., an assumed name
Picket fence receding into the distance
will produce aliasing
34Image Scaling
This image is too big to fit on the screen.
How can we reduce it? How to generate a
half- sized version?
35Image Sub-Sampling
1/8
1/4
Throw away every other row and column to create a
1/2 size image - called image sub-sampling
36Image Sub-Sampling
1/4 (2x zoom)
1/8 (4x zoom)
1/2
37Good and Bad Sampling
- Good sampling
- Sample often or,
- Sample wisely
- Bad sampling
- see aliasing in action!
38Really bad in video
39Sub-Sampling with Gaussian Pre-Filtering
G 1/8
G 1/4
Gaussian 1/2
- Solution filter the image, then subsample
- Filter size should double for each ½ size
reduction. Why?
40Sub-Sampling with Gaussian Pre-Filtering
G 1/4
G 1/8
Gaussian 1/2
41Compare with...
1/4 (2x zoom)
1/8 (4x zoom)
1/2
42Aliasing
43Canon D60 (w/ anti-alias filter)
Sigma SD9 (w/o anti-alias filter)
From Rick Matthews website, images by Dave
Etchells
44Figure from David Forsyth
45Next Class
- Image Processing and Filtering (continued)
- Edge Detection
- Horn, Chapter 6