Frequency Domain Filtering

Similar documents
Fall 2011, EE123 Digital Signal Processing

Finite-length Discrete Transforms. Chapter 5, Sections

Chapter 8. DFT : The Discrete Fourier Transform

FIR Filter Design: Part II

The z-transform. 7.1 Introduction. 7.2 The z-transform Derivation of the z-transform: x[n] = z n LTI system, h[n] z = re j

Practical Spectral Anaysis (continue) (from Boaz Porat s book) Frequency Measurement

2D DSP Basics: 2D Systems

Ch3 Discrete Time Fourier Transform

Filter banks. Separately, the lowpass and highpass filters are not invertible. removes the highest frequency 1/ 2and

Frequency Response of FIR Filters

FFTs in Graphics and Vision. The Fast Fourier Transform

Z - Transform. It offers the techniques for digital filter design and frequency analysis of digital signals.

A. Basics of Discrete Fourier Transform

Vibratory Motion. Prof. Zheng-yi Feng NCHU SWC. National CHung Hsing University, Department of Soil and Water Conservation

Chapter 7: The z-transform. Chih-Wei Liu

3. Z Transform. Recall that the Fourier transform (FT) of a DT signal xn [ ] is ( ) [ ] = In order for the FT to exist in the finite magnitude sense,

6.003 Homework #12 Solutions

EE / EEE SAMPLE STUDY MATERIAL. GATE, IES & PSUs Signal System. Electrical Engineering. Postal Correspondence Course

EECE 301 Signals & Systems

The Discrete Fourier Transform

6.003 Homework #12 Solutions

ELEG3503 Introduction to Digital Signal Processing

ADVANCED DIGITAL SIGNAL PROCESSING

ECE-S352 Introduction to Digital Signal Processing Lecture 3A Direct Solution of Difference Equations

Signal Processing in Mechatronics. Lecture 3, Convolution, Fourier Series and Fourier Transform

Chapter 4. Fourier Series

Chapter 2 Systems and Signals

Optimum LMSE Discrete Transform

MAXIMALLY FLAT FIR FILTERS

Linear time invariant systems

Discrete-Time Systems, LTI Systems, and Discrete-Time Convolution

1 1 2 = show that: over variables x and y. [2 marks] Write down necessary conditions involving first and second-order partial derivatives for ( x0, y

EE422G Homework #13 (12 points)

x[0] x[1] x[2] Figure 2.1 Graphical representation of a discrete-time signal.

Discrete Orthogonal Moment Features Using Chebyshev Polynomials

FIR Filters. Lecture #7 Chapter 5. BME 310 Biomedical Computing - J.Schesser

Spring 2014, EE123 Digital Signal Processing

The Discrete Fourier Transform

The picture in figure 1.1 helps us to see that the area represents the distance traveled. Figure 1: Area represents distance travelled

: Transforms and Partial Differential Equations

Time-Domain Representations of LTI Systems

2 Geometric interpretation of complex numbers

Wavelet Transform and its relation to multirate filter banks

Apply change-of-basis formula to rewrite x as a linear combination of eigenvectors v j.

Chapter 7 z-transform

Question1 Multiple choices (circle the most appropriate one):

Signals & Systems Chapter3

The Method of Least Squares. To understand least squares fitting of data.

3.2 Properties of Division 3.3 Zeros of Polynomials 3.4 Complex and Rational Zeros of Polynomials

6.003 Homework #3 Solutions

Appendix: The Laplace Transform

Exponential Moving Average Pieter P

COMM 602: Digital Signal Processing

MAT1026 Calculus II Basic Convergence Tests for Series

Olli Simula T / Chapter 1 3. Olli Simula T / Chapter 1 5

ENGI Series Page 6-01

Math 234 Test 1, Tuesday 27 September 2005, 4 pages, 30 points, 75 minutes.

INFINITE SEQUENCES AND SERIES

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis

Lecture Notes for Analysis Class

Chapter 9: Numerical Differentiation

a for a 1 1 matrix. a b a b 2 2 matrix: We define det ad bc 3 3 matrix: We define a a a a a a a a a a a a a a a a a a

We are mainly going to be concerned with power series in x, such as. (x)} converges - that is, lims N n

Principle Of Superposition

Infinite Sequences and Series

(, ) (, ) (, ) ( ) ( )

Digital signal processing: Lecture 5. z-transformation - I. Produced by Qiangfu Zhao (Since 1995), All rights reserved

Module 18 Discrete Time Signals and Z-Transforms Objective: Introduction : Description: Discrete Time Signal representation

Math 113 Exam 3 Practice

CALCULATION OF FIBONACCI VECTORS

Dirichlet s Theorem on Arithmetic Progressions

Inverse Matrix. A meaning that matrix B is an inverse of matrix A.

Solutions. Number of Problems: 4. None. Use only the prepared sheets for your solutions. Additional paper is available from the supervisors.

TMA4205 Numerical Linear Algebra. The Poisson problem in R 2 : diagonalization methods

6.867 Machine learning, lecture 7 (Jaakkola) 1

, then cv V. Differential Equations Elements of Lineaer Algebra Name: Consider the differential equation. and y2 cos( kx)

Chapter 10: Power Series

CHAPTER I: Vector Spaces

Introduction to Signals and Systems, Part V: Lecture Summary

Sequences, Mathematical Induction, and Recursion. CSE 2353 Discrete Computational Structures Spring 2018

Math 113 Exam 3 Practice

John Riley 30 August 2016

a for a 1 1 matrix. a b a b 2 2 matrix: We define det ad bc 3 3 matrix: We define a a a a a a a a a a a a a a a a a a

Beurling Integers: Part 2

Let A(x) and B(x) be two polynomials of degree n 1:

Zeros of Polynomials

62. Power series Definition 16. (Power series) Given a sequence {c n }, the series. c n x n = c 0 + c 1 x + c 2 x 2 + c 3 x 3 +

Definition of z-transform.

Polynomial Functions and Their Graphs

Chimica Inorganica 3

Physics 324, Fall Dirac Notation. These notes were produced by David Kaplan for Phys. 324 in Autumn 2001.

Injections, Surjections, and the Pigeonhole Principle

Exam. Notes: A single A4 sheet of paper (double sided; hand-written or computer typed)

( a) ( ) 1 ( ) 2 ( ) ( ) 3 3 ( ) =!

Signal Processing in Mechatronics

Archimedes - numbers for counting, otherwise lengths, areas, etc. Kepler - geometry for planetary motion

PRELIM PROBLEM SOLUTIONS

Lecture 3: Divide and Conquer: Fast Fourier Transform

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science. BACKGROUND EXAM September 30, 2004.

AMS Mathematics Subject Classification : 40A05, 40A99, 42A10. Key words and phrases : Harmonic series, Fourier series. 1.

Transcription:

Frequecy Domai Filterig Raga Rodrigo October 19, 2010 Outlie Cotets 1 Itroductio 1 2 Fourier Represetatio of Fiite-Duratio Sequeces: The Discrete Fourier Trasform 1 3 The 2-D Discrete Fourier Trasform 4 Filterig i the Frequecy Domai 6 Obtaiig Frequecy Domai Filters from Spatial Domai Filters 8 1 Itroductio I the previous lecture we studied some spatial filterig techiques. However, to thoughtfully uderstad filterig, we eed the kowledge of the frequecy domai ad the Fourier trasform. The Fourier trasforms ad Fourier series are due to the Frech mathematicia Jea Baptiste Joseph Fourier. Fourier s cotributio states that ay periodic fuctio ca be expressed as the sum of sies ad or cosies of differet frequecies, each multiplied by a differet coefficiet. This sum is called the Fourier series. Eve fuctios that are ot periodic, but have fiite areas uder the curve, ca be expressed as a itegral of sies ad cosies multiplied by a weightig fuctio. We call this formulatio Fourier trasform. Both represetatio share the importat characteristic that a fuctio, expressed i either the Fourier series or trasform, ca be recostructed (recovered) via a iverse process. As the images that we will deal with are fuctios of fiite domai, we will study about the Fourier trasform. I particular we will study the two-dimesioal discrete Fourier trasform. 2 Fourier Represetatio of Fiite-Duratio Sequeces: The Discrete Fourier Trasform The Discrete Fourier Trasform 1

The discrete Fourier trasform is the Fourier represetatio of fiite-duratio sequeces. We begi by cosiderig a fiite-legth sequece x[] of legth N samples such that x[] = 0 outside the rage 0 N 1. To each fiite-legth sequece we ca always associate a periodic sequece x[]. The periodic sequece x[] is give by x[] = r = x[ + r N ]. The fiite-legth sequece x[] ca be recovered from x[]. { x[], 0 N 1, x[] = 0, otherwise. (1a) (1b) DFS coefficiets of x[] are samples (spaced i frequecy by 2π/N ) of the Fourier trasform of x[]. Sice x[] is assumed to have fiite legth N, there is o overlap betwee the terms x[ + r N ] for differet values of r. Thus Eq. 1a ca alteratively be writte as Usig the otatio (()) N to deote ( modulo N ); x[] = x[( modulo N )]. (2) x[] = x[(()) N ]. (3) The sequece of discrete Fourier series coefficiets X [k] of the periodic sequece x[] is itself a periodic sequece with period N. To maitai a duality betwee the time ad frequecy domais, we will choose the Fourier coefficiets that we associate with a fiite-duratio sequece to be a fiite-duratio sequece correspodig to oe period of X [k]. This fiite-duratio sequece, X [k], will be referred to as the discrete Fourier trasform (DFT). Thus the DFT, X [k], is related to the DFS coefficiets, X [k], by X [k] = { X [k], 0 k N 1, 0, otherwise, (4) ad X [k] = X [(k modulo N )] = X [((k)) N ]. () From our discussio o DFS, X [k] ad x[] are related by ad X [k] = x[]w k N, (6) x[] = 1 N =0 k=0 X [k]w k N. (7) 2

For coveiece, these equatios are ofte writte i terms of the complex quatity W N, defied as W N = e j (2π/N ). (8) Sice the summatio i Eqs. 6 ad 7 ivolve oly the iterval betwee 0 ad N 1, it follows that ad X [k] = { N 1 k =0 x[]w N 0 k N 1, 0, otherwise, { 1 N 1 x[] = X N [k]w k k=0 N 0 N 1, 0, otherwise. (9) (10) Geerally the DFT aalysis ad sythesis equatios are writte as Aalysis equatio: X [k] = x[]w k N, (11) =0 ad where Sythesis equatio: x[] = 1 N W N = e j (2π/N ). k=0 X [k]w k N. (12) That is, the fact that X [k] = 0 for k outside the iterval 0 k N 1 ad that x[] = 0 for outside the iterval 0 N 1 is implied but ot always stated explicitly. The relatioship betwee x[] ad X [k] implied by Eqs. 11 ad 12 will sometimes be deoted as x[] DF T X [k]. (13) I Eqs. 11 ad 12 for fiite-duratio sequece, we have ot elimiated the iheret periodicity. I defiig the DFT represetatio we are simply recogizig that we are iterested i values of x[] oly i the iterval 0 N 1 because x[] is really zero outside that iterval, ad we are iterested i values of X [k] oly i the iterval 0 k N 1 because these are the oly values eeded i Eq. 12. Example 1. Determie the DFT of the fiite-duratio sequece x[] show i Fig. 1 by cosiderig the legth to be 1. N =, ad 2. N = 10. 3

x[] Figure 1: Fiite-legth sequece x[]. x[] x[] X [k] X (e j ω ) -2-1 0 1 2 3 4 6 7 8 9 10 11 k, ω X [k] -2-1 0 1 2 3 4 6 7 8 9 10 11 k Figure 2: DFT for the fiite-legth sequece x[]. N =. x[] x[] X [k] X (e j ω ) -2-1 0 1 2 3 4 6 7 8 9 10 11 k, ω X [k] -2-1 0 1 2 3 4 6 7 8 9 10 11 k Figure 3: DFT for the fiite-legth sequece x[]. N = 10. 4

3 The 2-D Discrete Fourier Trasform 2-D DFT Equatio The 2-D discrete Fourier trasform (DFT) is give by F (u, v) = M 1 x=0 y=0 f (x, y)e j 2π(ux/M+v y/n ), (14) where f (x, y) is a digital image of size M N. x ad y are the spatial variables ad u ad v are the frequecy-domai variables. Equatio 14 must be evaluated for values of the discrete variables u ad v i the rages u = 0,1,..., M 1 ad v = 0,1,..., N 1. Iverse 2-D DFT Equatio Give the trasform F (u, v), we ca obtai f (x, y) by usig the iverse discrete Fourier trasform (IDFT): f (x, y) = 1 M N M 1 u=0 v=0 for x = 0,1,... M 1 ad y = 0,1,... N 1. F (u, v)e j 2π(ux/M+v y/n ), (1) Zero Ceterig Whe we apply Equatio 14 to obtai the DFT, the four corers of the DFT image will correspod to the low frequecies ad the ceter correspods to high frequecies. Visual aalysis of the spectrum is simplified by movig the values at the origi of the trasform to the ceter of the frequecy rectagle. This ca be accomplished by multiplyig f (x, y) by ( 1) x+y prior to the computatio of the 2-D Fourier trasform. Figure 4 shows the Fourier spectrum, this trasformatio ad visual ehacemet usig log(1 + F ). Usig Matlab for DFT The followig code will produce 4(b). f = imread ( image.bmp ) ; F = f f t 2 ( f ) ; S = abs (F ) ; imshow( S, [ ] ) ; The followig code will produce 4(c). f = imread ( image.bmp ) ; F = f f t 2 ( f ) ; Fc = f f t s h i f t (F ) ; imshow( abs ( Fc ), [ ] ) ; The followig code will produce 4(d). f = imread ( image.bmp ) ; F = f f t 2 ( f ) ; Fc = f f t s h i f t (F ) ; S2 = log (1+ abs ( Fc ) ) ; imshow( S2, [ ] ) ;

(a) Image (b) Fourier spectrum (c) Cetered spectrum (d) Ehaced spectrum Figure 4: DFT of a simple image. Zero Paddig If we are to use the DFT for filterig, it is ecessary to pad the iput image with zeros. I this case the sytax becomes F = f f t 2 ( f, P, Q) ; Here, fft2 pads the iput with the required umber of zeros so that the resultig fuctio is of size P Q. Iverse DFT Iverse DFT is computed as f = i f f t 2 (F ) ; To remove the possible small imagiary part, we may have to use f = r e a l ( i f f t 2 (F ) ) ; 4 Filterig i the Frequecy Domai Filterig i the frequecy domai is coceptually simple. The foudatio for liear filterig i both the spatial ad frequecy domai is the covolutio theorem. ad, coversely f (x, y) h(x, y) H(u, v)f (u, v) (16) f (x, y)h(x, y) H(u, v) F (u, v) (17) Here the symbol icidets the covolutio of the two fuctios. Whe the kerel h(x, y) is symmetric, this is similar to spatial filterig. These equatios show that the covolutio of two spatial fuctios correspod to the product of Fourier trasforms of the kerel ad the image. H(u, v) is referred to as the filter trasfer fuctio. 6

Basic Steps i DFT Filterig 1. Obtai the paddig parameters usig the fuctio paddedsize: PQ = paddedsize ( side ( f ) ) ; 2. Obtai the Fourier trasform with paddig: F = f f t 2 ( f, PQ( 1 ), PQ( 2 ) ) ; 3. Geerate a filter fuctio, H, of size PQ(1) PQ(2). The filter must also me cetered. 4. Multiply the trasform by the filter: G = H. * F ;. Obtai the real part of the iverse FFT of G: g = r e a l ( i f f t 2 (G) ) ; 6. Crop the top-left rectagle to the origial size: g = g ( 1 : s i z e ( f, 1 ), 1 : s i z e ( f, 2 ) ) ; A m-fuctio for Filterig i Frequecy Domai The six steps that we discussed above ca be captured i to a m-fuctio. Example 2. Write a m-fuctio that takes two argumets, a image f ad a filter trasfer fuctio H, ad geerates a filtered image g. What are the coditios ecessary? 7

Obtaiig Frequecy Domai Filters from Spatial Domai Filters I geeral, filterig i the spatial domai is more computatioally efficiet tha frequecy domai filterig whe the filters are small. Spatial filters ca be coverted to equivalet frequecy domai filters usig the freqz2 fuctio: H = freqz2 (h, R,C) where h is a 2-D spatial filter ad H is the correspodig 2-D frequecy domai filter. Here, R ad C are the umber of rows ad colums the we wish the filter H to have. Example 3. Obtai the frequecy domai filter correspodig to the Sobel filter to detect vertical edges. Example 4. Write a program to carry out Sobel filterig i frequecy domai. 8