 Download Download Presentation Image Processing

Image Processing

Download Presentation Image Processing

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

1. Image Processing Ch4: Filtering in frequency domain Prepared by: Tahani Khatib AOU

2. Part 2 Filtering in frequency domain

3. Frequency Domain Filtering & Spatial Domain Filtering Similar jobs can be done in the spatial and frequency domains Filtering in the spatial domain can be easier to understand Filtering in the frequency domain can be much faster – especially for large images

4. Ch4, lesson 8: The basics of filtering in the Frequency Domain (FD) introduction • It consists of modifying the FT of an input image and then finding the IFT to get the output image. • Mathematically its given by: G(u,v)= H(u,v)F(u,v)

5. Ch4, lesson 8: The basics of filtering in the Frequency Domain (FD) Steps of frequency domain filter Multiply the input image by (-1)x+y 2. Compute F(u,v) 3. Multiply F(u,v) by a filter function H(u,v) 4. Compute the inverse DFT 5. Obtain the real part 6. Multiply the real part by (-1)x+y

6. Ch4, lesson 8: The basics of filtering in the Frequency Domain (FD) Steps of frequency domain filter • Given an input image f(x,y) of size MxN, select the padding parameters P=2M and Q=2N. • Form a padded image of size PxQ by appending the necessary zeros to f(x,y). • Multiply padded image by (-1)(x+y) to center its transform. • Compute the DFT F(u,v) of the image from step 3. • Generate a real, symmetric filter function H(u,v) of size PxQ. Form the product G(u,v)=H(u,v)F(u,v). • Find the processed image by computing the real part of the IDFT of G(u,v) • Multiply above by by (-1)(x+y) • get g(x,y) from above step by extracting an MxN region from top left quadrant.

7. Ch4, lesson 9: correspondence between FD & SD filters Correspondence between FD and SD filtering: • SD: filtering is given by discrete convolution • Correlation is… • FD: Discrete convolution in FD is equivalent to multiplication • Filtering can be done in either domain.

8. SD VS FD filters Low pass High pass laplace filters Average filters

9. Ch4, lesson 10: low pass & high pass filters in FD Low pass & High pass filters in FD • Low-pass filter: A filter that attenuates high frequencies while passing low frequencies.- used for blurring (smoothing) • High-pass filter: A filter that attenuates low frequencies while passing high frequencies. used for sharpening

10. Ch4, lesson 10: low pass & high pass filters in FD Low pass & High pass filters in FD 1) Low pass - Smoothing filters 1.1) Ideal lowpass filters (very sharp) 1.2) Butterworth lowpass filters 1.3) Gaussian lowpass filters (very smooth) • Butterworth filter parameter: filter order • High values: filter has the form of the ideal filter. • Low values: filter has the form of the Gaussian filter. 2) High pass- Sharpening filters 2.1) Ideal highpass filters 2.2) Butterworth highpass filters 2.3) Gaussian highpass filters

11. Ch4, lesson 10: low pass & high pass filters in FD 1) Low pass – image smoothing Image smoothing using FD filters • Noise is usually high frequency. • Hence noise removal is usually termed smoothing or blurring. • Smoothing is achieved by lowpass filters (LPFs). • 3 types of LPFs will be studied i.e. Ideal LPF, Butterworth LPF and Gaussian LPF. • Note/Caution: Image details and edges have high frequency characteristics.

12. Ch4, lesson 10: low pass filters 1) Low pass - image Smoothing Smoothing filters: 1.1) Ideal low pass filters (ILPF) 1.2) Butterworth low pass filters (BLPF) 1.3) Gaussian low pass filters (GLPF)

13. Ch4, lesson 11: ILPF 1.1) 2-D Ideal low pass filter ILPF Where • D(u,v) is the distance from (u,v) to the center of the frequency rectangle • Image size: MxN • Center of the frequency rectangle: (u,v) = (M/2, N/2) • Distance to the center: D(u,v) = [(u – M/2)2 + (v – N/2)2]1/2 The simplest lowpass filter is ILPF, it (cuts off) all high frequency components that are at distance greater than a specified distance: D0 from the center

14. Ch4, lesson 11: ILPF How does ILPF function works? • نضرب قيم هذا الماسك H(u,v) بالقيم المكافئة لها بالصورة F(u,v). فنحصل فقط على ال frequencies داخل الدائرة • دائما منتصف الصورة تحمل اهم المعلومات عنها ( اي معظم معلومات الصورة), بينما تتوزع التفاصيل • كل ما كبر نصف قطر الدائرة (اي D0), كل ما حصلنا على صورة اقرب للاصل.( انظر الشريحة التالية)

15. Ch4, lesson 11: ILPF كل ما كبر نصف قطر الدائرة (اي D0), كل ما حصلنا على صورة اقرب للاصل دائما منتصف الصورة تحمل اهم المعلومات عنها ( اي معظم معلومات الصورة), بينما تتوزع التفاصيل Radius total image power % 5 92.0 15 94.6 30 96.4 80 98 230 pixels 99.5

16. Ideal Low Pass Filter results Ch4, lesson 11: ILPF Result of filtering with ideal low pass filter of radius 5 Originalimage Ringing is a characteristics of ideal Filter Result of filtering with ideal low pass filter of radius 30 Result of filtering with ideal low pass filter of radius 15 Result of filtering with ideal low pass filter of radius 230 Result of filtering with ideal low pass filter of radius 80 Ideal lowpass filtering is not very practical but they can be implemented on a computer to study their behavior.

17. Ch4, lesson 11: ILPF Blurring and ringing feature of ILPFs: The ILPF has sharp cutoffs or discontinuities which cause ringing. • The ILPF has a sink function behaviour in the SD. • The center of lobe is the cause for blurring but the outer smaller lobes cause ringing. • We want to achieve blurring with littleringing.

18. Ch4, lesson 12: BLPF 1.2) Butterworth low pass filter - BLPF: • ILPF transfer function has sharp discontinuities. • BLPF transfer function does not have sharp discontinuities in order to reduce ringing. The transfer function of a Butterworth lowpass filter of order n with cutoff frequency at distance D0 from the origin is defined as:

19. Ch4, lesson 12: BLPF Butterworth low pass filter - BLPF: • Note: • H(U,V) =0.50 (50% from its maximum value of 1) when D(u,v) =D0

20. Butterworth Lowpass Filter (cont…) Ch4, lesson 12: BLPF Result of filtering with Butterworth filter of order 2 and cutoff radius 5 Originalimage Ringing is not visible in any of these images. Result of filtering with Butterworth filter of order 2 and cutoff radius 15 Result of filtering with Butterworth filter of order 2 and cutoff radius 30 Result of filtering with Butterworth filter of order 2 and cutoff radius 230 Result of filtering with Butterworth filter of order 2 and cutoff radius 80

21. Ch4, lesson 12: BLPF Ringing increases with filter order (n) as seen in SD

22. Ch4, lesson 13: GLPF 1.3) Gaussian Lowpass Filters -GLPF The transfer function of a Gaussian lowpass filter is defined as Note: The IFT (INVERSE FOURIOUR) of Gaussian is also Gaussian. Hence there is no ringing effect.

23. Ch4, lesson 12: BLPF Gaussian low pass filter - GLPF: • Note: • H(U,V) =0.667 when D(u,v) =D0

24. Gaussian Lowpass Filters (cont…) Ch4, lesson 13: GLPF Result of filtering with Gaussian filter with cutoff radius 5 Originalimage No ringing Result of filtering with Gaussian filter with cutoff radius 15 Result of filtering with Gaussian filter with cutoff radius 30 Result of filtering with Gaussian filter with cutoff radius 85 Result of filtering with Gaussian filter with cutoff radius 230

25. Lowpass Filters Compared Result of filtering with Butterworth filter of order 2 and cutoff radius 15 Result of filtering with ideal low pass filter of radius 15 Result of filtering with Gaussian filter with cutoff radius 15

26. Lowpass Filtering Examples A low pass Gaussian filter is used to connect broken text Machine recognition systems have difficulty in reading broken characters. GLPF with D0 = 80

27. Lowpass Filtering Examples (cont…) Different lowpass Gaussian filters used to remove blemishes in a photograph

28. 2)High pass - image Sharpening Blurring (smoothing) is achieved by attenuating التخلص the HF(high frequency) components of DFT of an image. (low pass filters) Sharpening is achieved by attenuating the LF (low frequency) components of DFT of an image. Where Edges and fine detail in images are associated with high frequency components (high pass filters) High pass filters– only pass the high frequencies, drop the low ones. High pass frequencies are precisely the reverse of low pass filters, so: Hhp(u, v) = 1 – Hlp(u, v) Ch4, lesson 14: high pass

29. Ch4, lesson 14: high pass 2)High pass - image Sharpening Sharpening filters: 2.1) Ideal high pass filters (IHPF) 2.2) Butterworth high pass filters (BHPF) 2.3) Gaussian high pass filters (GHPF)

30. 2.1) Ideal High Pass Filters The ideal high pass filter is given as: where D0 is the cut off distance as before Ch4, lesson 15: IHPF

31. Ideal High Pass Filters (cont…) Ch4, lesson 15: IHPF Results of ideal high pass filtering with D0 = 15 Results of ideal high pass filtering with D0 = 30 Results of ideal high pass filtering with D0 = 80

32. Butterworth High Pass Filters The Butterworth high pass filter is given as: where n is the order and D0 is the cut off distance as before Ch4, lesson 16: BHPF

33. Butterworth High Pass Filters (cont…) Ch4, lesson 16: BHPF Results of Butterworth high pass filtering of order 2 with D0 = 15 Results of Butterworth high pass filtering of order 2 with D0 = 80 Results of Butterworth high pass filtering of order 2 with D0 = 30

34. Gaussian High Pass Filters The Gaussian high pass filter is given as: where D0 is the cut off distance as before Ch4, lesson 17: GHPF

35. Gaussian High Pass Filters (cont…) Ch4, lesson 17: GHPF Results of Gaussian high pass filtering with D0 = 80 Results of Gaussian high pass filtering with D0 = 15 Results of Gaussian high pass filtering with D0 = 30

36. Highpass Filter Comparison BF represents a transition between the sharpness of the IF and the smoothness of the GF يعني يعتبر BF مرحلة وسطية بين IF و GF حيث يعتبر IF حاد للغاية بينما يمتاز GF بنعومته

37. Highpass Filter Comparison Results of ideal high pass filtering with D0 = 15 Results of Butterworth high pass filtering of order 2 with D0 = 15 Results of Gaussian high pass filtering with D0 = 15

38. The 3 HPF SD representation