Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fourier transform.

Similar presentations


Presentation on theme: "Fourier transform."— Presentation transcript:

1 Fourier transform

2 The Fourier transform The Fourier transform is a representation of an image as a sum of complex exponentials of varying magnitudes, frequencies, and phases. The Fourier transform plays a critical role in a broad range of image processing applications, including enhancement, analysis, restoration, and compression.

3 The one-dimensional discrete Fourier transform
Any periodic signal may be expressed as a weighted combination of sine and cosine functions having different periods or frequencies. The process of breaking down a periodic signal as a sum of sine and cosine functions is called a Fourier decomposition or Fourier expansion

4 Fourier series

5 The Fourier Transform A Fourier transform G of a function g, for which is defined by the Fourier integral as The original function g can be recovered from its transform G using this formula

6 The Discrete Fourier Transform
Assume that the function g has nonzero values only in the interval [—p/2, p/2]; in this case, Because g is zero outside [—p/2, p/2], then by applying the sampling to the transform G, we can infer that G can be completely reconstructed from its values at points k/p

7 The Discrete Fourier Transform
If the interval [0, p] is also divided into N equal subintervals to represent times at which continuous-time signal g is sampled and the integral is replaced by the Riemann sum, then

8 The Discrete Fourier Transform
An N-point discrete Fourier transform (DFT) is a finite sequence of real or complex numbers G(0),..., G(N — 1) representing the discrete frequency sequence corresponding to a finite sequence of real or complex numbers g(0),..., g(N — 1) representing a discrete time sequence as follows: A corresponding inverse discrete Fourier transform is defined as the sum

9 The Discrete Fourier Transform
The amplitude spectrum of function g is the magnitude function | G | defined as and the phase spectrum is a set {k: k = 0, 1,2,...}, where

10 The Discrete Fourier Transform
Consider a sequence of four samples, g = {1, 2, 3, 4}

11 The Discrete Fourier Transform
The amplitude spectrum is given by And the phase spectrum by

12 The 2-dimensional discrete Fourier transform
An M×N image g(x, y), x = 0, 1, 2, …, M–1 and y = 0, 1, 2, …, N–1 F(u, v): frequency data (or Fourier coefficients) at location (u, v) in the M×N frequency rectangle where u = 0, 1, 2, …, M–1 and v = 0, 1, 2, …, N–1 G(u,v) M N g(x,y) M N 2D DFT

13 2-dimensional discrete Fourier transform
The 2-D DFT can be calculated by using this property of separability; to obtain the 2-D DFT of a matrix, we first calculate the DFT of all the rows, and then calculate the DFT of all the columns of the result

14 How can we write the discrete Fourier transform in matrix form?
We construct matrix U with elements where x takes the values 0,1,.. .,N—1 along each column and a takes the same values along each row. The 2-dimensional discrete Fourier transform of an image g in matrix form is given by:

15 N = 4, 0 < x < 3, 0 < a < 3:

16

17 Fourier transforms in MATLAB

18 The DC coefficient >> a=ones(8); >> fft2(a)
Note that the DC coefficient is indeed the sum of all the matrix values

19 Visualizing the Fourier Transform

20 Fourier transforms of images
FFT MATLAB code >> [x,y]=meshgrid(1:256,1:256); >> b=(x+y<329)&(x+y>182)&(x-y>-67)&(x-y<73); >> imshow(b) >> bf=fftshift(fft2(b)); >> figure,fftshow(bf)

21 Fourier transforms of images
M pixels (0,0 (0,N/2 u N pixels (0,0 (-M/2,0 (M/2,0 (0,-N/2 MATLAB code >> im = imread('lena.bmp'); >> bf=fftshift(fft2(im)); >> figure,fftshow(bf) v

22 Filtering in the frequency domain
Low pass filter High pass filter Band pass filter

23 Filtering in the frequency domain
Ideal filtering  Low pass filtering Suppose we have a Fourier transform matrix F, shifted so that the DC coefficient is in the center. we can perform low pass filtering by multiplying the transform by a matrix in such a way that centre values are maintained, and values away from the centre are either removed or minimized. One way to do this is to multiply by an ideal low-pass matrix, which is a binary matrix m

24 Ideal filtering  Low pass filtering

25 Ideal filtering  Low pass filtering
FFT MATLAB code cm=imread('cameraman.tif'); cf=fftshift(fft2(cm)); figure,fftshow(cf,'log') imshow(cm); [x,y]=meshgrid(-128:217,-128:127); z=sqrt(x.^2+y.^2); c=(z<15); cfl=cf.*c(1:256,1:256); figure,fftshow(cfl,'log') cfli=ifft2(cfl); figure,fftshow(cfli,'abs') Low pass filter

26 Ideal low pass filtering with different cutoffs

27 High pass ltering high pass filtering can be performed by the opposite: eliminating centre values and keeping the others. High pass filter

28 Butterworth filtering
Butterworth filter functions are based on the following functions for low pass filters: and for high pass filters:

29 Ideal vs Butterworth filtering

30 Butterworth filtering
LPF HPF

31 Motion deblurring Inverse filtering
We have seen that we can perform filtering in the Fourier domain by multiplying the DFT of an image by the DFT of a filter: this is a direct use of the convolution theorem. we should be able to recover the (DFT of the) original image

32 Motion deblurring deblur the image Original image motion blur image
To deblur the image, we need to divide its transform by the transform corresponding to the blur filter. This means that we first create a matrix corresponding to the transform of the blur: bc=imread('board.tif'); bg=im2uint8(rgb2gray(bc)); b=bg(100:355,50:305); imshow(b) m=fspecial('motion',7,0); bm=imfilter(b,m); imshow(bm) m2=zeros(256,256); m2(1,1:7)=m; mf=fft2(m2); bmi=ifft2(fft2(bm)./mf); fftshow(bmi,'abs') d=0.02; mf=fft2(m2);mf(find(abs(mf)<d))=1; imshow(mat2gray(abs(bmi))*2) Original image motion blur image

33 END


Download ppt "Fourier transform."

Similar presentations


Ads by Google