-
Notifications
You must be signed in to change notification settings - Fork 13
/
FZA_single_shot_experiment.m
82 lines (59 loc) · 1.73 KB
/
FZA_single_shot_experiment.m
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
clearvars; clc; close all
addpath('./functions');
Im = im2double(imread('./images/raw_THU.png'));
% Im = im2double(imread('./images/raw_cameraman.png'));
Xc = 1760; % Xc = 1760;
Yc = 1700; % Yc = 1700;
di = 3;
z1 = 300;
dp = 0.00375; % pixel pitch
Nx = 2400;
Ny = 2400;
I = Im(Yc-Ny/2:Yc+Ny/2-1,Xc-Nx/2:Xc+Nx/2-1); % Image cropping
figure(1),imagesc(I(831:1630,781:1580));title('Sensor measurements')
colormap gray;
axis equal off tight
%% Imaging processing
b = 30;
bi = 29.75;
fu_max = 0.5 / dp;
fv_max = 0.5 / dp;
du = 2*fu_max / Nx;
dv = 2*fv_max / Ny;
[u,v] = meshgrid(-fu_max:du:fu_max-du,-fv_max:dv:fv_max-dv);
H = 1i*exp(-1i*(pi^2/bi)*(u.^2 + v.^2)); % fresnel transfer function
%% back propagation
Or = MyAdjointOperatorPropagation(I,H);
figure(2),imagesc(real(Or(831:1630,781:1580)));title('Reconstructed image (BP)')
colormap gray;
axis equal off tight
drawnow
%% Propagation operator (4)
A = @(obj) MyForwardOperatorPropagation(obj,H); % forward propagation operator
AT = @(I) MyAdjointOperatorPropagation(I,H); % backward propagation operator
%% TwIST algorithm (5)
% denoising function;
tv_iters = 5;
Psi = @(x,th) tvdenoise(x,2/th,tv_iters);
% TV regularizer;
Phi = @(x) TVnorm(x);
tau = 0.003;
tolA = 1e-6;
iterations = 50;
[f_reconstruct,dummy,obj_twist,...
times_twist,dummy,mse_twist]= ...
TwIST(I,A,tau,...
'AT', AT, ...
'Psi',Psi,...
'Phi',Phi,...
'Initialization',2,...
'Monotone',1,...
'StopCriterion',1,...
'MaxIterA',iterations,...
'MinIterA',iterations,...
'ToleranceA',tolA,...
'Verbose', 1);
f_reconstruct = mat2gray(real(f_reconstruct));
figure(3),imagesc(f_reconstruct(831:1630,781:1580));title('Reconstructed image (CS)')
colormap gray;
axis image off