<<

Fourier

Ivan Bazarov Cornell Physics Department / CLASSE

Outline • 2D • 4-f System • Examples of spatial filters • contrast imaging • Matlab FFT

1 Fourier Optics P3330 Exp Optics FA’2016 Properties of 2D Fourier Transforms

Definitions:

i2⇡(xfx+yfy ) F (fx,fy)= f(x, y)e dxdy ZZ i2⇡(xfx+yfy ) f(x, y)= F (fx,fy)e df xdf y ZZ Linearity: ↵f(x, y)+g(x, y) ↵F (f ,f )+G(f ,f ) ! x y x y Scaling: x y f , ab F (af ,bf ) a b ! | | x y Shift: ⇣ ⌘ i2⇡(x f +y f ) f(x x ,y y ) F (f ,f )e 0 x 0 y 0 0 ! x y 2 Fourier Optics P3330 Exp Optics FA’2016 Properties of 2D Fourier Transforms (contd.)

Rotation: R f(x, y) R F (f ,f ) ✓ { } ! ✓ { x y } :

f(˜x, y˜)g(x x,˜ y y˜)dxd˜ y˜ F (f ,f )G(f ,f ) ! x y x y ZZ Parseval’s theorem:

f(x, y) 2dxdy = F (f ,f ) 2df df | | | x y | x y ZZ ZZ Slice theorem:

f(x, y)dy F (f , 0) ! x Z 3 Fourier Optics P3330 Exp Optics FA’2016 4-f System

Collimate Mask FT Filter IFT Out

FFT FFT FFT FFT

Prepare input 1 “4-f system” Input mask f(x, y) x y x y Filter mask F 0 , 0 G 0 , 0 FFT FFT FFT FFT x y ✓ ◆ ✓ ◆ Take FT F 0 , 0 FFT FFT Inverse FT f(˜x, y˜)g(x x,˜ y y˜)dxd˜ y˜ ✓ ◆ ZZ 2D object f(x,y) has been filtered with 2D filter with impulse response g(x,y)

4 Fourier Optics P3330 Exp Optics FA’2016 Coordinate system after the : converter

Thus, the spatial frequency fx is related to coordinate x’ by scaling factor Fl

5 Fourier Optics P3330 Exp Optics FA’2016 •Lecture 4 ECE 4606 Undergraduate Optics Lab –Fourier optics

SimpleSimple optical Fourier Fourier Transform transforms Focal length F = 100 mm

Laser λ0 = 632 nm

Amplitude cosine, aka grating

100,000× .0 632 x′ = 200 λ = 200 µm x = 316 µm

Rotate object by 45o x′ = y′ 100,000× .0 632 = 282 8. = 223 µm

λx = λy = 2 × 200 µm = 282 8. µm

6 Robert R. McLeod, University of Colorado Fourier Optics 49P3330 Exp Optics FA’2016 •Lecture 4 ECE 4606 Undergraduate Optics Lab –ExampleLow pass filter (sharp cutoff) Low pass, sharp cutoff REAL SPACE FOURIER SPACE

Multiplied by

252.8 µm pinhole Filter cutoff frequency = 1/500 µm-1 Filter cutoff position = 126.4 µm Focal length = 100 mm Laser wavelength = 632 nm

All plots show amplitude of E

Smoothed, but Gibbs ringing due to sharp filter edges =

7 Robert R. McLeod, University of Colorado Fourier Optics 50 P3330 Exp Optics FA’2016 •Lecture 4 ECE 4606 Undergraduate Optics Lab –ExampleLow pass filter (smooth cutoff) Low pass, smooth cutoff REAL SPACE FOURIER SPACE

Multiplied by

Filter cutoff frequency = 1/500 µm-1 Filter cutoff position = 126.4 µm Edge smoothing = 132 µm Focal length = 100 mm Laser wavelength = 632 nm

Now just nicely smoothed =

51 8 Robert R. McLeod, University of Colorado Fourier Optics 51 P3330 Exp Optics FA’2016 •Lecture 4 ECE 4606 Undergraduate Optics Lab –Example High pass (narrow band) High pass, narrowband REAL SPACE FOURIER SPACE

Multiplied by

105.2 µm “dot” Filter cutoff frequency = 1/1200 µm-1 Filter cutoff position = 52.6 µm Edge smoothing = 58.2 µm Focal length = 100 mm Laser wavelength = 632 nm

Note sharp edges, darkening of large, uniform areas (~DC) =

Sharp filter used for clarity

9 Robert R. McLeod, University of Colorado Fourier Optics 52 P3330 Exp Optics FA’2016 •Lecture 4 ECE 4606 Undergraduate Optics Lab –Example High pass (high band) High pass, wideband REAL SPACE FOURIER SPACE

Multiplied by

Filter cutoff frequency = 1/300 µm-1 Filter cutoff position = 210.6 µm Edge smoothing = 46.6 µm Focal length = 100 mm Laser wavelength = 632 nm

Only edges remain. Almost a “line drawing” =

10 Robert R. McLeod, University of Colorado Fourier Optics 53 P3330 Exp Optics FA’2016 •Lecture 4 ECE 4606 Undergraduate Optics Lab Vertical–Example low pass (“smeers” vertically) Vertical low pass REAL SPACE FOURIER SPACE

Multiplied by

632 µm horiz. slit Filter cutoff frequency = 1/200 µm-1 Filter cutoff position = 316 µm Edge smoothing = 93.6 µm Focal length = 100 mm Laser wavelength = 632 nm

Horizontal lines at edges of eyes gone Vertical lines above nose remain. =

11 Robert R. McLeod, University of Colorado Fourier Optics 54 P3330 Exp Optics FA’2016 •Lecture 4 ECE 4606 Undergraduate Optics Lab Horizontal–Example low pass (“smeers” horizontally) Horizontal low pass REAL SPACE FOURIER SPACE

Multiplied by

Filter cutoff frequency = 1/200 µm-1 Filter cutoff position = 316 µm 632 Edge smoothing = 93.6 µm µm Focal length = 100 mm vert. Laser wavelength = 632 nm slit

Horizontal lines at edges of eyes remain. Vertical lines above nose gone. =

12 Robert R. McLeod, University of Colorado Fourier Optics 55 P3330 Exp Optics FA’2016 •Lecture 4 ECE 4606 Undergraduate Optics Lab –Example SimplerSimpler object objects

Low-pass

Original High-pass

A side note: this is how bandpass filters Low-pass, different cutoff in x&y look like in the frequency (focus) domain.

13 Robert R. McLeod, University of Colorado Fourier Optics 56 P3330 Exp Optics FA’2016 •Lecture 4 ECE 4606 Undergraduate Optics Lab –Phase Phasecontrast contrast imaging Phase contrast REAL SPACE FOURIER SPACE

Ansel − jπ e max()Ansel

Multiplied by

Filter cutoff frequency = 1/5000 µm-1 Filter cutoff position = 12.6 µm Focal length = 100 mm Laser wavelength = 632 nm Knife edge

Phase has become amplitude. Zernike won the 1953 Nobel in Physics for this. =

14 Robert R. McLeod, University of Colorado Fourier Optics 57 P3330 Exp Optics FA’2016 Some MATLAB tips: 2D functions

• Create a matrix that evaluates 2D Gaussian: exp(-p/2(x2+y2)/s2) – >>ind = [-32:1:31] / 32; x – >>[x,y] = meshgrid(ind,-1*ind); – >>z = exp(-pi/2*(x.^2+y.^2)/(.25.^2)); – >>imshow(z) – >>colorbar y y’ -1

64x64 matrix x’ 0

31/32 -1 15 Fourier Optics P3330 Exp Optics FA’2016 FFT “splits” low

1D Fourier Transform low frequencies (aka shift theorem) 12 – >>l = z(33,:); 10 – >>L = fft(l); 8 6 4 abs (L) 1 2 0.9 0 0.8 10 20 30 40 50 60

0.7 4 0.6 l 0.5 2 0.4 0 0.3

0.2 -2

0.1 (L) phase -4 0 10 20 30 40 50 60 10 20 30 40 50 60

1 33 64 1 33 64 sample # sample #

0 xmax 0 fN/2 fN x [Matlab] 16 Fourier Optics u P3330 Exp Optics FA’2016 Use FFTSHIFT prior to/after FFT or FFT2

Use fftshift for 2D functions – >>smiley2 = fftshift(smiley);

17 Fourier Optics P3330 Exp Optics FA’2016 If your FFT looks jagged…

f = zeros(30,30); f(5:24,13:17) = 1; imshow(f,'InitialMagnification','fit')

F = fft2(f); F2 = log(abs(F)); imshow(F2,[-1 5],'InitialMagnification','fit'); colormap(jet); colorbar

Discrete Fourier Transform Computed Without Padding

18 Fourier Optics P3330 Exp Optics FA’2016 Apply zero-padding!

F = fft2(f,256,256); imshow(log(abs(F)),[-1 5]); colormap(jet); colorbar Discrete Fourier Transform With Padding

% Apply FFTSHIFT F = fft2(f,256,256);F2 = fftshift(F); imshow(log(abs(F2)),[-1 5]); colormap(jet); colorbar “wrong” low frequency location! Normal FT look

19 Fourier Optics P3330 Exp Optics FA’2016 Links/references

http://ecee.colorado.edu/~mcleod/teaching/ugol/lecturenotes/Lecture%2 04%20Fourier%20Optics.pdf

http://www.medphysics.wisc.edu/~block/bme530lectures/matlabintro.ppt

http://www.mathworks.com/help/images/fourier-transform.html

20 Fourier Optics P3330 Exp Optics FA’2016