diff --git a/lib/local/Recorder/src/RecorderOpenFaceParameters.cpp b/lib/local/Recorder/src/RecorderOpenFaceParameters.cpp new file mode 100644 index 0000000..b5ea78f --- /dev/null +++ b/lib/local/Recorder/src/RecorderOpenFaceParameters.cpp @@ -0,0 +1,140 @@ +/////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2017, Tadas Baltrusaitis, all rights reserved. +// +// ACADEMIC OR NON-PROFIT ORGANIZATION NONCOMMERCIAL RESEARCH USE ONLY +// +// BY USING OR DOWNLOADING THE SOFTWARE, YOU ARE AGREEING TO THE TERMS OF THIS LICENSE AGREEMENT. +// IF YOU DO NOT AGREE WITH THESE TERMS, YOU MAY NOT USE OR DOWNLOAD THE SOFTWARE. +// +// License can be found in OpenFace-license.txt +// +// * Any publications arising from the use of this software, including but +// not limited to academic journal and conference publications, technical +// reports and manuals, must cite at least one of the following works: +// +// OpenFace: an open source facial behavior analysis toolkit +// Tadas Baltrušaitis, Peter Robinson, and Louis-Philippe Morency +// in IEEE Winter Conference on Applications of Computer Vision, 2016 +// +// Rendering of Eyes for Eye-Shape Registration and Gaze Estimation +// Erroll Wood, Tadas Baltrušaitis, Xucong Zhang, Yusuke Sugano, Peter Robinson, and Andreas Bulling +// in IEEE International. Conference on Computer Vision (ICCV), 2015 +// +// Cross-dataset learning and person-speci?c normalisation for automatic Action Unit detection +// Tadas Baltrušaitis, Marwa Mahmoud, and Peter Robinson +// in Facial Expression Recognition and Analysis Challenge, +// IEEE International Conference on Automatic Face and Gesture Recognition, 2015 +// +// Constrained Local Neural Fields for robust facial landmark detection in the wild. +// Tadas Baltrušaitis, Peter Robinson, and Louis-Philippe Morency. +// in IEEE Int. Conference on Computer Vision Workshops, 300 Faces in-the-Wild Challenge, 2013. +// +/////////////////////////////////////////////////////////////////////////////// + +#include "RecorderOpenFaceParameters.h" + +using namespace std; + +using namespace Recorder; + +RecorderOpenFaceParameters::RecorderOpenFaceParameters(std::vector &arguments, double fps_vid_out, std::string output_codec) +{ + + string separator = string(1, boost::filesystem::path::preferred_separator); + + this->fps_vid_out = fps_vid_out; + this->output_codec = output_codec; + + // First check if there is a root argument (so that videos and outputs could be defined more easilly) + for (size_t i = 0; i < arguments.size(); ++i) + { + if (arguments[i].compare("-root") == 0) + { + output_root = arguments[i + 1] + separator; + i++; + } + if (arguments[i].compare("-outroot") == 0) + { + output_root = arguments[i + 1] + separator; + i++; + } + } + + bool output_set = false; + + output_2D_landmarks = false; + output_3D_landmarks = false; + output_model_params = false; + output_pose = false; + output_AUs = false; + output_gaze = false; + output_hog = false; + output_tracked_video = false; + output_aligned_faces = false; + + for (size_t i = 0; i < arguments.size(); ++i) + { + if (arguments[i].compare("-simalign") == 0) + { + output_aligned_faces = true; + output_set = true; + } + else if (arguments[i].compare("-hogalign") == 0) + { + output_hog = true; + output_set = true; + } + else if (arguments[i].compare("-2Dfp") == 0) + { + output_2D_landmarks = true; + output_set = true; + } + else if (arguments[i].compare("-3Dfp") == 0) + { + output_3D_landmarks = true; + output_set = true; + } + else if (arguments[i].compare("-pdmparams") == 0) + { + output_model_params = true; + output_set = true; + } + else if (arguments[i].compare("-pose") == 0) + { + output_pose = true; + output_set = true; + } + else if (arguments[i].compare("-aus") == 0) + { + output_AUs = true; + output_set = true; + } + else if (arguments[i].compare("-gaze") == 0) + { + output_gaze = true; + output_set = true; + } + else if (arguments[i].compare("-tracked") == 0) + { + output_tracked_video = true; + output_set = true; + } + } + + // Output everything if nothing has been set + + if (!output_set) + { + output_2D_landmarks = true; + output_3D_landmarks = true; + output_model_params = true; + output_pose = true; + output_AUs = true; + output_gaze = true; + output_hog = true; + output_tracked_video = true; + output_aligned_faces = true; + } + +} + diff --git a/matlab_runners/Head Pose Experiments/calcBUerror.m b/matlab_runners/Head Pose Experiments/calcBUerror.m index be3e0ed..b05b203 100644 --- a/matlab_runners/Head Pose Experiments/calcBUerror.m +++ b/matlab_runners/Head Pose Experiments/calcBUerror.m @@ -16,7 +16,7 @@ seq_ids = {}; for i = 1:numel(seqNames) - [frame t, rels, sc tx ty tz rx ry rz] = textread([resDir seqNames{i} '.txt'], '%f, %f, %f, %f, %f, %f, %f, %f, %f, %f', 'headerlines', 1); + [frame t, rels, sc tx ty tz rx ry rz] = textread([resDir seqNames{i} '.csv'], '%f, %f, %f, %f, %f, %f, %f, %f, %f, %f', 'headerlines', 1); posesGround = load ([gtDir seqNames{i} '.dat']); % the reliabilities of head pose diff --git a/matlab_runners/Head Pose Experiments/run_biwi_experiment.m b/matlab_runners/Head Pose Experiments/run_biwi_experiment.m index 8a564cf..e860346 100644 --- a/matlab_runners/Head Pose Experiments/run_biwi_experiment.m +++ b/matlab_runners/Head Pose Experiments/run_biwi_experiment.m @@ -44,7 +44,7 @@ for i=3 + offset:numTogether:numel(dbSeqDir) command = cat(2, command, [' -ov "' outputVideo '"']); end end - command = cat(2, command, [' -fx 505 -fy 505 -cx 320 -cy 240 -no2Dfp -no3Dfp -noMparams -noAUs -noGaze -vis-track ']); + command = cat(2, command, [' -fx 505 -fy 505 -cx 320 -cy 240 -pose -vis-track ']); if(any(strcmp('model', varargin))) command = cat(2, command, [' -mloc "', varargin{find(strcmp('model', varargin))+1}, '"']); diff --git a/matlab_runners/Head Pose Experiments/run_bu_experiment.m b/matlab_runners/Head Pose Experiments/run_bu_experiment.m index 2aa4bfa..24abc23 100644 --- a/matlab_runners/Head Pose Experiments/run_bu_experiment.m +++ b/matlab_runners/Head Pose Experiments/run_bu_experiment.m @@ -17,31 +17,22 @@ function [output_dir] = run_bu_experiment(bu_dir, verbose, varargin) command = executable; command = cat(2, command, [' -inroot ' '"' bu_dir '/"']); - % BU dataset orientation is in terms of camera plane, instruct the - % tracker to output it in that format - command = cat(2, command, [' -cp ']); - % deal with edge cases if(numTogether + i > numel(buFiles)) numTogether = numel(buFiles) - i + 1; end for n=0:numTogether-1 - inputFile = [buFiles(n+i).name]; - [~, name, ~] = fileparts(inputFile); - - % where to output results - outputFile = [output_dir name '.txt']; - - command = cat(2, command, [' -f "' inputFile '" -of "' outputFile '"']); - - if(verbose) - outputVideo = ['"' output_dir name '.avi' '"']; - command = cat(2, command, [' -ov ' outputVideo]); - end + inputFile = [buFiles(n+i).name]; + command = cat(2, command, [' -f "' inputFile '" -of "' output_dir '"']); end - command = cat(2, command, ' -fx 500 -fy 500 -cx 160 -cy 120 -no2Dfp -no3Dfp -noMparams -noAUs -noGaze -vis-track '); + % Only outputing the pose (-pose) + command = cat(2, command, ' -fx 500 -fy 500 -cx 160 -cy 120 -pose -vis-track '); + + if(verbose) + command = cat(2, command, [' -tracked ' outputVideo]); + end if(any(strcmp('model', varargin))) command = cat(2, command, [' -mloc "', varargin{find(strcmp('model', varargin))+1}, '"']); diff --git a/matlab_runners/Head Pose Experiments/run_ict_experiment.m b/matlab_runners/Head Pose Experiments/run_ict_experiment.m index 75e2352..4ff957e 100644 --- a/matlab_runners/Head Pose Experiments/run_ict_experiment.m +++ b/matlab_runners/Head Pose Experiments/run_ict_experiment.m @@ -18,7 +18,7 @@ numTogether = 10; for i=3:numTogether:numel(dbSeqDir) - command = [executable ' -fx 535 -fy 536 -cx 327 -cy 241 -no2Dfp -no3Dfp -noMparams -noAUs -noGaze -vis-track ']; + command = [executable ' -fx 535 -fy 536 -cx 327 -cy 241 -pose -vis-track ']; command = cat(2, command, [' -inroot ' '"' rootDir '/"']);