m
= 2133; n=1719 %
Size of Captured Image
nAngles = 9; cAngles = (nAngles+1)/2; %
Number of Angular Samples
F1Y = 237; F1X = 191;
%Cosine
Frequency in Pixels from Calibration Image
phi1
= 300; phi2 = 150; %
PhaseShift due to Mask In-Plane Transltn wrt Sensor
F12X = floor(F1X/2); F12Y = floor(F1Y/2);
%Compute Spectral Tile Centers, Peak Strengths and Phase
for
i=1:nAngles ;
for j=1:nAngles
CentY(i,j) =
(m+1)/2 + (i-cAngles)*F1Y;CentX(i,j) =
(n+1)/2 + (j-cAngles)*F1X;
Mat(i,j) =
exp(sqrt(-1)*((phi1*pi/180)*(i-cAngles) + (phi2*pi/180)*(j-cAngles)));
end
end
Mat(cAngles,cAngles)
= Mat(cAngles,cAngles) * 20;
f = fftshift(fft2(imread(‘InputCones.png’))); %Read
Photo and Perform 2D FFT
%Rearrange Tiles of 2D FFT into 4D Planes to obtain FFT of 4D
Light-Field
for
i = 1: nAngles;
for j = 1: nAngles
FFT_LF(:,:,i,j)
= f(CentY(i,j)-F12Y:CentY(i,j)+F12Y,…
CentX(i,j)-F12X:CentX(i,j)+F12X)/Mat(i,j);
end
end
LF =
ifftn(ifftnshift(FFT_LF)); %Compute
Light-Field by 4D Inverse FFT
%%%%End of Code
=======================================================================