sustaining_gazes/matlab_runners/Demos/gaze_extraction_demo_vid.m

41 lines
1020 B
Mathematica
Raw Normal View History

clear
if(isunix)
executable = '"../../build/bin/FeatureExtraction"';
else
executable = '"../../x64/Release/FeatureExtraction.exe"';
end
2016-04-28 21:40:36 +02:00
output = './processed_features/';
2016-04-28 21:40:36 +02:00
in_file = '../../samples/2015-10-15-15-14.avi';
2016-04-28 21:40:36 +02:00
command = sprintf('%s -f "%s" -out_dir "%s" -gaze -verbose', executable, in_file, output);
2016-04-28 21:40:36 +02:00
if(isunix)
unix(command);
else
dos(command);
end
2016-04-28 21:40:36 +02:00
%% Demonstrating reading the output files
[~, out_filename,~] = fileparts(in_file);
2018-02-04 22:27:12 +01:00
out_filename = sprintf('%s/%s.csv', output, out_filename);
% First read in the column names
tab = readtable(out_filename);
column_names = tab.Properties.VariableNames;
2016-04-28 21:40:36 +02:00
all_params = dlmread(out_filename, ',', 1, 0);
2016-04-28 21:40:36 +02:00
gaze_angle_ids = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'gaze_angle_'));
2016-04-28 21:40:36 +02:00
gaze = all_params(:,gaze_angle_ids);
2016-04-28 21:40:36 +02:00
plot(gaze(:,1), 'DisplayName', 'Left - right');
hold on;
plot(gaze(:,2), 'DisplayName', 'Up - down');
xlabel('Frame') % x-axis label
ylabel('Angle in radians') % y-axis label
2016-04-28 21:40:36 +02:00
legend('show');
hold off;