-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcolor_image.m
54 lines (40 loc) · 1.86 KB
/
color_image.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
clear;
clc;
benchmark_root = '../data/test_data/mat';
result_root = '../result/';
benchmark = 'Urban100';
scale = [2 3 4];
for s = 1:numel(scale)
visualization_path = fullfile(benchmark, int2str(scale(s)));
if ~exist(fullfile(benchmark, int2str(scale(s))), 'dir')
mkdir(visualization_path);
end
gt_list = dir(fullfile(benchmark_root, benchmark, ['*_', int2str(scale(s)), '_gt.mat']));
lr_list = dir(fullfile(benchmark_root, benchmark, ['*_', int2str(scale(s)), '_lr.mat']));
sr_list = dir(fullfile(result_root, benchmark, int2str(scale(s)), '*.mat'));
cb_list = dir(fullfile(benchmark_root, benchmark, ['*_', int2str(scale(s)), '_cb.mat']));
cr_list = dir(fullfile(benchmark_root, benchmark, ['*_', int2str(scale(s)), '_cr.mat']));
for i = 1:numel(gt_list)
gt_path = gt_list(i).name;
lr_path = lr_list(i).name;
sr_path = sr_list(i).name;
cb_path = cb_list(i).name;
cr_path = cr_list(i).name;
load(fullfile(benchmark_root, benchmark, gt_path));
load(fullfile(benchmark_root, benchmark, lr_path));
load(fullfile(result_root, benchmark, int2str(scale(s)), sr_path));
load(fullfile(benchmark_root, benchmark, cb_path));
load(fullfile(benchmark_root, benchmark, cr_path));
% gt_ = uint8(gt * 255);
% gt_color = ycbcr2rgb(cat(3, gt_, cb, cr));
% lr_ = uint8(lr * 255);
% lr_color = ycbcr2rgb(cat(3, lr_, cb, cr));
sr_ = uint8(sr * 255);
sr_color = ycbcr2rgb(cat(3, sr_, cb, cr));
image_name = split(sr_list(i).name, '.');
image_name = image_name{1};
% imwrite(gt_color, fullfile(visualization_path, [image_name, '_gt.png']));
% imwrite(lr_color, fullfile(visualization_path, [image_name, '_lr.png']));
imwrite(sr_color, fullfile(visualization_path, [image_name, '_sr.png']));
end
end