Presentation is loading. Please wait.

Presentation is loading. Please wait.

Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain 22 June 2005 Digital Image Processing Chapter 4: Image Enhancement in the.

Similar presentations


Presentation on theme: "Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain 22 June 2005 Digital Image Processing Chapter 4: Image Enhancement in the."— Presentation transcript:

1

2 Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain 22 June 2005 Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain 22 June 2005

3 Background: Fourier Series Any periodic signals can be viewed as weighted sum of sinusoidal signals with different frequencies Fourier series: Frequency Domain: view frequency as an independent variable (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

4 Fourier Tr. and Frequency Domain Time, spatial Domain Signals Frequency Domain Signals Fourier Tr. Inv Fourier Tr. 1-D, Continuous case Fourier Tr.: Inv. Fourier Tr.:

5 Fourier Tr. and Frequency Domain (cont.) 1-D, Discrete case Fourier Tr.: Inv. Fourier Tr.: u = 0,…,M-1 x = 0,…,M-1 F(u) can be written as or where

6 Example of 1-D Fourier Transforms Notice that the longer the time domain signal, The shorter its Fourier transform (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

7 Relation Between  x and  u For a signal f(x) with M points, let spatial resolution  x be space between samples in f(x) and let frequency resolution  u be space between frequencies components in F(u), we have Example: for a signal f(x) with sampling period 0.5 sec, 100 point, we will get frequency resolution equal to This means that in F(u) we can distinguish 2 frequencies that are apart by 0.02 Hertz or more.

8 2-Dimensional Discrete Fourier Transform 2-D IDFT 2-D DFT u = frequency in x direction, u = 0,…, M-1 v = frequency in y direction, v = 0,…, N-1 x = 0,…, M-1 y = 0,…, N-1 For an image of size MxN pixels

9 F(u,v) can be written as or where 2-Dimensional Discrete Fourier Transform (cont.) For the purpose of viewing, we usually display only the Magnitude part of F(u,v)

10 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. 2-D DFT Properties

11 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. 2-D DFT Properties (cont.)

12 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. 2-D DFT Properties (cont.)

13 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. 2-D DFT Properties (cont.)

14 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Computational Advantage of FFT Compared to DFT

15 Relation Between Spatial and Frequency Resolutions where  x = spatial resolution in x direction  y = spatial resolution in y direction  u = frequency resolution in x direction  v = frequency resolution in y direction N,M = image width and height  x and  y are pixel width and height. )

16 How to Perform 2-D DFT by Using 1-D DFT f(x,y)f(x,y) 1-D DFT by row F(u,y)F(u,y) 1-D DFT by column F(u,v)F(u,v)

17 How to Perform 2-D DFT by Using 1-D DFT (cont.) f(x,y)f(x,y) 1-D DFT by row F(x,v)F(x,v) 1-D DFT by column F(u,v)F(u,v) Alternative method

18 Periodicity of 1-D DFT 0 N 2N-N DFT repeats itself every N points (Period = N) but we usually display it for n = 0,…, N-1 We display only in this range From DFT:

19 Conventional Display for 1-D DFT 0 N-1 Time Domain Signal DFT f(x)f(x) 0 N-1 Low frequency area High frequency area The graph F(u) is not easy to understand !

20 0 -N/2N/2-1 0 N-1 Conventional Display for DFT : FFT Shift FFT Shift: Shift center of the graph F(u) to 0 to get better Display which is easier to understand. High frequency area Low frequency area

21 Periodicity of 2-D DFT For an image of size NxM pixels, its 2-D DFT repeats itself every N points in x- direction and every M points in y-direction. We display only in this range 0N2N-N 0 M 2M -M 2-D DFT: g(x,y)g(x,y) (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

22 Conventional Display for 2-D DFT High frequency area Low frequency area F(u,v) has low frequency areas at corners of the image while high frequency areas are at the center of the image which is inconvenient to interpret. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

23 2-D FFT Shift : Better Display of 2-D DFT 2D FFTSHIFT 2-D FFT Shift is a MATLAB function: Shift the zero frequency of F(u,v) to the center of an image. High frequency areaLow frequency area (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

24 Original display of 2D DFT 0N2N-N 0 M 2M -M (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Display of 2D DFT After FFT Shift 2-D FFT Shift (cont.) : How it works

25 Example of 2-D DFT Notice that the longer the time domain signal, The shorter its Fourier transform (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

26 Example of 2-D DFT Notice that direction of an object in spatial image and Its Fourier transform are orthogonal to each other. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

27 Example of 2-D DFT Original image 2D DFT 2D FFT Shift

28 Example of 2-D DFT Original image 2D DFT 2D FFT Shift

29 Basic Concept of Filtering in the Frequency Domain From Fourier Transform Property: We cam perform filtering process by using (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Multiplication in the frequency domain is easier than convolution in the spatial Domain.

30 Filtering in the Frequency Domain with FFT shift f(x,y)f(x,y) 2D FFT FFT shift F(u,v)F(u,v) 2D IFFTX H(u,v) (User defined) G(u,v)G(u,v) g(x,y)g(x,y) In this case, F(u,v) and H(u,v) must have the same size and have the zero frequency at the center.

31 Multiplication in Freq. Domain = Circular Convolution f(x)f(x)DFTF(u)F(u) G(u) = F(u)H(u) h(x)h(x)DFTH(u)H(u) g(x)g(x)IDFT Multiplication of DFTs of 2 signals is equivalent to perform circular convolution in the spatial domain. f(x)f(x) h(x)h(x) g(x)g(x) “Wrap around” effect

32 H(u,v) Gaussian Lowpass Filter with D0 = 5 Original image Filtered image (obtained using circular convolution) Incorrect areas at image rims Multiplication in Freq. Domain = Circular Convolution

33 Linear Convolution by using Circular Convolution and Zero Padding f(x)f(x)DFTF(u)F(u) G(u) = F(u)H(u) h(x)h(x)DFTH(u)H(u) g(x)g(x) IDFT Zero padding Concatenation Padding zeros Before DFT Keep only this part

34 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Linear Convolution by using Circular Convolution and Zero Padding

35 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Linear Convolution by using Circular Convolution and Zero Padding Zero padding area in the spatial Domain of the mask image (the ideal lowpass filter) Filtered image Only this area is kept.

36 Filtering in the Frequency Domain : Example In this example, we set F(0,0) to zero which means that the zero frequency component is removed. Note: Zero frequency = average intensity of an image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

37 Filtering in the Frequency Domain : Example (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Highpass Filter Lowpass Filter

38 Filtering in the Frequency Domain : Example (cont.) (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Result of Sharpening Filter

39 Filter Masks and Their Fourier Transforms (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

40 Ideal Lowpass Filter where D(u,v) = Distance from (u,v) to the center of the mask. Ideal LPF Filter Transfer function (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

41 Examples of Ideal Lowpass Filters (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. The smaller D 0, the more high frequency components are removed.

42 Results of Ideal Lowpass Filters Ringing effect can be obviously seen! (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

43 How ringing effect happens Ideal Lowpass Filter with D 0 = 5 Surface Plot Abrupt change in the amplitude

44 How ringing effect happens (cont.) Spatial Response of Ideal Lowpass Filter with D 0 = 5 Surface Plot Ripples that cause ringing effect

45 How ringing effect happens (cont.) (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

46 Butterworth Lowpass Filter Transfer function Where D 0 = Cut off frequency, N = filter order. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

47 Results of Butterworth Lowpass Filters There is less ringing effect compared to those of ideal lowpass filters! (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

48 Spatial Masks of the Butterworth Lowpass Filters Some ripples can be seen. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

49 Gaussian Lowpass Filter Transfer function Where D 0 = spread factor. Note: the Gaussian filter is the only filter that has no ripple and hence no ringing effect. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

50 Gaussian Lowpass Filter (cont.) Gaussian lowpass filter with D 0 = 5 Spatial respones of the Gaussian lowpass filter with D 0 = 5 Gaussian shape

51 Results of Gaussian Lowpass Filters No ringing effect! (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

52 Application of Gaussian Lowpass Filters The GLPF can be used to remove jagged edges and “repair” broken characters. Better LookingOriginal image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

53 Application of Gaussian Lowpass Filters (cont.) Remove wrinkles Softer-Looking Original image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

54 Application of Gaussian Lowpass Filters (cont.) Remove artifact lines: this is a simple but crude way to do it! Filtered imageOriginal image : The gulf of Mexico and Florida from NOAA satellite. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition.

55 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Highpass Filters H hp = 1 - H lp

56 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Ideal Highpass Filters where D(u,v) = Distance from (u,v) to the center of the mask. Ideal LPF Filter Transfer function

57 Butterworth Highpass Filters (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Transfer function Where D 0 = Cut off frequency, N = filter order.

58 Gaussian Highpass Filters (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Transfer function Where D 0 = spread factor.

59 Gaussian Highpass Filters (cont.) Gaussian highpass filter with D 0 = 5 Spatial respones of the Gaussian highpass filter with D 0 = 5

60 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Spatial Responses of Highpass Filters Ripples

61 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Results of Ideal Highpass Filters Ringing effect can be obviously seen!

62 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Results of Butterworth Highpass Filters

63 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Results of Gaussian Highpass Filters

64 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Laplacian Filter in the Frequency Domain From Fourier Tr. Property: Then for Laplacian operator Surface plot We get Image of –(u 2 +v 2 )

65 Laplacian Filter in the Frequency Domain (cont.) Spatial response of –(u 2 +v 2 ) Cross section Laplacian mask in Chapter 3

66 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Sharpening Filtering in the Frequency Domain Spatial Domain Frequency Domain Filter

67 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Sharpening Filtering in the Frequency Domain (cont.) p

68 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Sharpening Filtering in the Frequency Domain (cont.) f A = 2 A = 2.7

69 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. High Frequency Emphasis Filtering Original Butterworth highpass filtered image High freq. emphasis filtered image After Hist Eq. a = 0.5, b = 2

70 Homomorphic Filtering An image can be expressed as i(x,y) = illumination component r(x,y) = reflectance component We need to suppress effect of illumination that cause image Intensity changed slowly.

71 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Homomorphic Filtering

72 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Homomorphic Filtering More details in the room can be seen!

73 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2 nd Edition. Correlation Application: Object Detection


Download ppt "Digital Image Processing Chapter 4: Image Enhancement in the Frequency Domain 22 June 2005 Digital Image Processing Chapter 4: Image Enhancement in the."

Similar presentations


Ads by Google