Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick CS 4495 Computer Vision Frequency2: Sampling and Aliasing Aaron Bobick School of Interactive Computing
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Administrivia • Project 1 is due tonight. Submit what you have at the deadline. • Next problem set – stereo – will be out Thursday Sept. 11 and will be due Tuesday evening, Sept 23 rd , 11:55pm. • It is easier… • Readings for this week: Still FP Chapter 4
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Salvador Dali “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln ”, 1976
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Fourier: A nice set of basis Teases away fast vs. slow changes in the image.
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Fourier Transform We want to understand the frequency ω of our signal. So, let’s reparametrize the signal by ω instead of x : ω x + φ ) A sin( F( ω ) Fourier f(x) Transform For every ω from 0 to inf, (actually –inf to inf), F( ω ) holds the amplitude A and phase φ of the corresponding sine • How can F hold both? Complex number trick! = ± ω + ω 2 2 A R ( ) I ( ) ω = ω + ω ω F ( ) R ( ) iI ( ) I ( ) − φ = tan 1 ω R ( ) Even Odd And we can go back: F( ω ) Inverse Fourier f(x) Transform
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Frequency Spectra – Even/Odd Frequency actually goes from –inf to inf. Sinusoid example: Even (cos) Odd (sin) Magnitude ω ω ω Imaginary Real Power
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick 2D Fourier Transforms • The two dimensional version: . ( ) ( ) = ∫ ∞ ∞ + ∫ − π 2 ( ux vy ) i F u v , f x y e , dx dy − ∞ −∞ • And the 2D Discrete FT : + π k x k y 1 2 ( ) x y = − = − − y N 1 x N 1 = ∑ ∑ i F k ( , k ) f x ( , ) y e N x y N = = 0 0 x y • Works best when you put the origin of k in the middle….
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Linearity of Sum 50 50 50 100 100 100 150 150 150 200 200 200 250 250 250 50 100 150 200 250 50 100 150 200 250 + = 50 100 150 200 250 20 20 20 40 40 40 60 60 60 80 80 80 100 100 100 120 120 120 20 40 60 80 100 120 20 40 60 80 100 120 20 40 60 80 100 120
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Extension to 2D – Complex plane Both a Real and Im version
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Examples B.K. Gunturk
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Fourier Transform and Convolution = ∗ Let g f h ( ) ∞ ( ) ∫ − i π = 2 ux Then G u g x e dx − ∞ ∞ ∞ ( ) ( ) ∫ ∫ − π = τ − τ τ i 2 ux f h x e d dx − ∞ − ∞ [ ] ( [ ] ∞ ∞ ( ) ) ( ) ∫ ∫ − π τ − π − τ = τ τ − τ i 2 u i 2 u x f e d h x e dx − ∞ − ∞ [ ] [ ] ∞ ( ) ∞ ( ) ∫ ∫ = τ − π τ τ − π i 2 u i 2 ux ' f e d h x ' e dx ' − ∞ − ∞ ( ) ( ) = F u H u Convolution in spatial domain ⇔ Multiplication in frequency domain
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Fourier Transform and Convolution Spatial Domain (x) Frequency Domain (u) = ∗ G = g f h FH g = = ∗ fh G F H So, we can find g(x) by Fourier transform = ∗ g f h IFT FT FT = × G F H
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Example use: Smoothing/Blurring • We want a smoothed function of f(x) ( ) ( ) ( ) = ∗ g x f x h x ( ) • Let us use a Gaussian kernel h x − 2 ( ) 1 1 x = h x exp σ σ π σ 2 2 2 x ( ) • Convolution in space is multiplication in freq: H u 1 ( ) ( ) ( ) = Fat Gaussian in space is πσ G u F u H u 2 skinny Gaussian in frequency. Why? u H(u) attenuates high frequencies in F(u) (Low-pass Filter)!
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick 2D convolution theorem example |F (s x ,s y )| f ( x , y ) ( or |F(u,v)| ) * h ( x , y ) |H (s x ,s y )| g ( x , y ) |G (s x ,s y )|
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Low and High Pass filtering Ringing
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Fourier Transform smoothing pairs
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Properties of Fourier Transform Spatial Domain (x) Frequency Domain (u) ( ) ( ) ( ) ( ) + + c f x c g x c F u c G u Linearity 1 2 1 2 Shrink 1 u ( ) F f ax Scaling Stretch a a ( ) ( ) − − 2 π i ux f x x e F u Shifting 0 0 ( ) ( ) f − F x u Symmetry ( ) ( ) f ∗ ∗ − x F u Conjugation ( ) ( ) ( ) ( ) ∗ f x g x F u G u Convolution ( ) n ( ) ( ) d f x π n 2 Differentiation i u F u Differentiate n dx Multiply by u
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Fourier Pairs (from Szeliski)
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Fourier Transform Sampling Pairs FT of an “impulse train” is an impulse train
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Sampling and Aliasing
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Sampling and Reconstruction
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Sampled representations • How to store and compute with continuous functions? • Common scheme for representation: samples • write down the function’s values at many points S. Marschner
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Reconstruction • Making samples back into a continuous function • for output (need realizable method) • for analysis or processing (need mathematical method) • amounts to “guessing” what the function did in between S. Marschner
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick 1D Example: Audio low high frequencies
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Sampling in digital audio • Recording: sound to analog to samples to disc • Playback: disc to samples to analog to sound again • how can we be sure we are filling in the gaps correctly? S. Marschner
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Sampling and Reconstruction • Simple example: a sign wave S. Marschner
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Undersampling • What if we “missed” things between the samples? • Simple example: undersampling a sine wave • unsurprising result: information is lost S. Marschner
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Undersampling • What if we “missed” things between the samples? • Simple example: undersampling a sine wave • unsurprising result: information is lost • surprising result: indistinguishable from lower frequency S. Marschner
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Undersampling • What if we “missed” things between the samples? • Simple example: undersampling a sine wave • unsurprising result: information is lost • surprising result: indistinguishable from lower frequency • also was always indistinguishable from higher frequencies • aliasing : signals “traveling in disguise” as other frequencies S. Marschner
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Aliasing in video S. Seitz
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Aliasing in images
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick What’s happening? Input signal: Plot as image: Alias! Not enough samples x = 0:.05:5; imagesc(sin((2.^x).*x))
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Antialiasing What can we do about aliasing? • Sample more often • Join the Mega-Pixel craze of the photo industry • But this can’t go on forever • Make the signal less “wiggly” • Get rid of some high frequencies • Will loose information • But it’s better than aliasing •
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick Preventing aliasing • Introduce lowpass filters: • remove high frequencies leaving only safe, low frequencies • choose lowest frequency in reconstruction (disambiguate) S. Marschner
Frequency and Fourier Transform CS 4495 Computer Vision – A. Bobick (Anti)Aliasing in the Frequency Domain
Recommend
More recommend