- 3
- 0
I want to know the reconstruction of phase shift interferometry by angular spectrum method in matlab
clear all; close all;
I=imread('cameraman.tif', 'tif');
% parameter setup
M=256;
deltax=0.001; % pixel pitch 0.001 cm (10 um)
w=633*10^-8; % wavelength 633 nm
z=25; % 25 cm, propagation distance
delta=pi/2; % phase step (change it to show part b)
%Step 1: Simulation of propagation using the ASM
r=1:M;
c=1:M;
[C, R]=meshgrid(c, r);
A0=fftshift(ifft2(fftshift(I)));
deltaf=1/M/deltax;
p=exp(-2i*pi*z.*((1/w)^2-((R-M/2-1).*deltaf).^2-((C-M/2-1).*deltaf).^2).^0.5);
Az=A0.*p;
EO=fftshift(fft2(fftshift(Az)));
%Step 2: Interference at the hologram plane
AV=(min(min(abs(EO)))+max(max(abs(EO))));
% the amplitude of reference light
% Recording of Four phase-shifting holograms
I0=(EO+AV).*conj(EO+AV);
I1=(EO+AV*exp(-1j*delta)).*conj(EO+AV*exp(-1j*delta));
I2=(EO+AV*exp(-2j*delta)).*conj(EO+AV*exp(-2j*delta));
I3=(EO+AV*exp(-3j*delta)).*conj(EO+AV*exp(-3j*delta));
MAX=max(max([I0, I1, I2, I3]));
figure(1);
subplot(2,4,1);imshow(I);
title('Original object')
axis off
figure(1)
subplot(2,4,2)
imshow(I0/MAX);
axis off
title('hologram 1')
subplot(2,4,3)
imshow(I1/MAX);
axis off
title('hologram 2')
subplot(2,4,6)
imshow(I2/MAX);
axis off
title('hologram 3')
subplot(2,4,7)
imshow(I3/MAX);
axis off
title('hologram 4')
%Step 3: Reconstruction
CH=(I0-I2)-1j*(I1-I3); % the complex hologram (4-step PSH)
%A1=fftshift(ifft2(fftshift(CH)));
%Az1=A1.*conj(p);
%EI=fftshift(fft2(fftshift(Az1)));
%EI=(EI.*conj(EI));
%EI=EI/max(max(EI));
%figure(1);
%subplot(2,4,4)
%imshow(EI);
%title('Reconstructed image of 4-step PSH')
%axis off
U1 = ifft2(ifftshift(fftshift(fft2(CH)).*conj(p)));
Iangular = (1/(16*pi)).*(U1.*conj(U1));
EI=Iangular/max(max(Iangular));
figure(1);
subplot(2,4,4)
imshow(EI);
title('Reconstructed image of 4-step PSH')
axis off
s=PSNR(I,EI)