# EE3190 Optical Sensing and Imaging, Fall 2004 © Timothy J. Schulz EE3190 Optical Sensing and Imaging Computing PSFs with a digital computer.

## Presentation on theme: "EE3190 Optical Sensing and Imaging, Fall 2004 © Timothy J. Schulz EE3190 Optical Sensing and Imaging Computing PSFs with a digital computer."— Presentation transcript:

EE3190 Optical Sensing and Imaging, Fall 2004 © Timothy J. Schulz EE3190 Optical Sensing and Imaging Computing PSFs with a digital computer

EE3190 Optical Sensing and Imaging© Timothy J. Schulz Electrical and Computer Engineering Fall 2004 Sampling the Pupil Function For square arrays (equal number of samples in both dimensions), select the sample spacing so that the pupil function fills up half of the array: D is the pupil diameter in meters N is the number of samples across the array When using the FFT it is good practice to select N to be even. Better yet, is to select N to be a power of 2.

EE3190 Optical Sensing and Imaging© Timothy J. Schulz Electrical and Computer Engineering Fall 2004 Sampling the Pupil Function Create a sampling grid

EE3190 Optical Sensing and Imaging© Timothy J. Schulz Electrical and Computer Engineering Fall 2004 Sampling the Pupil Function Create a sampling grid d2 = 2*D/N; u = [-N/2:1:N/2-1]*d2; [u1,u2] = meshgrid(u); -1.5000 -1.0000 -0.5000 0 0.5000 1.0000 -1.5000 -1.5000 -1.5000 -1.5000 -1.5000 -1.5000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -0.5000 -0.5000 -0.5000 -0.5000 -0.5000 -0.5000 0 0 0 0 0 0 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 u u1u2 example: d2 = 1/2; N = 6

EE3190 Optical Sensing and Imaging© Timothy J. Schulz Electrical and Computer Engineering Fall 2004 Sampling the Pupil Function Example: Square Pupil (DxD meters) Example: Circular Pupil (diameter: D meters) p = (abs(u1)<=D/2)&(abs(u2)<=D/2); r = sqrt(u1.^2 + u2.^2); p = r<=D/2;

EE3190 Optical Sensing and Imaging© Timothy J. Schulz Electrical and Computer Engineering Fall 2004 Compute the PSF Using the FFT algorithm P = fftshift(fft2(fftshift(p)); d1 = lambda*d/(N*d2); u = [-N/2:1:N/2-1]*d1; 12 3 44 1 3 2 fftshift lambda is wavelength d is distance to object or image

EE3190 Optical Sensing and Imaging© Timothy J. Schulz Electrical and Computer Engineering Fall 2004 Example: Circular pupil D = 1; lambda = 1e-6; do = 10e3; N = 256; d2 = 2*D/N; u = [-N/2:1:N/2-1]*d2; [u1,u2] = meshgrid(u); r = sqrt(u1.^2+u2.^2); p = abs(r)<=D/2; figure(1); colormap(gray); subplot(2,1,1); imagesc(u,u,p); axis image; P = fftshift(fft2(fftshift(p))); d1 = lambda*do/(N*d2); x = [-N/2:1:N/2-1]*d1; subplot(2,1,2); imagesc(x,x,abs(P)); axis image;

EE3190 Optical Sensing and Imaging© Timothy J. Schulz Electrical and Computer Engineering Fall 2004 Example: Circular pupil D = 1; lambda = 1e-6; do = 10e3; N = 256; d2 = 2*D/N; u = [-N/2:1:N/2-1]*d2; [u1,u2] = meshgrid(u); r = sqrt(u1.^2+u2.^2); p = abs(r)<=D/2; figure(1); colormap(gray); subplot(2,1,1); imagesc(u,u,p); axis image; P = fftshift(fft2(fftshift(p))); d1 = lambda*do/(N*d2); x = [-N/2:1:N/2-1]*d1; subplot(2,1,2); imagesc(x,x,abs(P)); axis image; axis([-1 1 -1 1]*10*lambda*do/D);

EE3190 Optical Sensing and Imaging© Timothy J. Schulz Electrical and Computer Engineering Fall 2004 Example: Circular pupil (defocus) D = 1; lambda = 1e-6; do = 10e3; di = 10e-2; f = 1/(1/do + 1/di); ferror = 1/(1/(do*1.06) + 1/di); N = 256; d2 = 2*D/N; u = [-N/2:1:N/2-1]*d2; [u1,u2] = meshgrid(u); r = sqrt(u1.^2+u2.^2); p = (abs(r)<=D/2).*... exp(-j*(pi/(lambda*f))*r.^2).*... exp(j*(pi/(lambda*ferror))*r.^2); figure(1); colormap(gray); subplot(2,1,1); imagesc(u,u,angle(p)); axis image; P = fftshift(fft2(fftshift(p))); d1 = lambda*do/(N*d2); x = [-N/2:1:N/2-1]*d1; subplot(2,1,2); imagesc(x,x,abs(P)); axis image; axis([-1 1 -1 1]*8*lambda*do/D);

Similar presentations