-
Notifications
You must be signed in to change notification settings - Fork 52
/
statistic_rain12.m
54 lines (37 loc) · 1.37 KB
/
statistic_rain12.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
clear all
close all
gt_path='../datasets/test/Rain12/groundtruth/';
PReNet = '../results/Rain12/PReNet/';
PReNet_r = '../results/Rain12/PReNet_r/';
PRN = '../results/Rain12/PRN6/';
PRN_r = '../results/Rain12/PRN_r/';
struct_model = {
struct('model_name','PReNet','path',PReNet),...
struct('model_name','PReNet_r','path',PReNet_r),...
struct('model_name','PRN','path',PRN),...
struct('model_name','PRN_r','path',PRN_r),...
};
nimgs=12;nrain=1;
nmodel = length(struct_model);
psnrs = zeros(nimgs,nmodel);
ssims = psnrs;
for nnn = 1:nmodel
tp=0;ts=0;te=0;
nstart = 0;
for iii=nstart+1:nstart+nimgs
for jjj=1:nrain
% fprintf('img=%d,kernel=%d\n',iii,jjj);
x_true=im2double(imread(fullfile(gt_path,sprintf('%d.png',iii))));%x_true
x_true = rgb2ycbcr(x_true);x_true=x_true(:,:,1);
%%
x = (im2double(imread(fullfile(struct_model{nnn}.path,sprintf('%d.png',iii)))));
x = rgb2ycbcr(x);x = x(:,:,1);
tp = mean(psnr(x,x_true));
ts = ssim(x*255,x_true*255);
psnrs(iii-nstart,nnn)=tp;
ssims(iii-nstart,nnn)=ts;
%
end
end
fprintf('%s: psnr=%6.4f, ssim=%6.4f\n',struct_model{nnn}.model_name,mean(psnrs(:,nnn)),mean(ssims(:,nnn)));
end