Presentation is loading. Please wait.

Presentation is loading. Please wait.

Digital Image Processing

Similar presentations


Presentation on theme: "Digital Image Processing"— Presentation transcript:

1 Digital Image Processing
بسمه‌تعالي Digital Image Processing Image Enhancement in the Frequency Domain (Chapter 4) H.R. Pourreza H.R. Pourreza

2 Objective Basic understanding of the frequency domain, Fourier series, and Fourier transform. Image enhancement in the frequency domain. H.R. Pourreza

3 Fourier Series Any function that periodically
repeats itself can be expressed as the sum of sines and/or cosines of different frequencies, each multiplied by a different coefficients. This sum is called a Fourier series. H.R. Pourreza

4 Fourier Series H.R. Pourreza

5 Fourier Transform A function that is not periodic but the area under its curve is finite can be expressed as the integral of sines and/or cosines multiplied by a weighing function. The formulation in this case is Fourier transform. H.R. Pourreza

6 Continuous One-Dimensional Fourier Transform and Its Inverse
Where (u) is the frequency variable. F(u) is composed of an infinite sum of sine and cosine terms and… Each value of u determines the frequency of its corresponding sine-cosine pair. H.R. Pourreza

7 Continuous One-Dimensional Fourier Transform and Its Inverse
Example Find the Fourier transform of a gate function (t) defined by 2 4 u 0.5 - 0.5 x H.R. Pourreza

8 Continuous One-Dimensional Fourier Transform and Its Inverse
H.R. Pourreza

9 Discrete One-Dimensional Fourier Transform and Its Inverse
A continuous function f(x) is discretized into a sequence: by taking N or M samples x units apart. H.R. Pourreza

10 Discrete One-Dimensional Fourier Transform and Its Inverse
Where x assumes the discrete values (0,1,2,3,…,M-1) then The sequence {f(0),f(1),f(2),…f(M-1)} denotes any M uniformly spaced samples from a corresponding continuous function. H.R. Pourreza

11 Discrete One-Dimensional Fourier Transform and Its Inverse
u =[0,1,2, …, M-1] x =[0,1,2, …, M-1] H.R. Pourreza

12 Discrete One-Dimensional Fourier Transform and Its Inverse
The values u = 0, 1, 2, …, M-1 correspond to samples of the continuous transform at values 0, u, 2u, …, (M-1)u. i.e. F(u) represents F(uu), where: Each term of the FT (F(u) for every u) is composed of the sum of all values of f(x) H.R. Pourreza

13 Discrete One-Dimensional Fourier Transform and Its Inverse
The Fourier transform of a real function is generally complex and we use polar coordinates: H.R. Pourreza

14 Discrete One-Dimensional Fourier Transform and Its Inverse
|F(u)| (magnitude function) is the Fourier spectrum of f(x) and (u) its phase angle. The square of the spectrum is referred to as the Power Spectrum of f(x) (spectral density). H.R. Pourreza

15 Discrete 2-Dimensional Fourier Transform
Fourier spectrum: Phase: Power spectrum: H.R. Pourreza

16 Discrete One-Dimensional Fourier Transform and Its Inverse
H.R. Pourreza

17 Time and Frequency Resolution and Sampling
Fmax = 100 Hz What is the sampling rate (Nyquist)? What is the time resolution? What is the frequency resolution? What if the sampling rate is higher than the Nyquist sampling rate? What if we take samples for two seconds with the Nyquist sampling rate? 1 second H.R. Pourreza

18 Discrete Two-Dimensional Fourier Transform and Its Inverse
Fourier Spectrum H.R. Pourreza

19 Discrete Two-Dimensional Fourier Transform and Its Inverse
F(0,0) is the average intensity of an image H.R. Pourreza

20 Discrete Two-Dimensional Fourier Transform and Its Inverse
Use Matlab to generate the above figures H.R. Pourreza

21 Frequency Shifting Property of the Fourier Transform
H.R. Pourreza

22 Frequency Shifting Property of the Fourier Transform
H.R. Pourreza

23 Basic Filtering in the Frequency Domain using Matlab
function Normalized_DFT = Img_DFT(img) img=double(img); % So mathematical operations can be conducted on % the image pixels. [R,C]=size(img); for r = 1:R % To phase shift the image so the DFT will be for c=1:C % centered on the display monitor phased_img(r,c)=(img(r,c))*(-1)^((r-1)+(c-1)); end fourier_img = fft2(phased_img); %Discrete Fourier Transform mag_fourier_img = abs(fourier_img ); % Magnitude of DFT Log_mag_fourier_img = log10(mag_fourier_img +1); Max = max(max(Log_mag_fourier_img )); Normalized_DFT = (Log_ mag_fourier_img )*(255/Max); imshow(uint8(Normalized_DFT)) H.R. Pourreza

24 Basic Filtering in the Frequency Domain
Multiply the input image by (-1)x+y to center the transform Compute F(u,v), the DFT of the image from (1) Multiply F(u,v) by a filter function H(u,v) Compute the inverse DFT of the result in (3) Obtain the real part of the result in (4) Multiply the result in (5) by (-1)x+y H.R. Pourreza

25 Filtering out the DC Frequency Component
H.R. Pourreza

26 Filtering out the DC Frequency Component
Notch Filter otherwise H.R. Pourreza

27 Low-pass and High-pass Filters
Low Pass Filter attenuate high frequencies while “passing” low frequencies. High Pass Filter attenuate low frequencies while “passing” high frequencies. H.R. Pourreza

28 Low-pass and High-pass Filters
H.R. Pourreza

29 Low-pass and High-pass Filters
H.R. Pourreza

30 Low-pass and High-pass Filters
H.R. Pourreza

31 Smoothing Frequency Domain, Ideal Low-pass Filters
H.R. Pourreza

32 Smoothing Frequency Domain, Ideal Low-pass Filters
Total Power The remained percentage power after filtration H.R. Pourreza

33 Smoothing Frequency Domain, Ideal Low-pass Filters
fc =5  = 92% fc =30  = 96.4% fc =15  = 94.6% fc =80  = 98% fc =230  = 99.5% H.R. Pourreza

34 Cause of Ringing H.R. Pourreza

35 Project #5, Ideal Low-pass Filter
Implement in Matlab the Ideal low-pass filter in the following equation. You must give the user the ability to specify the cutoff frequency D0 Calculate the The remained percentage power after filtration. Display the image after filtration Use Elaine image to test your program H.R. Pourreza

36 Smoothing Frequency Domain, Butterworth Low-pass Filters
H.R. Pourreza

37 Smoothing Frequency Domain, Butterworth Low-pass Filters
Butterworth Low-pass Filter: n=2 Radii= 5 Radii= 15 Radii= 30 Radii= 80 Radii= 230 H.R. Pourreza

38 Smoothing Frequency Domain, Butterworth Low-pass Filters
H.R. Pourreza

39 Smoothing Frequency Domain, Gaussian Low-pass Filters
H.R. Pourreza

40 Smoothing Frequency Domain, Gaussian Low-pass Filters
Radii= 5 Radii= 15 Radii= 30 Radii= 80 Radii= 230 H.R. Pourreza

41 Smoothing Frequency Domain, Gaussian Low-pass Filters
H.R. Pourreza

42 Smoothing Frequency Domain, Gaussian Low-pass Filters
H.R. Pourreza

43 Smoothing Frequency Domain, Gaussian Low-pass Filters
H.R. Pourreza

44 Sharpening Frequency Domain Filters
Hhp(u,v) = 1 - Hlp(u,v) H.R. Pourreza

45 Sharpening Frequency Domain Filters
H.R. Pourreza

46 Sharpening Frequency Domain, Ideal High-pass Filters
H.R. Pourreza

47 Sharpening Frequency Domain, Butterworth High-pass Filters
H.R. Pourreza

48 Sharpening Frequency Domain, Gaussian High-pass Filters
H.R. Pourreza

49 Homomorphic Filtering
H.R. Pourreza

50 Homomorphic Filtering
H.R. Pourreza

51 Convolution h(t) g(t) k(t) g(t) = k(t)*h(t) G(f) = K(f)H(f)
* is a convolution operator and not multiplication 1 2 3 t k(t) -1 1 t h(t) H.R. Pourreza

52 Convolution -1 1 m h(m) g(t) m k(-m) H.R. Pourreza

53 Convolution -1 1 m h(m) g(t) m k(1-m) H.R. Pourreza

54 Convolution -1 1 m h(m) g(t) m k(2-m) H.R. Pourreza

55 Convolution -1 1 m h(m) g(t) m k(3-m) H.R. Pourreza

56 Convolution -1 1 m h(m) g(t) m k(4-m) H.R. Pourreza

57 Convolution -1 1 m h(m) g(t) m k(5-m) H.R. Pourreza

58 Convolution -1 1 m h(m) g(t) m k(6-m) H.R. Pourreza

59 2-Dimensions Convolution
H.R. Pourreza

60 Correlation g(t) = k(t)h(t) G(f) = K(f)* . H(f) h(t) k(t) g(t) -1 1 2
H.R. Pourreza

61 Correlation H.R. Pourreza

62 Convolution H.R. Pourreza

63 Convolution H.R. Pourreza

64 Convolution H.R. Pourreza

65 Convolution H.R. Pourreza


Download ppt "Digital Image Processing"

Similar presentations


Ads by Google