params = harmonicP; % Creates a struct of harmonic parameters
params.freq = 8; % Cycles per image
params.row = 33; params.col = 33; % Image size
scene = sceneCreate('harmonic',params);
scene = sceneSet(scene,'fov',1); % Making it 1 deg is simple
% Spatial frequency support.
fx = sceneGet(scene,'f support x'); fullFx = [-1*fliplr(fx), fx];
fy = sceneGet(scene,'f support y'); fullFy = [-1*fliplr(fy), fy];
x = sceneGet(scene,'spatial support x','deg');
y = sceneGet(scene,'spatial support y','deg');
img = sceneGet(scene,'luminance');
% The 2D Fourier transform
imagesc(x,y,img); axis image
xlabel('Position (deg)'); ylabel('Position (deg)');
imagesc(fullFx,fullFy,abs(fftshift(imgF)));
axis equal; axis image; colormap(gray);
set(gca, 'Color', 'k'); % Set background color to black
grid on; % Turn on the grid
ax = gca; % Get current axes
ax.GridColor = [0.7 0.7 0.7]; % Set grid color to dark gray
ax.GridLineStyle = '-'; % Set grid line style
ax.LineWidth = 3; % Set grid line thickness
xlabel('Frequency (cyc/deg)');
ylabel('Frequency (cyc/deg)');
[scene,parms] = sceneCreate('harmonic',params);
scene = sceneSet(scene,'fov',1);
img = sceneGet(scene,'luminance');
imagesc(x,y,img); axis image;
xlabel('Position (deg)'); ylabel('Position (deg)');
imagesc(fullFx,fullFy,abs(fftshift(imgF)));
axis equal; axis image; colormap(gray);
set(gca, 'Color', 'k'); % Set background color to black
grid on; % Turn on the grid
ax = gca; % Get current axes
ax.GridColor = [0.7 0.7 0.7]; % Set grid color to dark gray
ax.GridLineStyle = '-'; % Set grid line style
ax.LineWidth = 3; % Set grid line thickness
xlabel('Frequency (cyc/deg)');
ylabel('Frequency (cyc/deg)');
% Write out the figure as a PNG.
theDir = fullfile(fiseRootPath,'chapters','images','optics','11-transform');
exportgraphics(gcf,fullfile(theDir,'otf2d.png'));