|
objectIntensity = double(imread('cameraman.tif'));
%1) Coherent imaging
figure(1); subplot(221); imshow(objectIntensity, []);
title('Input object');
objectAmplitude = sqrt(objectIntensity);
waveLength = 0.5e-6; %0.5 um
k0 = 2*pi/waveLength;
pixelSize = 0.5e-6; %0.5 um
NA = 0.1;
cutoffFrequence = NA*k0;
%coherent transfer function
objectAmplitudeFT = fftshift(fft2(objectAmplitude)); [m n] = size(objectAmplitude); kx = -pi/pixelSize:2*pi/(pixelSize*(n-1)):pi/pixelSize; ky = -pi/pixelSize:2*pi/(pixelSize*(m-1)):pi/pixelSize; [kxn, kym] = meshgrid(kx,ky);
CTF = ((kxn.^2 + kym.^2)<cutoffFrequence^2); %uniform frequency response
subplot(222);
imshow(CTF,[]); title('OTF');
%filtering
outputFT = CTF.*objectAmplitudeFT;
subplot(223); imshow(log(abs(outputFT)),[]);
title('Filtered spectrum');
%output
outputAmplitude = ifft2(ifftshift(outputFT)); outputIntensity = abs(outputAmplitude).^2; subplot(224); imshow(outputIntensity,[]);
title('Output object');
suptitle('Coherent imaging');
%2) Incoherent imaging
figure(2); subplot(221); imshow(objectIntensity, []);
title('Input object');
%incoherent transfer function
cpsf = ifftshift(ifft2(CTF)); ipsf = (abs(cpsf)).^2; ITF = abs(ifftshift(fft2(ipsf))); ITF = ITF/max(max(ITF)); subplot(222);
imshow(ITF,[]); title('OTF');
%filtering
outputFT = ITF.*objectAmplitudeFT; subplot(223); imshow(log(abs(outputFT)),[]);
title('Filtered spectrum');
outputAmplitude = ifft2(ifftshift(outputFT));
outputIntensity = abs(outputAmplitude).^2;
subplot(224);
imshow(outputIntensity,[]);
title('Output object');
suptitle('Incoherent imaging');
References:
http://www.disp.duke.edu/~dbrady/ece469/notes/naii/naii.html
https://spie.org/samples/FG17.pdf
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-27 01:20
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社