Digital Image Processing Filtering in the Frequency Domain






























![Circular shift 31 • Signal x[n] of length N. • A circular shift ensures Circular shift 31 • Signal x[n] of length N. • A circular shift ensures](https://slidetodoc.com/presentation_image_h2/5f87ede26e68bc14458c8f84de394cea/image-31.jpg)
![Circular convolution 32 g[n]=f [n] h[n] Circular shift modulo N The result is of Circular convolution 32 g[n]=f [n] h[n] Circular shift modulo N The result is of](https://slidetodoc.com/presentation_image_h2/5f87ede26e68bc14458c8f84de394cea/image-32.jpg)
![33 Circular convolution (cont. ) g[n]=f [n] h[n] C. Nikou – Digital Image Processing 33 Circular convolution (cont. ) g[n]=f [n] h[n] C. Nikou – Digital Image Processing](https://slidetodoc.com/presentation_image_h2/5f87ede26e68bc14458c8f84de394cea/image-33.jpg)
![DFT and convolution 34 g[n]=f [n] h[n] • The property holds for the circular DFT and convolution 34 g[n]=f [n] h[n] • The property holds for the circular](https://slidetodoc.com/presentation_image_h2/5f87ede26e68bc14458c8f84de394cea/image-34.jpg)
![35 DFT and convolution (cont. ) g[n]=f [n] h[n] • Let f [n] be 35 DFT and convolution (cont. ) g[n]=f [n] h[n] • Let f [n] be](https://slidetodoc.com/presentation_image_h2/5f87ede26e68bc14458c8f84de394cea/image-35.jpg)

























- Slides: 60
Digital Image Processing Filtering in the Frequency Domain (Fundamentals) Christophoros Nikou cnikou@cs. uoi. gr University of Ioannina - Department of Computer Science
2 Filtering in the Frequency Domain Filter: A device or material for suppressing or minimizing waves or oscillations of certain frequencies. Frequency: The number of times that a periodic function repeats the same sequence of values during a unit variation of the independent variable. Webster’s New Collegiate Dictionary C. Nikou – Digital Image Processing (E 12)
3 Jean Baptiste Joseph Fourier was born in Auxerre, France in 1768. – 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”. Nobody paid much attention when the work was first published. One of the most important mathematical theories in modern engineering. C. Nikou – Digital Image Processing (E 12)
The Big Idea Images taken from Gonzalez & Woods, Digital Image Processing (2002) 4 = Any function that periodically repeats itself can be expressed as a sum of sines and cosines of different frequencies each multiplied by a different coefficient – a Fourier series C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 5 1 D continuous signals • It may be considered both as continuous and discrete. • Useful for the representation of discrete signals through sampling of continuous signals. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 6 1 D continuous signals (cont. ) Impulse train function C. Nikou – Digital Image Processing (E 12)
1 D continuous signals (cont. ) Images taken from Gonzalez & Woods, Digital Image Processing (2002) 7 C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 8 1 D continuous signals (cont. ) • The Fourier series expansion of a periodic signal f (t). C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 9 1 D continuous signals (cont. ) • The Fourier transform of a continuous signal f (t). • Attention: the variable is the frequency (Hz) and not the radial frequency (Ω=2πμ) as in the Signals and Systems course. C. Nikou – Digital Image Processing (E 12)
1 D continuous signals (cont. ) Images taken from Gonzalez & Woods, Digital Image Processing (2002) 10 C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 11 1 D continuous signals (cont. ) • Convolution property of the FT. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 12 1 D continuous signals (cont. ) • Intermediate result − The Fourier transform of the impulse train. • It is also an impulse train in the frequency domain. • Impulses are equally spaced every 1/ΔΤ. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 13 1 D continuous signals (cont. ) Sampling C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 14 1 D continuous signals (cont. ) • Sampling − The spectrum of the discrete signal consists of repetitions of the spectrum of the continuous signal every 1/ΔΤ. − The Nyquist criterion should be satisfied. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 15 1 D continuous signals (cont. ) Nyquist theorem C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 16 1 D continuous signals (cont. ) FT of a continuous signal Oversampling Critical sampling with the Nyquist frequency Undersampling Aliasing appears C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 17 1 D continuous signals (cont. ) • Reconstruction (under correct sampling). C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 18 1 D continuous signals (cont. ) • Reconstruction − Provided a correct sampling, the continuous signal may be perfectly reconstructed by its samples. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 19 1 D continuous signals (cont. ) • Under aliasing, the reconstruction of the continuous signal not correct. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 20 1 D continuous signals (cont. ) Aliased signal C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 21 The Discrete Fourier Transform • The Fourier transform of a sampled (discrete) signal is a continuous function of the frequency. • For a N-length discrete signal, taking N samples of its Fourier transform at frequencies: provides the discrete Fourier transform (DFT) of the signal. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 22 The Discrete Fourier Transform (cont. ) • DFT pair of signal f [n] of length N. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 23 The Discrete Fourier Transform (cont. ) • Property – The DFT of a N-length f [n] signal is periodic with period N. – This is due to the periodicity of the complex exponential: C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 24 The Discrete Fourier Transform (cont. ) • Property: sum of complex exponentials The proof is left as an exercise. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 25 The Discrete Fourier Transform (cont. ) • DFT pair of signal f [n] of length N may be expressed in matrix-vector form. C. Nikou – Digital Image Processing (E 12)
26 The Discrete Fourier Transform (cont. ) C. Nikou – Digital Image Processing (E 12)
27 The Discrete Fourier Transform (cont. ) Example for N=4 C. Nikou – Digital Image Processing (E 12)
28 The Discrete Fourier Transform (cont. ) The inverse DFT is then expressed by: This is derived by the complex exponential sum property. C. Nikou – Digital Image Processing (E 12)
29 Linear convolution is of length N=N 1+N 2 -1=4 C. Nikou – Digital Image Processing (E 12)
30 Linear convolution (cont. ) C. Nikou – Digital Image Processing (E 12)
Circular shift 31 • Signal x[n] of length N. • A circular shift ensures that the resulting signal will keep its length N. • It is a shift modulo N denoted by • Example: x[n] is of length N=8. C. Nikou – Digital Image Processing (E 12)
Circular convolution 32 g[n]=f [n] h[n] Circular shift modulo N The result is of length C. Nikou – Digital Image Processing (E 12)
33 Circular convolution (cont. ) g[n]=f [n] h[n] C. Nikou – Digital Image Processing (E 12)
DFT and convolution 34 g[n]=f [n] h[n] • The property holds for the circular convolution. • In signal processing we are interested in linear convolution. • Is there a similar property for the linear convolution? C. Nikou – Digital Image Processing (E 12)
35 DFT and convolution (cont. ) g[n]=f [n] h[n] • Let f [n] be of length N 1 and h[n] be of length N 2. • Then g[n]=f [n]*h[n] is of length N 1+N 2 -1. • If the signals are zero-padded to length N=N 1+N 2 -1 then their circular convolution will be the same as their linear convolution: Zero-padded signals C. Nikou – Digital Image Processing (E 12)
36 DFT and convolution (cont. ) Zero-padding to length N=N 1+N 2 -1 =4 The result is the same as the linear convolution. C. Nikou – Digital Image Processing (E 12)
37 DFT and convolution (cont. ) Verification using DFT C. Nikou – Digital Image Processing (E 12)
38 DFT and convolution (cont. ) Element-wise multiplication C. Nikou – Digital Image Processing (E 12)
39 DFT and convolution (cont. ) Inverse DFT of the result The same result as their linear convolution. C. Nikou – Digital Image Processing (E 12)
2 D continuous signals Images taken from Gonzalez & Woods, Digital Image Processing (2002) 40 Separable: C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 41 2 D continuous signals (cont. ) The 2 D impulse train is also separable: C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 42 2 D continuous signals (cont. ) • The Fourier transform of a continuous 2 D signal f (x, y). C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 43 2 D continuous signals (cont. ) • Example: FT of f (x, y)=δ(x) y f (x, y)=δ(x) x ν F(μ, ν)=δ(ν) μ C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 44 2 D continuous signals (cont. ) • Example: FT of f (x, y)=δ(x-y) y f (x, y)=δ(x-y) x ν F(μ, ν)=δ(μ+ν) μ C. Nikou – Digital Image Processing (E 12)
2 D continuous signals (cont. ) Images taken from Gonzalez & Woods, Digital Image Processing (2002) 45 C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 46 2 D continuous signals (cont. ) • 2 D continuous convolution • We will examine the discrete convolution in more detail. • Convolution property C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 47 2 D continuous signals (cont. ) • 2 D sampling is accomplished by • The FT of the sampled 2 D signal consists of repetitions of the spectrum of the 1 D continuous signal. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 48 2 D continuous signals (cont. ) • The Nyquist theorem involves both the horizontal and vertical frequencies. Over-sampled Under-sampled C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 49 Aliasing C. Nikou – Digital Image Processing (E 12)
50 Aliasing - Moiré Patterns • Effect of sampling a scene with periodic or nearly periodic components (e. g. overlapping grids, TV raster lines and stripped materials). • In image processing the problem arises when scanning media prints (e. g. magazines, newspapers). • The problem is more general than sampling artifacts. C. Nikou – Digital Image Processing (E 12)
51 Aliasing - Moiré Patterns (cont. ) • Superimposed grid drawings (not digitized) produce the effect of new frequencies not existing in the original components. C. Nikou – Digital Image Processing (E 12)
52 Aliasing - Moiré Patterns (cont. ) • In printing industry the problem comes when scanning photographs from the superposition of: • The sampling lattice (usually horizontal and vertical). • Dot patterns on the newspaper image. C. Nikou – Digital Image Processing (E 12)
53 Aliasing - Moiré Patterns (cont. ) C. Nikou – Digital Image Processing (E 12)
54 Aliasing - Moiré Patterns (cont. ) • The printing industry uses halftoning to cope with the problem. • The dot size is inversely proportional to image intensity. C. Nikou – Digital Image Processing (E 12)
2 D discrete convolution Images taken from Gonzalez & Woods, Digital Image Processing (2002) 55 m f [m, n] 3 2 n m h [m, n] 1 1 1 -1 n • Take the symmetric of one of the signals with respect to the origin. • Shift it and compute the sum at every position [m, n]. C. Nikou – Digital Image Processing (E 12)
2 D discrete convolution (cont. ) Images taken from Gonzalez & Woods, Digital Image Processing (2002) 56 n n f [m, n] 3 2 h [m, n] 1 1 1 -1 m l h [-k, -l] -1 1 m l g [0, 0]=0 3 2 k g [1, 1]=0 h [1 -k, 1 -l] 2 3 1 -1 1 1 C. Nikou – Digital Image Processing (E 12) k
2 D discrete convolution (cont. ) Images taken from Gonzalez & Woods, Digital Image Processing (2002) 57 n n f [m, n] 3 2 h [m, n] 1 1 1 -1 m m l l g [2, 2]=3 h [2 -k, 2 -l] -1 13 2 1 1 h [3 -k, 2 -l] k C. Nikou – Digital Image Processing (E 12) g [3, 2]=-1 3 21 -1 1 1 k
2 D discrete convolution (cont. ) Images taken from Gonzalez & Woods, Digital Image Processing (2002) 58 n n f [m, n] 3 2 h [m, n] 1 1 1 -1 m n 3 5 2 3 -1 -3 g[m, n] m M 1+M 2 -1=3 N 1+N 2 -1=2 C. Nikou – Digital Image Processing (E 12) m
The 2 D DFT Images taken from Gonzalez & Woods, Digital Image Processing (2002) 59 • 2 D DFT pair of image f [m, n] of size Mx. N. C. Nikou – Digital Image Processing (E 12)
Images taken from Gonzalez & Woods, Digital Image Processing (2002) 60 The 2 D DFT (cont. ) • All of the properties of 1 D DFT hold. • Particularly: – Let f [m, n] be of size M 1 x. N 1 and h[m, n] of size M 2 x. N 2. – If the signals are zero-padded to size (M 1+M 21)x(N 1+N 2 -1) then their circular convolution will be the same as their linear convolution and: C. Nikou – Digital Image Processing (E 12)