-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_ip.m
More file actions
124 lines (100 loc) · 2.93 KB
/
Copy pathtest_ip.m
File metadata and controls
124 lines (100 loc) · 2.93 KB
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
% Script to test the image interpolation method Performance
% Zongliang gan
clear all
close all
clc
k = 2;
p = pwd;
addpath(fullfile(p, '/common'));
addpath(fullfile(p, '/test'));
addpath(fullfile(p, '/func'));
% set the image data
imset = 'set5';
%imset = 'set14';
%imset = 'imax';
%imset = 'urban';
%imset = 'set115';
%imset = 'test';
% mode
chmode = 0; % gray
%chmode = 1; % colour
switch imset
case 'imax'
addpath(fullfile(p, '/imax'));
Dir = 'imax';
Suffix = '*.bmp';
case 'set5'
addpath(fullfile(p, '/Set5'));
Dir = 'Set5';
Suffix = '*.bmp';
case 'set14'
addpath(fullfile(p, '/Set14'));
Dir = 'Set14';
Suffix = '*.bmp';
case 'urban'
addpath(fullfile(p, '/urban'));
Dir = 'urban';
Suffix = '*.png';
case 'set115'
addpath(fullfile(p, '/set115'));
Dir = 'set115';
Suffix = '*.tif';
case 'test'
addpath(fullfile(p, '/lset'));
Dir = 'test';
Suffix = '*.jpg';
% here can add other image data
end
addpath(fullfile(p, '/Result'));
[fn,fname] = glob(Dir, Suffix);
for i = 1:numel(fn)
x = imread(fn{i});
disp(['+++++++++++' fn{i} ' +++++++++'])
[m,n,d]=size(x);
if chmode == 0
if d==3
x = rgb2gray(x);
end
end
x = cropim(x,k);
Lr = downs(x,k);
flr =['./Lrimage/l' fname(i).name];
flr(end-3:end)='.bmp';
imwrite(Lr,flr);
% bicubic interpolation
cubic = upcubic(Lr,k);
cubicpnsr(i) = GetPsnr(x,cubic);
disp(['The cubic result is ' num2str(cubicpnsr(i)) ' .'])
cubicssim(i) = GetSsim( x, cubic);
disp(['The cubic SSIM result is ' num2str(cubicssim(i)) ' .'])
% offline mode
tic
Hrof = impccdf(Lr,0);
toc
fno= ['./Result/offline' fname(i).name];
fno(end-3:end)='.bmp';
imwrite(uint8(Hrof),fno);
offpsnr(i) = GetPsnr(x,uint8(Hrof));
disp(['The offline PSNR result is ' num2str(offpsnr(i)) ' .'])
offssim(i) = GetSsim( x, Hrof);
disp(['The offline SSIM result is ' num2str(offssim(i)) ' .'])
% online mode
tic
%Hron = cacdfiminp(Lr,1);
Hron = impccdf(Lr,1);
toc
fno= ['./Result/online' fname(i).name];
fno(end-3:end)='.bmp';
imwrite(uint8(Hron),fno);
onpsnr(i) = GetPsnr(x,uint8(Hron));
disp(['The Online PSNR result is ' num2str(onpsnr(i)) ' .'])
onlinessim(i) = GetSsim( x, uint8(Hron) );
disp(['The offssim SSIM result is ' num2str(onlinessim(i)) ' .'])
end
disp(['++++++++++++++++++++++++++++++++++++ ' ])
disp(['The bicubic totoal PSNR ' num2str(mean(cubicpnsr))])
disp(['The offline totoal PSNR ' num2str(mean(offpsnr))])
disp(['The online totoal PSNR ' num2str(mean(onpsnr))])
disp(['The bicubic totoal ssim ' num2str(mean(cubicssim))])
disp(['The offline totoal ssim ' num2str(mean( offssim))])%
disp(['The online totoal ssim ' num2str(mean( onlinessim))])