clear all; close all;
addpath('../lib');

source = 'hw8prob5data';
a = imbytefile(source,512); close all;

subplot(121);
imagesc(a);
colormap gray;
axis equal;
xlim([1 512]); ylim([1 512]);
title('Original');

A = fft2(a);

p  = 0.0012; % Pixel pitch (rad)
Fm = 1/2*1/p; % Max frequency represented (inverse rad)
[X Y] = meshgrid(linspace(-Fm,Fm,512));
R = sqrt(X.^2+Y.^2);
C = fftshift(chat(R/312.5));

B = C.*A;
b = abs(ifft2(B));

subplot(122);
imagesc(b);
colormap gray;
axis equal;
xlim([1 512]); ylim([1 512]);
title('Circular aperture, D = 250 m');