-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhdr_vqm.m
executable file
·88 lines (73 loc) · 3.02 KB
/
hdr_vqm.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
function HDRVQM = hdr_vqm(path_src_native,path_hrc_native,path_src_emitted,path_hrc_emitted)
%set the default parameters, run the config file
config_hdrvqm
switch cfg_hdrvqm.do_adapt
case ('none')
fprintf('\nNo display processing requested...\n')
pause(1)
fprintf('\nQuality will be computed assuming that the input data is scaled according to display...\n\n')
case('linear')
fprintf('\nProcessing source and distorted videos using linear scaling...\n')
pause(1)
%fprintf('\nScaling factor is determined from the entire sequence (not individual frames).\n')
%pause(1)
fprintf('\nQuality will be computed on the processed sequences.\n\n')
otherwise
error('Invalid selection of display processing')
end
adapt_display_hdrvqm(path_src_native,path_src_emitted,cfg_hdrvqm);
adapt_display_hdrvqm(path_hrc_native,path_hrc_emitted,cfg_hdrvqm);
Images_List_HDR_src = dir([path_src_emitted '*.hdr']);
Images_List_EXR_src = dir([path_src_emitted '*.exr']);
Images_List_HDR_hrc = dir([path_hrc_emitted '*.hdr']);
Images_List_EXR_hrc = dir([path_hrc_emitted '*.exr']);
Images_List_src = [Images_List_HDR_src;Images_List_EXR_src];
Images_List_hrc = [Images_List_HDR_hrc;Images_List_EXR_hrc];
flag_number_image = numel(Images_List_src);
switch cfg_hdrvqm.data
case('image')
if(flag_number_image~=1)
error('More than one image detected. Specify video in this case')
end
case('video')
if(flag_number_image==1)
error('One image/frame detected. Specify image option in this case')
end
end
if cfg_hdrvqm.do_parallel_loop
%(optional) use a parallel loop for faster processing
matlabpool open 4
fprintf('\nComputing quality...\n')
parfor frame_count = 1:numel(Images_List_src)
error_video_hdrvqm(:,:,frame_count) = hdrvqm_perframe_error(frame_count,path_src_emitted, path_hrc_emitted);
end
switch cfg_hdrvqm.data
case('image')
HDRVQM = st_pool(st_pool(error_video_hdrvqm,0.5),0.5);
fprintf('\nHDR-VQM for image is: %f\n',HDRVQM)
clear error_video_hdrvqm
matlabpool close force local
case('video')
HDRVQM = hdrvqm_error_pooling(error_video_hdrvqm,cfg_hdrvqm);
fprintf('\nHDR-VQM for video is: %f\n',HDRVQM)
clear error_video_hdrvqm
matlabpool close force local
end
else
fprintf('\nComputing quality...\n')
for frame_count = 1:numel(Images_List_src)
error_video_hdrvqm(:,:,frame_count) = hdrvqm_perframe_error(frame_count,path_src_emitted, path_hrc_emitted);
end
switch cfg_hdrvqm.data
case('image')
HDRVQM = st_pool(st_pool(error_video_hdrvqm,0.5),0.5);
fprintf('\nHDR-VQM for image is: %f\n',HDRVQM)
clear error_video_hdrvqm
matlabpool close force local
case('video')
HDRVQM = hdrvqm_error_pooling(error_video_hdrvqm,cfg_hdrvqm);
fprintf('\nHDR-VQM for video is: %f\n',HDRVQM)
clear error_video_hdrvqm
end
end
end