Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University

Similar presentations


Presentation on theme: "Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University"— Presentation transcript:

1 Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University saksoy@cs.bilkent.edu.tr

2 CS 484, Spring 2008©2008, Selim Aksoy2 Fourier theory Jean Baptiste Joseph Fourier had a crazy idea: Any periodic function can be written as a weighted sum of sines and cosines of different frequencies (1807). Don’t believe it? Neither did Lagrange, Laplace, Poisson, … But it is true!  Fourier series Even functions that are not periodic (but whose area under the curve is finite) can be expressed as the integral of sines and cosines multiplied by a weighing function.  Fourier transform

3 CS 484, Spring 2008©2008, Selim Aksoy3 Fourier theory The Fourier theory shows how most real functions can be represented in terms of a basis of sinusoids. The building block: A sin( ωx + Φ ) Add enough of them to get any signal you want. Adapted from Alexei Efros, CMU

4 CS 484, Spring 2008©2008, Selim Aksoy4 Fourier transform

5 CS 484, Spring 2008©2008, Selim Aksoy5 Fourier transform

6 CS 484, Spring 2008©2008, Selim Aksoy6 Fourier transform

7 CS 484, Spring 2008©2008, Selim Aksoy7 Fourier transform

8 CS 484, Spring 2008©2008, Selim Aksoy8 Fourier transform

9 CS 484, Spring 2008©2008, Selim Aksoy9 Fourier transform

10 CS 484, Spring 2008©2008, Selim Aksoy10 Fourier transform Adapted from Alexei Efros, CMU

11 CS 484, Spring 2008©2008, Selim Aksoy11 Fourier transform Adapted from Gonzales and Woods

12 CS 484, Spring 2008©2008, Selim Aksoy12 Fourier transform Adapted from Gonzales and Woods

13 CS 484, Spring 2008©2008, Selim Aksoy13 Fourier transform

14 CS 484, Spring 2008©2008, Selim Aksoy14 Fourier transform

15 CS 484, Spring 2008©2008, Selim Aksoy15 Fourier transform Adapted from Shapiro and Stockman

16 CS 484, Spring 2008©2008, Selim Aksoy16 Fourier transform Example building patterns in a satellite image and their Fourier spectrum.

17 CS 484, Spring 2008©2008, Selim Aksoy17 Convolution theorem

18 CS 484, Spring 2008©2008, Selim Aksoy18 Frequency domain filtering Adapted from Shapiro and Stockman, and Gonzales and Woods

19 CS 484, Spring 2008©2008, Selim Aksoy19 Frequency domain filtering Since the discrete Fourier transform is periodic, padding is needed in the implementation to avoid aliasing (see section 4.6 in the Gonzales-Woods book for implementation details).

20 CS 484, Spring 2008©2008, Selim Aksoy20 Frequency domain filtering f(x,y) h(x,y) g(x,y)   |F(u,v)| |H(u,v)| |G(u,v)|   Adapted from Alexei Efros, CMU

21 CS 484, Spring 2008©2008, Selim Aksoy21 Smoothing frequency domain filters Adapted from Gonzales and Woods

22 CS 484, Spring 2008©2008, Selim Aksoy22 Smoothing frequency domain filters

23 CS 484, Spring 2008©2008, Selim Aksoy23 Smoothing frequency domain filters The blurring and ringing caused by the ideal low- pass filter can be explained using the convolution theorem where the spatial representation of a filter is given below.

24 CS 484, Spring 2008©2008, Selim Aksoy24 Smoothing frequency domain filters Adapted from Gonzales and Woods

25 CS 484, Spring 2008©2008, Selim Aksoy25 Smoothing frequency domain filters

26 CS 484, Spring 2008©2008, Selim Aksoy26 Sharpening frequency domain filters

27 CS 484, Spring 2008©2008, Selim Aksoy27 Sharpening frequency domain filters Adapted from Gonzales and Woods

28 CS 484, Spring 2008©2008, Selim Aksoy28 Sharpening frequency domain filters Adapted from Gonzales and Woods

29 CS 484, Spring 2008©2008, Selim Aksoy29 Sharpening frequency domain filters Adapted from Gonzales and Woods

30 CS 484, Spring 2008©2008, Selim Aksoy30 Frequency domain processing An image and its Fourier spectrum. Adapted from Alexei Efros, CMU

31 CS 484, Spring 2008©2008, Selim Aksoy31 Frequency domain processing Results of modifying the spectrum and reconstructing the image. Adapted from Alexei Efros, CMU

32 CS 484, Spring 2008©2008, Selim Aksoy32 Frequency domain processing Results of modifying the spectrum and reconstructing the image. Adapted from Alexei Efros, CMU

33 CS 484, Spring 2008©2008, Selim Aksoy33 Template matching Correlation can also be used for matching. If we want to determine whether an image f contains a particular object, we let h be that object (also called a template) and compute the correlation between f and h. If there is a match, the correlation will be maximum at the location where h finds a correspondence in f. Preprocessing such as scaling and alignment is necessary in most practical applications.

34 CS 484, Spring 2008©2008, Selim Aksoy34 Template matching Adapted from Gonzales and Woods

35 CS 484, Spring 2008©2008, Selim Aksoy35 Template matching Face detection using template matching: face templates.

36 CS 484, Spring 2008©2008, Selim Aksoy36 Template matching Face detection using template matching: detected faces.

37 CS 484, Spring 2008©2008, Selim Aksoy37 Resizing images How can we generate a half-sized version of a large image? Adapted from Steve Seitz, U of Washington

38 CS 484, Spring 2008©2008, Selim Aksoy38 Resizing images Throw away every other row and column to create a 1/2 size image (also called sub-sampling). 1/4 1/8 Adapted from Steve Seitz, U of Washington

39 CS 484, Spring 2008©2008, Selim Aksoy39 Resizing images Does this look nice? 1/4 (2x zoom)1/8 (4x zoom)1/2 Adapted from Steve Seitz, U of Washington

40 CS 484, Spring 2008©2008, Selim Aksoy40 Resizing images We cannot shrink an image by simply taking every k’th pixel. Solution: smooth the image, then sub-sample. Gaussian 1/4 Gaussian 1/8 Gaussian 1/2 Adapted from Steve Seitz, U of Washington

41 CS 484, Spring 2008©2008, Selim Aksoy41 Resizing images Gaussian 1/4 (2x zoom) Gaussian 1/8 (4x zoom) Gaussian 1/2 Adapted from Steve Seitz, U of Washington

42 CS 484, Spring 2008©2008, Selim Aksoy42 Sampling and aliasing Adapted from Steve Seitz, U of Washington

43 CS 484, Spring 2008©2008, Selim Aksoy43 Sampling and aliasing Errors appear if we do not sample properly. Common phenomenon: High spatial frequency components of the image appear as low spatial frequency components. Examples: Wagon wheels rolling the wrong way in movies. Checkerboards misrepresented in ray tracing. Striped shirts look funny on color television.

44 CS 484, Spring 2008©2008, Selim Aksoy44 Gaussian pyramids Adapted from Gonzales and Woods

45 CS 484, Spring 2008©2008, Selim Aksoy45 Gaussian pyramids Adapted from Michael Black, Brown University

46 CS 484, Spring 2008©2008, Selim Aksoy46 Gaussian pyramids Adapted from David Forsyth, UC Berkeley

47 CS 484, Spring 2008©2008, Selim Aksoy47 Gaussian pyramids Adapted from Michael Black, Brown University


Download ppt "Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University"

Similar presentations


Ads by Google