Presentation is loading. Please wait.

Presentation is loading. Please wait.

DREAM PLAN IDEA IMPLEMENTATION 1. 2 3 Introduction to Image Processing Dr. Kourosh Kiani

Similar presentations


Presentation on theme: "DREAM PLAN IDEA IMPLEMENTATION 1. 2 3 Introduction to Image Processing Dr. Kourosh Kiani"— Presentation transcript:

1 DREAM PLAN IDEA IMPLEMENTATION 1

2 2

3 3 Introduction to Image Processing Dr. Kourosh Kiani Email: kkiani2004@yahoo.comkkiani2004@yahoo.com Email: Kourosh.kiani@aut.ac.irKourosh.kiani@aut.ac.ir Email: Kourosh.kiani@semnan.ac.irKourosh.kiani@semnan.ac.ir Web: www.kouroshkiani.comwww.kouroshkiani.com Present to: Amirkabir University of Technology (Tehran Polytechnic) & Semnan University

4 Lecture 09 4 Discrete Fourier Transform (DFT) of 1D signal

5 Discrete Time Periodic Signals A discrete time signal x[n] is periodic with period N if and only if for all n. Definition: Meaning: a periodic signal keeps repeating itself forever!

6 Example: a Sinusoid Consider the Sinusoid: It is periodic with period since for all n.

7 General Periodic Sinusoid Consider a Sinusoid of the form: It is periodic with period N since for all n. with k, N integers.

8 Consider the sinusoid: It is periodic with period since for all n. We can write it as: Example of Periodic Sinusoid

9 Consider a Complex Exponential of the form: for all n. It is periodic with period N since Periodic Complex Exponentials

10 Consider the Complex Exponential: We can write it as Example of a Periodic Complex Exponential and it is periodic with period N = 20.

11 Goal: We want to write all discrete time periodic signals in terms of a common set of “reference signals”. Reference Frames It is like the problem of representing a vector in a reference frame defined by an origin “0” reference vectors Reference Frame

12 Reference Frames in the Plane and in Space For example in the plane we need two reference vectors Reference Frame … while in space we need three reference vectors Reference Frame

13 A Reference Frame in the Plane If the reference vectors have unit length and they are perpendicular (orthogonal) to each other, then it is very simple: Where projection of along projection of along The plane is a 2 dimensional space.

14 A Reference Frame in the Space If the reference vectors have unit length and they are perpendicular (orthogonal) to each other, then it is very simple: Where projection of along projection of along The “space” is a 3 dimensional space.

15 Example: where am I ? N E Point “x” is 300m East and 200m North of point “0”.

16 Reference Frames for Signals We want to expand a generic signal into the sum of reference signals. The reference signals can be, for example, sinusoids or complex exponentials reference signals

17 Back to Periodic Signals A periodic signal x[n] with period N can be expanded in terms of N complex exponentials as

18 A Simple Example Take the periodic signal x[n] shown below: Notice that it is periodic with period N=2. Then the reference signals are We can easily verify that (try to believe!): for all n.

19 Another Simple Example Take another periodic signal x[n] with the same period (N=2): Then the reference signals are the same We can easily verify that (again try to believe!): for all n. Same reference signals, just different coefficients

20 Orthogonal Reference Signals Notice that, given any N, the reference signals are all orthogonal to each other, in the sense Since by the geometric sum

21 … apply it to the signal representation … and we can compute the coefficients. Call then

22 Discrete Fourier Series Given a periodic signal x[n] with period N we define the Discrete Fourier Series (DFS) as Since x[n] is periodic, we can sum over any period. The general definition of Discrete Fourier Series (DFS) is for any

23 Inverse Discrete Fourier Series The inverse operation is called Inverse Discrete Fourier Series (IDFS), defined as

24 Revisit the Simple Example Recall the periodic signal x[n] shown below, with period N=2: Then Therefore we can write the sequence as

25 Example of Discrete Fourier Series Consider this periodic signal The period is N=10. We compute the Discrete Fourier Series

26 … now plot the values …

27 Example of DFS Compute the DFS of the periodic signal Compute a few values of the sequence and we see the period is N=2. Then which yields

28 Signals of Finite Length All signals we collect in experiments have finite length Example: we have 30ms of data sampled at 20kHz (ie 20,000 samples/sec). Then we have

29 Series Expansion of Finite Data We want to determine a series expansion of a data set of length N. Very easy: just look at the data as one period of a periodic sequence with period N and use the DFS:

30 Discrete Fourier Transform (DFT) Given a finite interval of a data set of length N, we define the Discrete Fourier Transform (DFT) with the same expression as the Discrete Fourier Series (DFS): And its inverse

31 Signals of Finite Length All signals we collect in experiments have finite length in time Example: we have 30ms of data sampled at 20kHz (ie 20,000 samples/sec). Then we have

32 Series Expansion of Finite Data We want to determine a series expansion of a data set of length N. Very easy: just look at the data as one period of a periodic sequence with period N and use the DFS:

33 Discrete Fourier Transform (DFT) Given a finite of a data set of length N we define the Discrete Fourier Transform (DFT) with the same expression as the Discrete Fourier Series (DFS): and its inverse

34 Example of Discrete Fourier Transform Consider this signal The length is N=10. We compute the Discrete Fourier Transform

35 … now plot the values …

36 Fs = 1000; % Sampling frequency T = 1/Fs; % Sample time L = 1000; % Length of signal t = (0:L-1)*T; % Time vector % Sum of a 50 Hz sinusoid and a 120 Hz sinusoid x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); y = x + 2*randn(size(t)); % Sinusoids plus noise figure (1); plot(Fs*t(1:50),y(1:50)) title('Signal Corrupted with Zero-Mean Random Noise') xlabel('time (milliseconds)')

37 NFFT = 2^nextpow2(L); % Next power of 2 from length of y Y = fft(y,NFFT)/L; f = Fs/2*linspace(0,1,NFFT/2+1); figure (2); % Plot single-sided amplitude spectrum. plot(f,2*abs(Y(1:NFFT/2+1))) title('Single-Sided Amplitude Spectrum of y(t)') xlabel('Frequency (Hz)') ylabel('|Y(f)|')

38 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.

39 m = 4; n = 2^m-1; x = gf(randi([0 2^m-1],n,1),m); % Random vector y = fft(x); % Transform of x z = ifft(y); % Inverse transform of y ck = isequal(z,x) % Check that ifft(fft(x)) recovers x. [x z]= 5 5 2 2 3 3 0 0 14 12 5 5 13 12 9 9 6 6 5 5 1 1 5 5 8 8

40 >> a=[1 2 3 4 5 6] a = 1 2 3 4 5 6 >> b=fft(a') b= 21.0000 -3.0000 + 5.1962i -3.0000 + 1.7321i -3.0000 -3.0000 - 1.7321i -3.0000 - 5.1962i  Example in Matlab >> c=ifft(b); >> a=c' a = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000

41 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:

42 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 !

43 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

44 y=rand(1024,1); z=fft(y) subplot(2,1,1) plot(abs(z)) title('FFT') w=fftshift(z) subplot(2,1,2) plot(abs(w)) title('FFTHIFT')

45 Questions? Discussion? Suggestions ?

46 46


Download ppt "DREAM PLAN IDEA IMPLEMENTATION 1. 2 3 Introduction to Image Processing Dr. Kourosh Kiani"

Similar presentations


Ads by Google