sustaining_gazes/matlab_runners/Demos/gaze_extraction_demo_vid.m

41 lines
1,020 B
Mathematica
Raw Normal View History

clear
if(isunix)
executable = '"../../build/bin/FeatureExtraction"';
else
executable = '"../../x64/Release/FeatureExtraction.exe"';
end
2016-04-28 19:40:36 +00:00
output = './processed_features/';
2016-04-28 19:40:36 +00:00
in_file = '../../samples/2015-10-15-15-14.avi';
2016-04-28 19:40:36 +00:00
command = sprintf('%s -f "%s" -out_dir "%s" -gaze -verbose', executable, in_file, output);
2016-04-28 19:40:36 +00:00
if(isunix)
unix(command);
else
dos(command);
end
2016-04-28 19:40:36 +00:00
%% Demonstrating reading the output files
[~, out_filename,~] = fileparts(in_file);
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 19:40:36 +00:00
all_params = dlmread(out_filename, ',', 1, 0);
2016-04-28 19:40:36 +00:00
gaze_angle_ids = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'gaze_angle_'));
2016-04-28 19:40:36 +00:00
gaze = all_params(:,gaze_angle_ids);
2016-04-28 19:40:36 +00: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 19:40:36 +00:00
legend('show');
hold off;