Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 5: Fourier and Pyramids

Similar presentations


Presentation on theme: "Lecture 5: Fourier and Pyramids"— Presentation transcript:

1 Lecture 5: Fourier and Pyramids
CS4670/5670: Computer Vision Kavita Bala Lecture 5: Fourier and Pyramids

2 Announcements PA1-A will be out tonight, due in a week
Written part alone Coding part in pairs Monday: numPy lecture

3

4 Fourier Transform Given a signal compute (co)sine waves that contribute to signal For each frequency k, contribution of that frequency to signal: X[k] W (angular frequency) = 2 pi f

5 Fourier Transform Fourier transform stores the magnitude and phase at each frequency Magnitude encodes how much signal there is at a particular frequency Phase encodes spatial information (indirectly) For mathematical convenience, this is often notated in terms of real and complex numbers Amplitude: Phase:

6

7 Derivation for Gaussian

8 Mandrill © Kavita Bala, Computer Science, Cornell University

9 Process Convert to frequency domain Multiply by low pass filter Sample
Eliminate high frequencies Sample Reconstruct

10

11 Filtering Lost some detail in this process
But ensure that you eliminate objectionable high frequency artifacts Have to transform to frequency domain? Expensive Not necessary because of relationship between spatial and frequency domain

12 The Convolution Theorem
The Fourier transform of the convolution of two functions is the product of their Fourier transforms Convolution in spatial domain is equivalent to multiplication in frequency domain!

13 Don’t multiply in frequency domain
Just convolve in spatial domain

14

15 Types of Filters Spatial Sine Gaussian Box Sinc Frequency Impulse

16 Pre-Filtering Ideal is box/pulse in frequency space
Sinc in spatial domain But infinite spread

17 Truncated sinc © Kavita Bala, Computer Science, Cornell University

18 Gaussian Filter Gaussian is preferred because it is same in frequency and spatial domain Not perfect: attenuates

19 Mean vs. Gaussian filtering

20 Gaussian filter Removes “high-frequency” components from the image (low-pass filter) Convolution with self is another Gaussian Convolving twice with Gaussian kernel of width = convolving once with kernel of width * = Linear vs. quadratic in mask size Source: K. Grauman

21 Gaussian filters = 1 pixel = 5 pixels = 10 pixels = 30 pixels

22 Image Resampling

23 Image Scaling This image is too big to fit on the screen. How can we generate a half-sized version? Source: S. Seitz

24 Image sub-sampling 1/16 1/4 Throw away every other row and column to create a 1/2 size image - called image sub-sampling Source: S. Seitz

25 Image sub-sampling 1/2 1/4 (2x zoom) 1/16 (4x zoom)
Why does this look so crufty? Source: S. Seitz

26 Image sub-sampling Source: F. Durand

27 Wagon-wheel effect (See Source: L. Zhang

28 Aliasing Occurs when your sampling rate is not high enough to capture the amount of detail in your image Can give you the wrong signal/image—an alias To do sampling right, need to understand the structure of your signal/image Enter Monsieur Fourier… Source: L. Zhang

29 Nyquist-Shannon Sampling Theorem
When sampling a signal at discrete intervals, the sampling frequency must be  2  fmax fmax = max frequency of the input signal This will allows to reconstruct the original perfectly from the sampled version v v v good bad

30 Nyquist limit – 2D example
Good sampling Bad sampling

31 Aliasing When downsampling by a factor of two How can we fix this?
Original image has frequencies that are too high How can we fix this?

32 Gaussian pre-filtering
Solution: filter the image, then subsample Source: S. Seitz

33 Subsampling with Gaussian pre-filtering
Solution: filter the image, then subsample Source: S. Seitz

34 Compare with... 1/2 1/4 (2x zoom) 1/8 (4x zoom) Source: S. Seitz

35 Gaussian pre-filtering
Solution: filter the image, then subsample F1 F2 blur subsample blur subsample F0 H * F1 H *

36 { … F0 F0 H * Gaussian pyramid F1 F1 H * F2 blur subsample blur

37 Gaussian pyramids [Burt and Adelson, 1983]
In computer graphics, a mip map [Williams, 1983] Gaussian Pyramids have all sorts of applications in computer vision Source: S. Seitz

38 The Gaussian Pyramid Low resolution sub-sample blur sub-sample blur
High resolution

39 Gaussian pyramid and stack
Source: Forsyth

40 Memory Usage What is the size of the pyramid? 4/3

41 The Laplacian Pyramid Gaussian Pyramid Laplacian Pyramid - = - = - =

42 Laplacian pyramid Source: Forsyth

43 A. Oliva, A. Torralba, P.G. Schyns, “Hybrid Images,” SIGGRAPH 2006
PA1 (A): Hybrid Images A. Oliva, A. Torralba, P.G. Schyns, “Hybrid Images,” SIGGRAPH 2006 Gaussian Filter Laplacian Filter Source: Hays

44 Source: Hays Salvador Dali invented Hybrid Images? Salvador Dali
“Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln”, 1976 Source: Hays

45 Source: Hays Salvador Dali invented Hybrid Images? Salvador Dali
“Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln”, 1976 Source: Hays

46 Major uses of image pyramids
Compression Object detection Scale search Features Registration Course-to-fine


Download ppt "Lecture 5: Fourier and Pyramids"

Similar presentations


Ads by Google