summaryrefslogtreecommitdiff
path: root/show_diffraction.m
blob: 3421b0ffb3dafda9107090fdc41e5bdb19fa62e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function show_diffraction(img_source, xpos_s, ypos_s, img_target, xpos_t, ypos_t)

[Ny_s,Nx_s] = size(img_source);
[Ny_t,Nx_t] = size(img_target);

% plot mask image
figure(1);
x_s=linspace(xpos_s(1), xpos_s(end), Nx_s);
y_s=linspace(ypos_s(1), ypos_s(end), Ny_s);
imagesc(x_s,y_s, abs(img_source).^2); 
colorbar; colormap('gray');
xlabel('x (m)');
ylabel('y (m)');
title('mask image');

% plot diffraction image
figure(2);
x_t=linspace(xpos_t(1), xpos_t(end), Nx_t);
y_t=linspace(ypos_t(1), ypos_t(end), Ny_t);
% I use gamma correction due to luck of the display dynamic range
% pixel brightness correction, display dependent
%gamma=1/4;
gamma=1;
imagesc(x_t, y_t, (abs(img_target).^2).^(gamma));  
colorbar; colormap('gray');
xlabel('x (m)');
ylabel('y (m)');
title('target image');