Department of Physics and Astronomy DIGITAL IMAGE PROCESSING Course 3624 Topic 8 - Image Filtering - II Professor Bob Warwick 8. Image Filtering II - Fourier Domain Filtering Filtering is the suppression or enhancement of particular spatial frequency components in a dataset. The spatial domain process is a convolution: Filtered image Original Image Mask Function g(x, y) = f (x, y)*h(x, y) From the Convolution Theorem we have the equivalent Fourier Domain Process: FT of Filtered image FT of Original Image Filter Function G(u, v) = F(u, v)´ H(u, v) Thus the Fourier Domain process is simply one of MULTIPLICATION by the filter function, where Filter Function FT Mask Function H(u, v) Û h(x, y) Types Of Fourier Domain Filter (i) LOW-PASS FILTERS -- Noise Suppression (high freq. suppression, low freq. enhancement) (ii) HIGH-PASS FILTERS - Edge enhancement/detection (low freq. suppression, high freq. enhancement) (iii) BAND-STOP FILTERS - Interference Suppression (mid-frequency suppression) 8.1 Low-Pass Filters In many applications the noise has a much wider frequency spread than the signal. For example in 1-d: F(u) Signal White noise u In these circumstances an effective method of noise suppression is to apply a low-pass Fourier domain filter: F(u) ´ u H(u) = u G(u) u Types of Low-Pass Filters (a) Rectangular or "Top-Hat" Filter H(u) |h(x)| H(u) Û h(x) umax x u But this type of filter introduces both: BLURRING and RINGING! (b) Trapezoidal Low-Pass Filter H(u) umax 2-d forms u (c) Gaussian Low-Pass Filter In (b) & (c) BLURRING remains but RINGING is reduced because the filter edges are less sharp H(u) u The Top-Hat Filter The Gaussian Filter 8.2 High-Pass Filters Abrupt edges and/or sharp boundaries of objects generally produce most of the high frequency signal in the image. It follows that to sharpen an image it is necessary to enhance the high frequency components. Types of HIGH-PASS FILTER H(u) (a) Rectangular H(u) umin u (b) Trapezoidal u (c) Gaussian H(u) u The High-Pass Filter High-Pass Filtering Example 8.3 Band-Stop Filtering Band-stop filters are used to suppress interference signals in a specific frequency range: H(u) u Band-Stop Filtering Example I Band-Stop Filtering Example II 8.4 Equivalent Filters The effect of a spatial domain filter can be investigated by considering the equivalent Fourier domain filter (and vica-versa). hxy Û Huv Consider the 1-d case of an N element image spatially filtered with 1 x 3 mask. The first step is to “pad out” the mask with N-3 zeros. Example: 1-d Smoothing Filter 1 1 1 1 1 1 0 0 0 0 0 ….. Then: In the Fourier domain j 2 p ux N-1 1 the smoothing filter has Hu = åhx e N u = 0 ® N -1 N x=0 a low-pass response j 2 p ux 2 (rather as expected): 1 N Hu = Hu = N 1 N åh e x x=0 æ ç1+ e è 1 Hu = e N 1 Hu = e N j 2pu N +e j 2 p u2 N ö ÷ ø j 2pu N j 2pu ö æ j 2p u N +1+ e N ÷ çe è ø j 2pu N æ 2p u ö ç1+ 2 cos ÷ è N ø Scale Phase Factor Term Amplitude Response Hu 0 N 2 u Equivalent Filters cont. Example 2: 1-d gradient operator: 1 0 -1 1 0 -1 0 0 0 0 0 ….. Then: 1 N-1 Hu = åhx e N x=0 j 2 p ux N 1 2 Hu = åhx e N x=0 j 2 p ux N u = 0 ® N -1 j 2p u N Scale Phase Factor Terms 1 N-1 Hu = åhx e N x=0 j 2 p ux N 1 2 Hu = åhx e N x=0 j 2 p ux N æ 2p u ö ç sin ÷ è N ø 1 Hu = e N Amplitude Response u = 0 ® N -1 j 2p u j 2 p u2 ö 1 æ N H u = ç -1+ 2e -e N ÷ Nè ø j 2pu j 2pu j 2pu ö 1 - N æ N Hu = e +2-e N ÷ ç -e N è ø j 2 p u2 ö 1 æ H u = ç1+ 0 - e N ÷ Nè ø j 2pu j 2p u j 2pu ö 1 - N æ N Hu = e -e N ÷ çe N è ø 2 Hu = je N Example 3: 1-d Laplacian operator: -1 2 -1 -1 2 -1 0 0 0 0 0 ….. Then: A high-pass response: Hu j 2pu N æ 2p u ö ç 2 - 2 cos ÷ è N ø Scale Phase Factor Terms Amplitude Response A high-pass response: Hu 0 N 2 u 0 N 2 u 2-D Equivalent Filters For a 2-D spatial filter, the equivalent Fourier domain filter can be calculated as: H uv 1 = N N -1 N -1 å åh x=0 xy e - j 2 p (ux+vy) N u = 0 ® N -1 v = 0 ® N -1 y=0 If the 2-d filter is “separable”, then the same result can be achieved by the application of two 1-d filters: hxy º h x * hy Û Hu ´ Hv º Huv Example 1: 1 1 1 1 h xy = 1 1 1 º 1 * 1 1 1 Û 1 1 1 1 Hu Hv ´ 0 Example 2: 1 0 -1 1 h xy = 1 0 -1 º 1 * 1 0 -1 Û 1 0 -1 1 N 2 u Hu N 2 0 v Hv ´ 0 N 2 u 0 N 2 v