Review – Frequency Domain Techniques BBM 413 Fundamentals of • Thinking images in terms of frequency. Image Processing • Treat images as infinite-size, continuous periodic ...& functions. Erkut Erdem )& Dept. of Computer Engineering Hacettepe University ...& =& =& ...& Frequency Domain Techniques – Part 2 ...& Review - Fourier Transform Review - Fourier Transform • Fourier transform stores the magnitude and phase at each We want to understand the frequency w of our signal. So, let ’ s frequency reparametrize the signal by w instead of x : – Magnitude encodes how much signal there is at a particular frequency Fourier – Phase encodes spatial information (indirectly) f( f(x) F( F(w) – For mathematical convenience, this is often notated in terms of real and Transform complex numbers For every w from 0 to inf, F(w) holds the amplitude A and A sin( ω x I ( ) phase f of the corresponding sine + φ ) ω 2 2 tan 1 A R ( ) I ( ) − Amplitude: Phase: φ = = ± ω + ω • How can F hold both? Complex number trick! R ( ) ω F ( ) R ( ) iI ( ) ω = ω + ω I ( ) ω tan 1 A R ( ) 2 I ( ) 2 − = ± ω + ω φ = R ( ) ω We can always go back: Inverse Fourier F(w) F( f(x) f( Transform Slide credit: A. Efros
Review - Discrete Fourier transform Review - The Fourier Transform • Represent function on a new basis • Forward transform – Think of functions as vectors, with many components M − 1 N − 1 1 ∑ ∑ f ( x , y ) e − j 2 π ( ux / M + vy / N ) F ( u , v ) = – We now apply a linear transformation to transform MN the basis x = 0 y = 0 for u = 0,1,2,..., M − 1, v = 0,1,2,..., N − 1 • dot product with each basis element • In the expression, u and v select the basis • Inverse transform element, so a function of x and y becomes a M 1 N 1 − − = ∑∑ j π 2 ( ux / M vy / N ) f ( x , y ) F ( u , v ) e + function of u and v Euler’s definition of e iθ u 0 v 0 = = ( ) • basis elements have the form e − i 2 π ux + vy for x 0 , 1 , 2 ,..., M 1 , y 0 , 1 , 2 ,..., N 1 = − = − u , v : the transform or frequency variables x , y : the spatial or image variables Slide credit: B. Freeman and A. Torralba Slide credit: S. Thrun Review - The Fourier Transform Review - The Convolution Theorem • The Fourier transform of the convolution of two Vertical orientation Low spatial frequencies functions is the product of their Fourier transforms 45 deg. F[ g h ] F[ g ] F[ h ] ∗ = Horizontal 0 orientation • The inverse Fourier transform of the product of two Fourier transforms is the convolution of the two inverse Fourier transforms High 0 f max spatial 1 1 1 fx in cycles/image F [ gh ] F [ g ] F [ h ] frequencies − − − = ∗ Log power spectrum • Convolution in spatial domain is equivalent to multiplication in frequency domain! Slide credit: B. Freeman and A. Torralba Slide credit: A. Efros
Review - Filtering in frequency Today domain • Sampling FFT • Gabor wavelets, Steerable filters FFT = Inverse FFT Slide credit: D. Hoiem Today Sampling • Sampling Why does a lower resolution image still make sense to us? What do we lose? • Gabor wavelets, Steerable filters Image: http://www.flickr.com/photos/igorms/136916757/ Slide credit: D. Hoiem
Sampled representations Reconstruction • How to store and compute with continuous functions? • Making samples back into a continuous function – for output (need realizable method) • Common scheme for representation: samples – for analysis or processing (need mathematical method) – write down the function ’ s values at many points – amounts to “ guessing ” what the function did in between Slide credit: S. Marschner Slide credit: S. Marschner Sampling in digital audio Sampling Theorem ( ) f x Continuous signal: • Recording: sound to analog to samples to disc (Real world signal) • Playback: disc to samples to analog to sound again – how can we be sure we are filling in the gaps correctly? x Shah function (Impulse train): ∞ (What the image measures) s ( ) x ( x nx ) ∑ = δ − s ( ) x 0 n = −∞ x x 0 Sampled function: ∞ ( ) ( ) ( ) ( ) ( ) f x f x s x f x x nx ∑ = = δ − s 0 n = −∞ Slide credit: S. Marschner Slide credit: S. Narasimhan
FT of an “impulse train” Sampling Theorem Fourier Transform Pairs is an impulse train! Sampled function: 1 Sampling ∞ f ( ) x f ( ) ( ) x s x f ( ) x ( x nx ) frequency x ∑ = = δ − 0 s 0 n = −∞ ∞ ( ) ∗ 1 δ u − n $ ' ( ) = F u ( ) ∗ S u ( ) = F u ∑ F S u & ) x 0 x 0 % ( n = −∞ F ( ) u A u u max Note that these are derived using iux angular frequency ( e − ) Slide credit: S. Narasimhan Slide credit: S. Narasimhan Sampling Theorem Sampling Theorem Sampled function: Sampled function: 1 1 Sampling Sampling ∞ ∞ ( ) ( ) ( ) ( ) ( ) frequency x ( ) ( ) ( ) ( ) ( ) frequency x f x f x s x f x ∑ x nx f x f x s x f x ∑ x nx = = δ − = = δ − 0 0 s 0 s 0 n n = −∞ = −∞ ( ) ∗ 1 ∞ δ u − n $ ' ( ) ∗ 1 ∞ δ u − n $ ' ( ) = F u ( ) ∗ S u ( ) = F u ∑ ( ) = F u ( ) ∗ S u ( ) = F u ∑ F S u F S u & ) & ) x 0 x 0 x 0 x 0 % ( % ( n = −∞ n = −∞ ( ) S u ( ) ( ) F S u F u ( ) F u A A * A x 0 u u u u u u max max max 1 x 0 Slide credit: S. Narasimhan Slide credit: S. Narasimhan
Subsampling by a factor of 2 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 Throw away every other row and column to create a 1/2 size image Slide credit: S. Marschner Slide credit: D. Hoiem Aliasing problem • Sub-sampling may be dangerous…. • Characteristic errors may appear: – “ Wagon wheels rolling the wrong way in movies ” – “ Checkerboards disintegrate in ray tracing ” – “ Striped shirts look funny on color television ” Moire patterns in real-world images. Here are comparison images by Dave Etchells of Imaging Resource using the Canon D60 (with an antialias filter) and the Sigma SD-9 (which has no antialias filter). The bands below the fur in the image at right are the kinds of artifacts that appear in images when no antialias filter is used. Sigma chose to eliminate the filter to get more sharpness, but the resulting apparent detail may or may not reflect features in the image. Slide credit: D. Forsyth Slide credit: N. Kumar
Aliasing in video More examples Check out Moire patterns on the web. Slide credit: A. Farhadi Slide credit: S. Seitz Sampling and aliasing Aliasing in graphics Slide credit: A. Efros Slide credit: D. Hoiem
Sampling Theorem Nyquist Frequency F S ( ) u 1 Sampled function: If u > 1 Sampling max 2 x A ∞ x Aliasing 0 f ( ) x f ( ) ( ) x s x f ( ) x ( x nx ) frequency x ∑ 0 = = δ − 0 s 0 n = −∞ u u max ∞ ( ) ∗ 1 δ u − n $ ' 1 x ( ) = F u ( ) ∗ S u ( ) = F u ∑ F S u 0 & ) x 0 x 0 % ( n = −∞ When can we recover from ? ( ) F ( ) u F S u F S ( ) u F ( ) u 1 Only if u (Nyquist Frequency) ≤ max 2 x A A 0 x We can use 0 1 x u $ < ! 2 x 0 C ( ) u u u u u = # 0 max max 0 otherwise ! " 1 x 0 ( ) [ ( ) ] F ( ) u F ( ) ( ) u C u f x IFT F u Then and = = S 2 u Sampling frequency must be greater than max Slide credit: S. Narasimhan Slide credit: S. Narasimhan 2D example Nyquist-Shannon Sampling Theorem • When sampling a signal at discrete intervals, the sampling frequency must be ≥ 2 × f max • f max = max frequency of the input signal Good sampling • This will allows to reconstruct the original perfectly from the sampled version good v v v Bad sampling bad Slide credit: N. Kumar Slide credit: D. Hoiem
Recommend
More recommend