Grauman Today: Image Filters Smooth/Sharpen Images... Find edges... Find waldo…

1 Grauman Today: Image Filters Smooth/Sharpen Images... F...
Author: Martha Norton
0 downloads 0 Views

1 Grauman Today: Image Filters Smooth/Sharpen Images... Find edges... Find waldo…

2 Grauman Motivation: noise reduction We can measure noise in multiple images of the same static scene. How could we reduce the noise, i.e., give an estimate of the true intensities?

3 Grauman Motivation: noise reduction How could we reduce the noise, i.e., give an estimate of the true intensities? What if there’s only one image?

4 Grauman First attempt at a solution Let’s replace each pixel with an average of all the values in its neighborhood Assumptions: – Expect pixels to be like their neighbors – Expect noise processes to be independent from pixel to pixel

5 Grauman 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

6 Grauman Weighted Moving Average Can add weights to our moving average Weights [1, 1, 1, 1, 1] / 5 Source: S. Marschner

7 Grauman Weighted Moving Average Non-uniform weights [1, 4, 6, 4, 1] / 16 Source: S. Marschner

8 Grauman Moving Average In 2D 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 0 0000000000 0000000000 000 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 Source: S. Seitz

9 Grauman Moving Average In 2D 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 010 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 Source: S. Seitz

10 Grauman Moving Average In 2D 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 01020 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 Source: S. Seitz

11 Grauman Moving Average In 2D 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 0102030 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 Source: S. Seitz

12 Grauman Moving Average In 2D 0102030 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 Source: S. Seitz

13 Grauman Moving Average In 2D 0000000000 0000000000 00090 00 000 00 000 00 000 0 00 000 00 0000000000 00 0000000 0000000000 0102030 2010 0204060 4020 0306090 6030 0 5080 906030 0 5080 906030 0203050 604020 102030 2010 00000 Source: S. Seitz

14 Grauman Convolution Convolution: – Flip the filter in both dimensions (bottom to top, right to left) – Then apply cross-correlation F H

15 Grauman Median filter No new pixel values introduced Removes spikes: good for impulse, salt & pepper noise

16 Grauman Median filter Salt and pepper noise Median filtered Source: M. Hebert Plots of a row of the image

17 Grauman Smoothing with a Gaussian for sigma=1:3:10 h = fspecial('gaussian‘, fsize, sigma); out = imfilter(im, h); imshow(out); pause; end … Parameter σ is the “scale” / “width” / “spread” of the Gaussian kernel, and controls the amount of smoothing.

18 Grauman Partial derivatives of an image Which shows changes with respect to x? -1 1 1 -1 or ? -1 1 (showing flipped filters)

19 Grauman Effects of noise Consider a single row or column of the image – Plotting intensity as a function of position gives a signal Where is the edge?

20 Grauman Where is the edge? Solution: smooth first Look for peaks in

21 Grauman Derivative property of convolution Differentiation property of convolution.

22 Grauman Derivative of Gaussian filters x-direction y-direction Source: L. Lazebnik

23 Grauman Effect of σ on derivatives The apparent structures differ depending on Gaussian’s scale parameter. Larger values: larger scale edges detected Smaller values: finer features detected σ = 1 pixel σ = 3 pixels

24 Grauman Template matching Filters as templates: Note that filters look like the effects they are intended to find --- “matched filters” Use normalized cross-correlation score to find a given pattern (template) in the image. – Szeliski Eq. 8.11 Normalization needed to control for relative brightnesses.

25 Grauman Template matching Scene Template (mask) A toy example

26 Grauman Template matching Template Detected template

27 Grauman Template matching Detected templateCorrelation map

28 Grauman Where’s Waldo? Scene Template

29 Grauman Where’s Waldo? Scene Template

30 Grauman Where’s Waldo? Detected templateCorrelation map

31 Grauman Template matching Scene Template What if the template is not identical to some subimage in the scene?

32 Grauman

33 So, what scale to choose? It depends what we’re looking for. Too fine of a scale…can’t see the forest for the trees. Too coarse of a scale…can’t tell the maple grain from the cherry.

34 Grauman Predict the filtered outputs 000 010 000 * = ? 000 100 000 * 111 111 111 000 020 000 - *

35 Grauman Practice with linear filters 000 010 000 Original ? Source: D. Lowe

36 Grauman Practice with linear filters 000 010 000 Original Filtered (no change) Source: D. Lowe

37 Grauman Practice with linear filters 000 100 000 Original ? Source: D. Lowe

38 Grauman Practice with linear filters 000 100 000 Original Shifted left by 1 pixel with correlation Source: D. Lowe

39 Grauman Practice with linear filters Original ? 111 111 111 Source: D. Lowe

40 Grauman Practice with linear filters Original 111 111 111 Blur (with a box filter) Source: D. Lowe

41 Grauman Practice with linear filters Original 111 111 111 000 020 000 - ? Source: D. Lowe

42 Grauman Practice with linear filters Original 111 111 111 000 020 000 - Sharpening filter - Accentuates differences with local average Source: D. Lowe

43 Grauman Filtering examples: sharpening