Lecture 4 Filtering in the Frequency Domain Lin ZHANG, PhD School of Software Engineering Tongji University Spring 2016 Lin ZHANG, SSE, 2016
Outline • Background • From Fourier series to Fourier transform • Properties of the Fourier transform • Discrete Fourier transforms • The basics of filtering in the frequency domain • Image smoothing using frequency domain filters • Image sharpening using frequency domain filters Lin ZHANG, SSE, 2016
Background • Fourier analysis (Fourier series and Fourier transforms) is quite useful in many engineering fields • Linear image filtering can be performed in the frequency domain • A working knowledge of the Fourier analysis can help us have a thorough understanding of the image filtering Lin ZHANG, SSE, 2016
Background • Jean Baptiste Joseph Fourier was born in 1768, in France • Most famous for his work “La Théorie Analitique de la Chaleur” published in 1822 • Translated into English in 1878: “The Analytic Theory of Heat” 21 March 1768 – 16 May 1830 Lin ZHANG, SSE, 2016
Outline • Background • From Fourier series to Fourier transform • Properties of the Fourier transform • Discrete Fourier transforms • The basics of filtering in the frequency domain • Image smoothing using frequency domain filters • Image sharpening using frequency domain filters Lin ZHANG, SSE, 2016
Fourier Series • For any periodic function f ( t ) , how to extract the component of f at a specific frequency? is composed of the following components Lin ZHANG, SSE, 2016
Fourier Series • For any periodic function f ( t ) , how to extract the component of f at a specific frequency? Lin ZHANG, SSE, 2016
Fourier Series • For any periodic function f ( t ) , how to extract the component of f at a specific frequency? Lin ZHANG, SSE, 2016
Fourier Series • For any periodic function f ( t ) , how to extract the component of f at a specific frequency? Fourier Series Any periodic function can be expressed as a sum of sines and cosines of different frequencies each multiplied by a different coefficient a ( ) 0 cos sin f t a n t b n t 2 n n 1 n more details Lin ZHANG, SSE, 2016
Fourier Series ( ) For a periodic function , with period T f t Fourier Series a ( ) cos sin 0 f t a n t b n t n n 2 1 n where 2 T Redundant! 2 T 2 T ( ) ( )cos 2 2 a f t dt a f t n tdt , 0 T T n T T 2 2 2 T ( )sin 2 b f t n tdt T n T 2 Lin ZHANG, SSE, 2016
Fourier Transforms Fourier transform of f ( t ) (maybe is not periodic) is defined as 2 ( ) ( ) j t F f t e dt 2 ( ) ( ) j t Inverse Fourier transform f t F e d How to get these formulas? Let’s start the story from Fourier series to Fourier transform… Lin ZHANG, SSE, 2016
From Fourier Series to Fourier Transforms cos sin j According to Euler formula e j Easy to have jn t jn t jn t jn t e e e e cos ,sin n t n t j 2 2 Then, Fourier series become a ( ) cos sin 0 f t a n t b n t n n 2 1 n Lin ZHANG, SSE, 2016
From Fourier Series to Fourier Transforms cos sin j According to Euler formula e j Easy to have jn t jn t jn t jn t e e e e cos ,sin n t n t j 2 2 Then, Fourier series become jn t jn t jn t jn t a e e e e ( ) 0 f t a jb n n 2 2 2 1 n a a jb a jb 0 jn t jn t n n n n e e 2 2 2 1 n Then, let a a jb a jb 0 , , n n n n c c d 0 2 2 n 2 n Then, ( ) (1) jn t jn t f t c c e d e 0 n n 1 n Lin ZHANG, SSE, 2016
From Fourier Series to Fourier Transforms 1 T ( ) , 2 c f t dt 0 T T 2 1 T 1 T ( ) cos sin ( ) (2) 2 2 jn t c f t n t j n t dt f t e dt T T n T T 2 2 1 T 1 T ( ) cos sin ( ) 2 2 jn t d f t n t j n t dt f t e dt n T T T T 2 2 We can see that d c n n Thus, 1 (3) jn t jn t jn t d e c e c e n n n 1 1 n n n Lin ZHANG, SSE, 2016
From Fourier Series to Fourier Transforms ( ) (according to (1)) jn t jn t f t c c e d e 0 n n 1 n 0 j t jn t jn t c e c e d e 0 n n 1 1 n n 1 0 (according to (3)) j t jn t jn t c e c e c e 0 n n 1 n n jn t c c e ,where is defined by (2) n n n This is the Fourier series in complex form How about a non-periodic function? Lin ZHANG, SSE, 2016
From Fourier Series to Fourier Transforms ( ) f t is a non‐periodic function ( ) We make a new function which is periodic and the period f t T is T ( ) ( ), [ / 2, / 2] f t f t if t T T T ( ) T ( ) f t f t If , becomes T According to Fourier series 1 T ( ) , ( ) jn t jn t 2 f t c e c f t e dt T T n n T T 2 n n s Let n 1 T 1 T ( ) ( ) ( ) js t js t js t js t 2 2 f t f t e dt e f t e dt e n n n n T T T T T T T 2 2 n n Lin ZHANG, SSE, 2016
From Fourier Series to Fourier Transforms 1 T ( ) ( ) js t js t 2 f t f t e dt e n n T T T T 2 n when T 1 T ( ) lim ( ) lim ( ) js t js t 2 f t f t f t e dt e n n T T T T T T 2 n 2 2 s s s T 1 n n T s T s ( ) lim ( ) js t js t 2 f t f t e dt e n n T 2 T 0 s n 2 1 lim T ( ) 2 js t js t f t e dt e s n n T T 2 0 s 2 n Lin ZHANG, SSE, 2016
From Fourier Series to Fourier Transforms 1 T ( ) lim ( ) js t js t 2 f t f t e dt e s n n T T 2 0 s n 2 ( 0) when T s , s s , ds s n 1 ( ) ( ) jst jst f t f t e dt e ds 2 ( ) Denote by F s ( ) ( ) jst F s f t e dt Fourier transform 1 ( ) ( ) jst f t F s e ds Inverse Fourier transform 2 Lin ZHANG, SSE, 2016
From Fourier Series to Fourier Transforms ( ) ( ) jst F s f t e dt 1 ( ) ( ) jst f t F s e ds 2 s here actually is the angular frequency In the signal processing domain, we usually use another form by 2 s substituting s by , where is the frequency (measured by Herz) 2 ( ) ( ) j t F f t e dt 2 ( ) ( ) j t f t F e d Lin ZHANG, SSE, 2016
Related Concepts to Fourier Transform F ( ) • Fourier transform is complex in general ( ) ( )cos(2 ) ( )sin(2 ) F f t t dt j f t t dt ( ) ( ) R jI In polar form, it can be expressed as e ( ) ( ) ( ) j F F where ( ) I 2 2 1/2 ( ) ( ( ) ( )) , ( ) atan 2 F R I u ( ) R Fourier Spectrum Phase Angle 2 2 2 ( ) ( ) ( ) ( ) P F R I is called the power spectrum Lin ZHANG, SSE, 2016
Related Concepts to Fourier Transform Implementation Tips 1) For computing the image’s Fourier transform, you can use fft2() 2) ifft2() can compute the inverse Fourier transform 3) abs() can compute the Fourier spectrum 4) angle() can compute the phase angle Lin ZHANG, SSE, 2016
Recommend
More recommend