-
Notifications
You must be signed in to change notification settings - Fork 0
/
mRL_metrics.m
executable file
·126 lines (93 loc) · 2.7 KB
/
mRL_metrics.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
function [S, E, psnrs, ssims, mses, brisques, niqes, piqes] = mRL_metrics(F, y, xref, options)
% Derivative free variant of Lucy-Richardson
% Keep track of metrics
options.null = 0;
maxiter = getoptions(options, 'maxiter', 500);
show_denoised = getoptions(options, 'show_denoised', 0);
S = y;
E = [];
e = img_norm(y - F(S));
E = [E; e];
if show_denoised == 1
Sd = denoise(S);
psnrs = [];
curr_psnr = psnr(Sd, xref);
psnrs = [psnrs; curr_psnr];
ssims = [];
curr_ssim = ssim(Sd, xref);
ssims = [ssims; curr_ssim];
mses = [];
curr_mse = immse(Sd, xref);
mses = [mses; curr_mse];
brisques = [];
curr_brisque = brisque(Sd);
brisques = [brisques; curr_brisque];
niqes = [];
curr_niqe = niqe(Sd);
niqes = [niqes; curr_niqe];
piqes = [];
curr_piqe = piqe(Sd);
piqes = [piqes; curr_piqe];
else
psnrs = [];
curr_psnr = psnr(S, xref);
psnrs = [psnrs; curr_psnr];
ssims = [];
curr_ssim = ssim(S, xref);
ssims = [ssims; curr_ssim];
mses = [];
curr_mse = immse(S, xref);
mses = [mses; curr_mse];
brisques = [];
curr_brisque = brisque(S);
brisques = [brisques; curr_brisque];
niqes = [];
curr_niqe = niqe(S);
niqes = [niqes; curr_niqe];
piqes = [];
curr_piqe = piqe(S);
piqes = [piqes; curr_piqe];
end
for i=1:maxiter
r1 = F(S)./(abs(y)+eps);
r1 = r1(end:-1:1,end:-1:1,:);
r2 = F(r1);
r2 = r2(end:-1:1,end:-1:1,:);
S = S./(abs(r2)+eps);
r1 = y./(abs(F(S))+eps);
r1 = r1(end:-1:1,end:-1:1,:);
r2 = F(r1);
r2 = r2(end:-1:1,end:-1:1,:);
S = S.*r2;
e = img_norm(y - F(S));
E = [E; e];
if show_denoised == 1
Sd = denoise(S);
curr_psnr = psnr(Sd, xref);
psnrs = [psnrs; curr_psnr];
curr_ssim = ssim(Sd, xref);
ssims = [ssims; curr_ssim];
curr_mse = immse(Sd, xref);
mses = [mses; curr_mse];
curr_brisque = brisque(Sd);
brisques = [brisques; curr_brisque];
curr_niqe = niqe(Sd);
niqes = [niqes; curr_niqe];
curr_piqe = piqe(Sd);
piqes = [piqes; curr_piqe];
else
curr_psnr = psnr(S, xref);
psnrs = [psnrs; curr_psnr];
curr_ssim = ssim(S, xref);
ssims = [ssims; curr_ssim];
curr_mse = immse(S, xref);
mses = [mses; curr_mse];
curr_brisque = brisque(S);
brisques = [brisques; curr_brisque];
curr_niqe = niqe(S);
niqes = [niqes; curr_niqe];
curr_piqe = piqe(S);
piqes = [piqes; curr_piqe];
end
end
end