Download presentation
Presentation is loading. Please wait.
1
Linear filtering
2
Overview: Linear filtering
Linear filters Definition and properties Examples Gaussian smoothing Separability Applications Denoising Non-linear filters: median filter Sharpening Subsampling
3
Images as functions demo with scanalyze on laptop Source: S. Seitz
4
Images as functions We can think of an image as a function, f, from R2 to R: f( x, y ) gives the intensity at position ( x, y ) Realistically, we expect the image only to be defined over a rectangle, with a finite range: f: [a,b] x [c,d] [0,1] A color image is just three functions pasted together. We can write this as a “vector-valued” function: As opposed to [0..255] Source: S. Seitz
5
What is a digital image? In computer vision we usually operate on digital (discrete) images: Sample the 2D space on a regular grid Quantize each sample (round to nearest integer) The image can now be represented as a matrix of integer values Source: S. Seitz
6
Motivation 1: Noise reduction
Given a camera and a still scene, how can you reduce noise? Answer: take lots of images, average them Take lots of images and average them! What’s the next best thing? Source: S. Seitz
7
Motivation 2: Image half-sizing
This image is too big to fit on the screen. How can we reduce it by a factor of two? How about taking every second pixel? Source: S. Seitz
8
First attempt at a solution
Let’s replace each pixel with an average of all the values in its neighborhood ys(i) =1/(2N+1)*(y(i + N) + y(i + N – 1) y(i – N)) ys(1) = y(1) ys(2) = (y(1)+y(2)+y(3))/3 ys(3) = (y(1)+y(2)+y(3)+y(4)+y(5))/5 ys(4) = (y(2)+y(3)+y(4)+y(5)+y(6))/5 Source: S. Marschner
9
First attempt at a solution
Let’s replace each pixel with an average of all the values in its neighborhood Moving average in 1D: Source: S. Marschner
10
Weighted Moving Average
Can add weights to our moving average Weights [1, 1, 1, 1, 1] / 5 Source: S. Marschner
11
Weighted Moving Average
Non-uniform weights [1, 4, 6, 4, 1] / 16 Source: S. Marschner
12
Moving Average In 2D 90 90 ones, divide by 9 Source: S. Seitz
13
Moving Average In 2D 90 90 10 ones, divide by 9 Source: S. Seitz
14
Moving Average In 2D 90 90 10 20 ones, divide by 9 Source: S. Seitz
15
Moving Average In 2D 90 90 10 20 30 ones, divide by 9 Source: S. Seitz
16
Moving Average In 2D 90 10 20 30 ones, divide by 9 Source: S. Seitz
17
Moving Average In 2D Source: S. Seitz ones, divide by 9 90 10 20 30 40
90 10 20 30 40 60 90 50 80 ones, divide by 9 Source: S. Seitz
18
Generalization of moving average
Let’s replace each pixel with a weighted average of its neighborhood The weights are called the filter kernel What are the weights for a 3x3 moving average? 1 “box filter” Source: D. Lowe
19
Practice with linear filters
1 ? Original Source: D. Lowe
20
Practice with linear filters
1 Original Filtered (no change) Source: D. Lowe
21
Practice with linear filters
1 ? Original Source: D. Lowe
22
Practice with linear filters
1 Original Shifted left By 1 pixel Source: D. Lowe
23
Practice with linear filters
? 1 Original Source: D. Lowe
24
Practice with linear filters
1 Original Blur (with a box filter) Source: D. Lowe
25
Practice with linear filters
- 2 1 ? (Note that filter sums to 1) Original Source: D. Lowe
26
Practice with linear filters
- 2 1 Original Sharpening filter Accentuates differences with local average Source: D. Lowe
27
Sharpening Source: D. Lowe
28
Gaussian Kernel 5 x 5, = 1 Constant factor at front makes volume sum to 1 (can be ignored, as we should re-normalize weights to sum to 1 in any case) Source: C. Rasmussen
29
Choosing kernel width Gaussian filters have infinite support, but discrete filters use finite kernels Source: K. Grauman
30
Choosing kernel width Rule of thumb: set filter half-width to about 3 σ
31
Gaussian noise Mathematical model: sum of many independent factors
Good for small standard deviations Assumption: independent, zero-mean noise Source: K. Grauman
32
Reducing Gaussian noise
Smoothing with larger standard deviations suppresses noise, but also blurs the image
33
Reducing salt-and-pepper noise
3x3 5x5 7x7 What’s wrong with the results?
34
Salt-and-pepper noise
Median filter Salt-and-pepper noise Median filtered MATLAB: medfilt2(image, [h w]) Source: K. Grauman
35
Median vs. Gaussian filtering
3x3 5x5 7x7 Gaussian Median
36
Sharpening revisited What does blurring take away? Let’s add it back:
original smoothed (5x5) detail = – Let’s add it back: original detail + α sharpened =
37
unit impulse (identity)
Unsharp mask filter Gaussian unit impulse Laplacian of Gaussian image blurred image unit impulse (identity) f + a(f - f * g) = (1+a)f-af*g = f*((1+a)e-g)
38
- Recall 2 1 Original Sharpening filter
2 1 Original Sharpening filter Accentuates differences with local average
39
Image half-sizing This image is too big to fit on the screen. How can we reduce it by a factor of two? How about taking every second pixel? Source: S. Seitz
40
Image sub-sampling 1/8 1/4 Throw away every other row and column to create a 1/2 size image - called image sub-sampling Slide by Steve Seitz
41
Gaussian (low-pass) pre-filtering
Solution: filter the image, then subsample Filter size should double for each ½ size reduction Source: Steve Seitz
42
Subsampling with Gaussian pre-filtering
1/2 1/4 (2x zoom) 1/8 (4x zoom) Source: Steve Seitz
43
Without prefiltering:
1/2 1/4 (2x zoom) 1/8 (4x zoom) Source: Steve Seitz
44
Zmiany klimatyczne – El Nino
45
ENSO = EN + SO
46
Fourier series make use of the orthogonality relationships of
the sine and cosine functions
47
natural fake
48
Anti-aliasing in 3D graphic display
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.