2D Linear Systems 2D Fourier Transform and its Properties The Basics of Filtering in Frequency Domain Image Smoothing Image Sharpening Selective Filtering Implementation Tips 1
General Definition: System f x, y H g x, y,, g x y H f x y 2
Linearity,,,, H af x y bf x y ah f x y bh f x y 1 2 1 2 Shift Invariant or Spatially Invariant:,,,, g x y H f x y g x x y y H f x x y y Causality: Same as before Don t worry about it! 0 0 0 0 Stability: Same as before 3
Unit Impulse Function (Pinhole): xy, xy, 0,0 xy 0, 0,0 x, y dxdy 1 4
Point Spread Function (Impulse Response):, ;,, H x y x y H x x y y 0 0 0 0 PSD of Hubble Telescope Linear Shift Invariant Systems:, ; 0, 0 0, 0 0, 0,, H x y x y H x x y y H x x y y H x y H x y 5
Convolution/Correlation Integral:,,,, f x y h x y f s t h x s y t dsdt,,,, f x y h x y f s t h x s y t dsdt Convolution/Correlation Summation: M1N1,,,, f m n h m n f p q h m p n q p0 q0 M1N1,,,, f m n h m n f p q h m p n q p0 q0 6
The 2-D Continuous Fourier Transform j 2 ux vy F u v f x y e dxdy,, j 2 ux vy f x y F u v e dudv,, x y A rect rect A TZsinc ut sinc vz Z T 7
2-D Sampling and Sampling Theorem 2-D impulse train: x mx, y ny m m Error Free Reconstruction: 1 1 x, y 2u 2v max max 8
Aliasing in Images: See Figures 4.16-4.22 for practical examples. 9
2-D Discrete Fourier Transform M 1N 1 1 um vn F u, v f m, n exp 2 1 j m 0 n 0 M N M 1N 1 1 um vn f m, n Fu, v exp j 2 MN u0 v 0 M N Spatial and Frequency Intervals 1 1 u, v M x N y 10
Phase Significance 11
Phase Significance 12
Phase Significance 13
Symmetry Properties 14
Definition and Properties (1) 15
Definition and Properties (2) 16
DFT Pairs (1) 17
DFT Pairs (2) 18
FFT Shift, Centering and Symmetry 19
Fourier Transform Centering fftshift in Matlab 20
Example Without Shift With Shift 21
Translation Rotation 22
Phase Changes: Original Translated Rotated 23
Line Pattern in Spatial and Frequency Domain Strong ±45 edge in Spatial Strong ±45 edge in Frequency 24
Frequency Domain Filtering Fundamentals: Convolution Theorem: Zero Padding: f h g Zero-Padding is necessary to avoid Wraparound error. Circular vs. Linear Convolution,,,, f m n h m n F u v H u v 1 1 M N PQ M P N Q 25
Frequency Domain Manipulation Set F(0,0) to zero Clip negative value 26
Lowpass, Highpass, Highboost No shift 27
Zero-Padding Effect: Blurring With Gaussian Original No Zero-Padding Zero-Padding 28
Inherent Periodicity of DFT and Zero-Padding With (Right) and Without (Left) Padding 29
Zero-Padding Side effect Read Pg. 260-262! Ideal Filter (TL) Time Domain (BL) Zero Padding (TR) Ringing Effect (BR) 30
Effect of small changes in phase Why we prefer zero-phase filters? j 0.5 F IDFT F e j 0.25 F IDFT F e 31
Steps for Frequency Domain Filtering a) Original b) Padding c) Multiply by (-1) x+y d) FFT e) GLP (Centered) f) Multiply and (e) g) Multiply IFFT Real by (-1) x+y h) Cropping 32
Spatial-Frequency Correspondences h x, y H u, v The most used Filter (Gaussian) 1 2 2 e 2 2 x y 2 2 2 2 u v e 2 2 2 2 2 33
Example (1) 34
Example (2) An image and its spectrum 35
Filtering in Spatial and Frequency Domain 36
Image Smoothing in Frequency Domain Ideal Lowpass Filter Butterworth Lowpass Filter Gaussian Lowpass Filter More Examples 2 2, D u v u v 37
Ideal Lowpass Filter 38
Test Pattern and Energy Circles 460 (99.2%) 160 (97.8%) 60 (95.7%) 30 (93.1%) 10 (87.0%) 39
Ideal Lowpass Filter 10, 30, 60, 160, and 460 (Radius) Smoothing Blurring Ringing Effect 40
Origin of Ringing Effect 41
Butterworth Lowpass Filter: 42
Butterworth Lowpass Filter: Order (2) Same radius Smoothing Blurring Less Ringing Effect 43
Less Ringing Effect of Butterworh Filter: Order 1,2,5, and 20 44
Gaussian Lowpass Filter: 45
Gaussian Lowpass Filter: Smoothing Blurring No Ringing Effect! 46
Low Resolution Images Repairing 47
Pre-print Processing (Smooth and soft-looking) Original, D 0 =100, and D 0 =80 48
Remove Unwanted Pattern: Remove Horizontal Lines (Imaging System Deficiency) Large Recognizable Features Original, D 0 =50, and D 0 =20 49
Image Sharpening in Frequency Domain Ideal Highpass Filter Butterworth Highpass Filter Gaussian Highpass Filter More Examples, 1, H u v H u v HP LP 50
Highpass Filters 51
Spatial Representation of Highpass Filters Ringing (Ideal, Butterworth, and Gaussian) 52
Ideal Highpass Filter D 0 =30 D 0 =60 D 0 =160 53
Butterworth (n=2) Highpass Filters D 0 =30 D 0 =60 D 0 =160 54
Gaussian Highpass Filter D 0 =30 D 0 =60 D 0 =160 55
Thumb Print Processing: Original (Left) Butterworth Highpass Filter with n=4, D 0 =50 (Middle) Thresholding (Right) Setting Negative Value to Black and Positive value to White 56
Laplacian in Frequency Domain: 2 2 2 2 2, 4 4, H u v u v D u v Image Laplacian: 2 f x, y 1 H u, v F u, v Enhanced Image: 2,,, 1 F u, v H u, v F u, v g x y f x y c f x y 1 2 2 u v F u v 1 4 D,, 57
Example (Laplacian): Similar But Not identical to Spatial Domain 58
Unsharp Masking, Highboost, High-Frequency Emphasis: gmask x, y f x, y flp x, y 1 f x, y H u, v F u, v LP LP Unsharp Masking (K=1) and Highboost Filters(K>1): g x, y f x, y kg x, y High Frequency Emphasing: 1 g x, y 1 kh u, vf u, v mask 1 LP, 1 1,, g x y k H u v F u v 1, y k k H u, vf u, v g x 1 2 HP HP 59
Example: GHPF, D 0 =40 HFE, k 1 =0.5, k 2 =0.25 Histogram EQ. 60
Homomorphic Filtering: Linear Process is not Possible: Summary of Steps,,, f x y i x y r x y ln f x, y ln i x, y ln r x, y 61
Illumination-Reflection Control Filter cd 2 u, v D, 1 2 H u v 0 H L e L 62
Example: Whole Body PET Scan Enhancement L 0 0.25 H 2 c 1 D 80 63
Selective Filtering: Bandpass Band Reject Notch 64
Bandreject and Bandpass Filter H BP (u, v)= 1- H BR (u, v) 65
Notch Filters: Pass/Reject predefined, both (u 0, v 0 ) and (-u 0, -v 0 ) H NP (u, v)= 1- H NR (u, v) 66
Example (1) Spot in Frequency Domain Spectrum Multiplied Spectrum 67
Example (2) Vertical sin Pattern 68
Example (2) Cont. Extract Vertical sin Pattern 69
Matlab Command fft2, ifft2, fftshift, ifftshift freqz2, fspecial 70