1 / 53

CIS 350 – 4 The FREQUENCY Domain

CIS 350 – 4 The FREQUENCY Domain. Dr. Rolf Lakaemper. Some of these slides base on the textbook Digital Image Processing by Gonzales/Woods Chapter 4. Frequency Domain. So far we processed the image ‘directly’, i.e. the transformation was a function of the image itself.

aleron
Download Presentation

CIS 350 – 4 The FREQUENCY Domain

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CIS 350 – 4 The FREQUENCY Domain Dr. Rolf Lakaemper

  2. Some of these slides base on the textbook Digital Image Processing by Gonzales/Woods Chapter 4

  3. Frequency Domain So far we processed the image ‘directly’, i.e. the transformation was a function of the image itself. We called this the SPATIAL domain. So what’s the FREQUENCY domain ?

  4. Sound Let’s first forget about images, and look at SOUND. SOUND: 1 dimensional function of changing (air-)pressure in time Pressure Time t

  5. Sound SOUND: if the function is periodic, we perceive it as sound with a certain frequency (else it’s noise). The frequency defines the pitch. Pressure Time t

  6. Sound The AMPLITUDE of the curve defines the VOLUME

  7. Sound The SHAPE of the curve defines the sound character String Flute Brass

  8. Sound How can the SHAPE of the curve be defined ?

  9. Sound Listening to an orchestra, you can distinguish between different instruments, although the sound is a SINGLE FUNCTION ! Flute Brass String

  10. Sound If the sound produced by an orchestra is the sum of different instruments, could it be possible that there are BASIC SOUNDS, that can be combined to produce every single sound ?

  11. Sound The answer (Charles Fourier, 1822): Any function that periodically repeats itself can be expressed as the sum of sines/cosines of different frequencies, each multiplied by a different coefficient

  12. Sound Or differently: Since a flute produces a sine-curve like sound, a (huge) group of (outstanding) talented flautists could replace a classical orchestra. (Don’t take this remark seriously, please)

  13. 1D Functions • A look at SINE / COSINE • The sine-curve is defined by: • Frequency (the number of oscillations between 0 and 2*PI) • Amplitude (the height) • Phase (the starting angle value) • The constant y-offset, or DC (direct current)

  14. 1D Functions The general sine-shaped function: f(t) = A * sin(t + ) + c Amplitude Frequency Phase Constant offset (usually set to 0)

  15. 1D Functions Remember Fourier: …A function…can be expressed as the sum of sines/cosines… What happens if we add sine and cosine ?

  16. 1D Functions a * sin(t) + b * cos(t) = A * sin(t + ) (with A=sqrt(a^2+b^2) and tan  = b/a) • Adding sine and cosine of the same frequency yields just another sine function with different phase and amplitude, but same frequency. Or: adding a cosine simply shifts the sine function left/right and stretches it in y-direction. It does NOT change the sine-character and frequency of the curve.

  17. 1D Functions Remember Fourier, part II: Any function that periodically repeats itself… => To change the shape of the function, we must add sine-like functions with different frequencies.

  18. 1D Functions This applet shows the result: Applet: Fourier Synthesis

  19. 1D Functions • What did we do ? • Choose a sine curve having a certain frequency, called the base-frequency • Choose sine curves having an integer multiple frequency of the base-frequency • Shift each single one horizontally using the cosine-factor • Choose the amplitude-ratio of each single frequency • Sum them up

  20. 1D Functions This technique is called the FOURIER SYNTHESIS, the parameters needed are the sine/cosine ratios of each frequency. The parameters are called the FOURIER COEFFICIENTS

  21. 1D Functions As a formula: f(x)= a0/2 + k=1..n akcos(kx) + bksin(kx) Fourier Coefficients

  22. 1D Functions Note: The set of ak, bk TOTALLY defines the CURVE synthesized ! We can therefore describe the SHAPE of the curve or the CHARACTER of the sound by the (finite ?) set of FOURIER COEFFICIENTS !

  23. 1D Functions Examples for curves, expressed by the sum of sines/cosines (the FOURIER SERIES):

  24. 1D Functions SAWTOOTH Function f(x) = ½ - 1/pi * n 1/n *sin (n*pi*x)

  25. 1D Functions SQUARE WAVE Function f(x) = 4/pi * n=1,3,5 1/n *sin (n*pi*x)

  26. 1D Functions What does the set of FOURIER COEFFICIENTS tell about the character of the shape ? (MATLAB Demo)

  27. 1D Functions Result: Steep slopes introduce HIGH FREQUENCIES.

  28. 1D Functions Motivation for Image Processing: Steep slopes showed areas of high contrast… …so it would be nice to be able to get the set of FOURIER COEFFICIENTS if an arbitrary (periodically) function is given. (So far we talked about 1D functions, not images, this was just a motivation)

  29. 1D Functions The Problem now: Given an arbitrary but periodically 1D function (e.g. a sound), can you tell the FOURIER COEFFICIENTS to construct it ?

  30. 1D Functions The answer (Charles Fourier): YES.

  31. 1D Functions We don’t want to explain the mathematics behind the answer here, but simply use the MATLAB Fourier Transformation Function. Later we’ll understand what’s going on

  32. 1D Functions MATLAB - function fft: Input: A vector, representing the discrete function Output: The Fourier Coefficients as vector of imaginary numbers, scaled for some reasons

  33. 1D Functions Example: x=0:2*pi/(2047):2*pi; s=sin(x)+cos(x) + sin(2*x) + 0.3*cos(2*x); f=fft(s); cos sin Freq. 0 Freq. 1 Freq. 2 Freq. 3

  34. 1D Functions Transformation: t(a) = 2*a / length(result-vector)

  35. 1D Functions The fourier coefficients are given by: F=fft(function) L=length(F); %this is always = length(function) Coefficient for cosine, frequency k-times the base frequency: real(F(k+1)) * 2 / L Coefficient for sine, frequency k-times the base frequency: imag(F(k+1)) * 2 / L

  36. 1D Functions An application using the Fourier Transform: Create an autofocus system for a digital camera We did this already, but differently ! (MATLAB DEMO)

  37. 1D Functions Second application: Describe and compare 2-dimensional shapes using the Fourier Transform !

  38. 2D Functions From Sound to Images: 2D Fourier Transform

  39. 2D Functions The idea: Extend the base functions to 2 dimensions: fu(x) = sin(ux)  fu,v(x,y) = sin(ux + vy)

  40. 2D Functions Some examples: The base function, direction x: u=1, v=0 x y

  41. 2D Functions The base function, direction y: u=0, v=1

  42. 2D Functions u=2, v=0

  43. 2D Functions u=0, v=2

  44. 2D Functions u=1, v=1

  45. 2D Functions u=1, v=2

  46. 2D Functions u=1, v=3

  47. 2D Functions As in 1D, the 2D image can be phase-shifted by adding a weighted cosine function: fu,v(x,y) = ak sin(ux + vy) + bk cos(ux + vy) + =

  48. 2D Functions As basic functions, we get a pair of sine/cosine functions for every pair of frequency-multiples (u,v): u sin sin sin sin cos cos cos cos v sin sin sin sin cos cos cos cos sin sin sin sin cos cos cos cos

  49. 2D Functions Every single sin/cos function gets a weight, which is the Fourier Coefficient: u a a a a b b b b v a a a a b b b b a a a a b b b b

  50. 2D Functions Summing all basic functions with their given weight gives a new function. As in 1D: Every 2D function can be synthesized using the basic functions with specific weights. As in 1D: The set of weights defines the 2D function.

More Related