Image Processing - Lesson 4 Introduction to Fourier Transform - Linear Systems • Linear Systems • A linear system T gets an input f(t) and produces an output g(t): Linear System Properties • A linear system must satisfy two conditions: – Homogeneity: Linear Systems • Definitions & Properties • Shift Invariant Linear Systems • Linear Systems and Convolutions • Linear Systems and sinusoids • Complex Numbers and Complex Exponentials • Linear Systems - Frequency Response f(t) T g ( t ) = T { f (t )} – Additivity: g(t) T {a f [n ]}= aT { f [n ]} T{ f1[n]+f2[n]}=T{ f1[n]}+T{ f2[n]} T T T Homogeneity • In the discrete caes: – input : f[n] , n = 0,1,2,… – output: g[n] , n = 0,1,2,… g[n] = T[f (n)] T Additivity T Linear System - Example • Contrast change by grayscale stretching around 0: T{f(x)} = af(x) – Homogeneity: T{bf(x)} = abf(x) = baf(x) = bT{f(x)} – Additivity: T{f1(x)+f2(x)} = a(f1(x)+f2(x)) = af1(x)+af2(x) = T{f1(x)}+ T{f2(x)} Linear System - Example • Convolution: Shift-Invariant Linear System • AssumeT is a linear system satisfying T{f(x)} = f*a – Homogeneity: T{bf(x)} = (bf)*a = b(f*a) = bT{f(x)} g (t ) = T { f (t )} • T is a shift-invariant linear system iff: g(t − t0 ) = T {f (t − t0 )} – Additivity: T{f1(x)+f2(x)} = (f1+ f2)*a = f1*a+f2*a = T{f1(x)}+ T{f2(x)} T Shift Invariant T Shift-Invariant Linear System - Example • Contrast change by grayscale stretching around 0: T{f(x)} = af(x) = g(x) – Shift Invariant : T{f(x-x0 )} = af(x-x0 ) =g(x-x0 ) • Convolution : T{f(x)} = f(x)*a =g(x) – Shift Invariant : T{f(x-x 0)} = f(x-x 0)*a = ∑ f ( i − x 0 )a( x − i ) = ∑ f( j) a( x − j − x 0 ) i j = g(x-x 0) Matrix Multiplication as a Linear System • Assume f is an input vector and T is a matrix multiplying f: g = Tf • g is an output vector. • Claim: A matrix multiplication is a linear system: – Homogeneity T (af ) =a T f – Additivity T (f1 + f 2 )= Tf1 + Tf 2 • Note that a matrix multiplication is not necessarily shift-invariant. Impulse Sequence • An impulse signal is defined as follows: 0 d[n − k ] = 1 where n≠k where n=k • Any signal can be represented as a linear sum of scales and shifted impulses: ∞ f [n ]= ∑ f [ j ]δ [n − j ] j = −∞ = + + Convolution as a Matrix Multiplication Shift-Invariant Linear System is a Convolution Convolution Properties • Commutative: T1 ∗ T2 ∗ f = T2 ∗T1 ∗ f Proof: • The convolution (wrap around): – f[n] input sequence – g[n] output sequence – h[n] the system impulse response: h[n]=T{δ[n]} ∞ g[n] = T {f [n ]}=T ∑ f [ j ]δ [ n− j] j= −∞ ∞ = ∑ f [ j ]T {δ [n − j ]} ( from linearity ) j =−∞ ∞ = ∑ f [ j ] h[n − j ] ( from shift − inariancce) [1 2 0 0 −1 − 2]∗[3 2 1] = [6 5 2 −3 − 8 − 2] can be represented as a matrix multiplication: Circulant Matrix 2 1 0 0 0 3 3 0 0 2 1 0 0 0 3 2 1 0 0 0 3 2 1 0 0 1 1 6 0 0 2 5 0 0 0 2 = 3 0 0 − 3 2 3 − 1 − 8 1 2 − 2 − 2 j =−∞ = f ∗h The output is a sum of scaled and shifted copies of impulse responses. – The matrix rows are flipped and shifted copies of the impulse response. – The matrix columns are shifted copies of the impulse response. – Only shift-invariant systems are commutative. – Only circulant matrices are commutative. • Associative: (T1∗T2 )∗ f = T1 ∗(T2 ∗ f ) – Any linear system is associative. • Distributive: (T1 +T2 )∗ f = T1 ∗ f +T2 ∗ f and T ∗( f1 + f2 )= T ∗ f1 + T ∗ f2 – Any linear system is distributive. Complex Numbers Algebraic operations : • Conjugate of Z is Imaginary • addition/subtraction: (a,b) b – Cartesian rep. (a + ib) = a − ib (a+ ib)+ (c+ id)= (a + c) + i(b + d) ∗ (Re ) = Re R The Complex Plane Aeia Bei ß = ABei (a+ß) a + bi = Re iθ b R where i 2 = − 1 • Norm: θ – The Polar representation: -θ (Complex exponential) a Real – Polar to Cartesian: Rei θ = R cos(θ ) + iR sin(θ ) −1 (b / a ) a + ib = ( a + ib) (a + ib) = a + b a − bi = Re− iθ ∗ 2 iθ 2 R -b • Conversions: a + bi = a2 + b2 e i tan • multiplication: (a + ib)( c + id) = (ac −bd) + i( bc + ad) Imaginary – The Cartesian representation: – Cartesian to Polar −i θ Real • Two kind of representations for a point (a,b) in the complex plane Z = a + bi iθ ∗ – Polar rep. θ a Z = Reiθ Z*: Re ( = Re 2 ) Re iθ ∗ iθ 2 = Re−iθ Reiθ = R2 The (Co-) Sinusoid – Changing Amplitude: A sin (2πωx ) 1 The (Co-) Sinusoidfunction ix e sin(x) • The (Co -)Sinusoid as complex exponential: A x eix + e− ix cos( x ) = 2 ix e −e 2i sin(x ) = cos(x) 1 x −ix sin (2πω x ) Or cos( x ) = Real (e ix ) – Changing Phase: A sin (2πω x + ϕ ) 1 x sin( x ) = Imag(e ix ) 1 – The wavelength of sin(2πω x) is eix sin(x) x cos(x) – The frequency is ω . 1 1 ω x . Scaling and shifting can be represented as a multiplication with Ae i ϕ A sin (2πω x + ϕ ) = Imag( Ae iϕ ei 2πω x ) Frequency Analysis Every function equals a sum of scaled and shifted Sines Frequency Method • If a function f(x) can be expressed as a linear sum of scaled and shifted sinusoids: it is possible to predict the system response to f(x): 3 sin(x) g ( x) = T { f (x )} = ∑ H (ω ) F (ω )e + 1 sin(3x) i 2πωx + + ω + 0.8 sin(5x) • The Fourier Transform : It is possible to express any signal as a sum of shifted and scaled sinusoids at different frequencies. f (x) = ∑ F (ω )e Or i 2πωx f ( x ) = ∫ F (ω ) e i 2πω x d ω ω Input Signal space/time Method = f ( x) = ∑ F (ω )ei2πω x ω Linear System Logic Express as sum of scaled and shifted sinusoids Express as sum of scaled and shifted impulses Calculate the response to each sinusoid Calculate the response to each impulse Sum the sinusoidal responses to determine the output Sum the impulse responses to determine the output + + 0.4 sin(7x) G(ω) = F(ω) H(ω) g (x) = f (x) ∗ h(x)