-
Notifications
You must be signed in to change notification settings - Fork 5
/
peek_NRpars.m
73 lines (64 loc) · 3.49 KB
/
peek_NRpars.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
function peek_NRpars( nr_dataset, base_dir, feature_function, parnum, min_value, max_value)
% Visualize media detected by a particular range of NR parameter values.
% SYNTAX
% peek_NRpars( nr_dataset, base_dir, feature_function, parnum, min_value, max_value)
% SEMANTICS
% Intended for debugging NR parameters that provide root cause analysis.
% Images or videos with a specific impairment should produce high or low
% values. This function lets the user specify the range of parameter
% values where the impairment should be detected. The media in that range
% are displayed, first as thumbnails in a 3x4 matrix, then as full
% resolution images. For videos, the first frame is displayed. Additional
% information is printed to the command line.
%
% Input Parameters:
% nr_dataset Data structure. Each describes an entire dataset (name, file location, ...)
% base_dir Path to directory where NR features and NR parameters are stored.
% feature_function Pointer to a no-reference feature functions (NRFF) that must
% adhere to the interface specified in calculate_NRpars.
% parnum Parameter number, within @feature_function.
% min_value Minimum parameter value to select.
% max_value Maximum parameter value to select.
% load the parameters. This will calculate them, if not yet computed.
for dcnt = 1:length(nr_dataset)
fprintf('-------------------------------------------------------\n');
fprintf('Dataset %s\n\n', nr_dataset(dcnt).dataset_name);
fprintf('Loading NR parameters. This will be very slow, if not yet calculated\n');
NRpars = calculate_NRpars(nr_dataset(dcnt), base_dir, 'none', feature_function);
% find media that fit these criteria (range of values)
want=find(NRpars.data(parnum,:) <= max_value & NRpars.data(parnum,:) >= min_value);
% sort media by MOS
ismos = [nr_dataset(dcnt).media(want).mos];
[~,order] = sort(ismos);
want = want(order);
for cnt=1:length(want)
% start new figure every 12 media
if mod(cnt,12) == 1
figure(ceil(cnt/12));
end
% subplot for a thumbnail
curr = mod(cnt,12);
if curr == 0
curr = 12;
end
subplot(3,4,curr);
frame = nr_dataset(dcnt).media(want(cnt)).start; % show first available frame
[y, cb, cr] = read_media('frames', nr_dataset(dcnt), want(cnt), frame, frame);
display_color_xyt(y,cb,cr,'subplot');
% print to command line full information
fprintf('%4d) mos %4.2f par %5.2f %s\n', ...
want(cnt), nr_dataset(dcnt).media(want(cnt)).mos, NRpars.data(parnum,want(cnt)), ...
nr_dataset(dcnt).media(want(cnt)).name);
% print to thumbnail title partial information
title(sprintf('%4d) mos %4.2f par %5.2f', ...
want(cnt), nr_dataset(dcnt).media(want(cnt)).mos, NRpars.data(parnum,want(cnt))), ...
'interpreter','none');
end
% loop through a 2nd time and open full size images
for cnt=1:length(want)
frame = nr_dataset(dcnt).media(want(cnt)).start; % show first available frame
[y, cb, cr] = read_media('frames', nr_dataset(dcnt), want(cnt), frame, frame);
display_color_xyt(y,cb,cr);
end
end
end