From 312d9e960805dc33cfde8efb36e363b6a36eb7cd Mon Sep 17 00:00:00 2001 From: Tadas Baltrusaitis Date: Fri, 10 Nov 2017 20:40:59 +0000 Subject: [PATCH] Fixing scripts with new capture and recorder. --- lib/local/Utilities/include/SequenceCapture.h | 2 +- lib/local/Utilities/src/SequenceCapture.cpp | 2 +- .../run_biwi_experiment.m | 61 ++++++------------- .../Head Pose Experiments/run_bu_experiment.m | 54 +++++++--------- 4 files changed, 42 insertions(+), 77 deletions(-) diff --git a/lib/local/Utilities/include/SequenceCapture.h b/lib/local/Utilities/include/SequenceCapture.h index 1b1fcba..769b2e2 100644 --- a/lib/local/Utilities/include/SequenceCapture.h +++ b/lib/local/Utilities/include/SequenceCapture.h @@ -60,7 +60,7 @@ namespace Utilities // TODO block copy, move etc. // Opening based on command line arguments - bool Open(std::vector arguments); + bool Open(std::vector& arguments); // Direct opening diff --git a/lib/local/Utilities/src/SequenceCapture.cpp b/lib/local/Utilities/src/SequenceCapture.cpp index d6786b2..c59f809 100644 --- a/lib/local/Utilities/src/SequenceCapture.cpp +++ b/lib/local/Utilities/src/SequenceCapture.cpp @@ -54,7 +54,7 @@ std::cout << "Warning: " << stream << std::endl #define ERROR_STREAM( stream ) \ std::cout << "Error: " << stream << std::endl -bool SequenceCapture::Open(std::vector arguments) +bool SequenceCapture::Open(std::vector& arguments) { // Consuming the input arguments diff --git a/matlab_runners/Head Pose Experiments/run_biwi_experiment.m b/matlab_runners/Head Pose Experiments/run_biwi_experiment.m index 82ee689..1c03ea2 100644 --- a/matlab_runners/Head Pose Experiments/run_biwi_experiment.m +++ b/matlab_runners/Head Pose Experiments/run_biwi_experiment.m @@ -10,50 +10,27 @@ end output_dir = 'experiments/biwi_out'; dbSeqDir = dir([rootDir biwiDir]); - +dbSeqDir = dbSeqDir(3:end); + output_dir = cat(2, output_dir, '/'); -offset = 0; - -r = 1 + offset; - -numTogether = 25; - - -for i=3 + offset:numTogether:numel(dbSeqDir) - - - command = executable; - - command = cat(2, command, [' -inroot ' '"' rootDir '"']); +command = sprintf('%s -inroot "%s" -out_dir "%s" -fx 505 -fy 505 -cx 320 -cy 240 -pose -vis-track ', executable, rootDir, output_dir); - % deal with edge cases - if(numTogether + i > numel(dbSeqDir)) - numTogether = numel(dbSeqDir) - i + 1; - end +if(verbose) + command = cat(2, command, [' -tracked ' outputVideo]); +end - for n=0:numTogether-1 - - inputFile = [biwiDir dbSeqDir(i+n).name '/colour.avi']; - - command = cat(2, command, [' -f "' inputFile '" -of "' output_dir '"']); - - - end - command = cat(2, command, [' -fx 505 -fy 505 -cx 320 -cy 240 -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}, '"']); - end - - r = r+1; - if(isunix) - unix(command, '-echo') - else - dos(command); - end +if(any(strcmp('model', varargin))) + command = cat(2, command, [' -mloc "', varargin{find(strcmp('model', varargin))+1}, '"']); end + +for i=1:numel(dbSeqDir) + inputFile = [biwiDir dbSeqDir(i).name '/colour.avi']; + command = cat(2, command, sprintf(' -f "%s" ', inputFile)); +end + +if(isunix) + unix(command, '-echo') +else + dos(command); +end \ No newline at end of file diff --git a/matlab_runners/Head Pose Experiments/run_bu_experiment.m b/matlab_runners/Head Pose Experiments/run_bu_experiment.m index 24abc23..a23125c 100644 --- a/matlab_runners/Head Pose Experiments/run_bu_experiment.m +++ b/matlab_runners/Head Pose Experiments/run_bu_experiment.m @@ -10,39 +10,27 @@ function [output_dir] = run_bu_experiment(bu_dir, verbose, varargin) buFiles = dir([bu_dir '*.avi']); - numTogether = 25; - - for i=1:numTogether:numel(buFiles) + % Only outputing the pose (-pose) + command = sprintf('%s -inroot "%s" -out_dir "%s" -fx 500 -fy 500 -cx 160 -cy 120 -pose -vis-track ', executable, bu_dir, output_dir); - command = executable; - command = cat(2, command, [' -inroot ' '"' bu_dir '/"']); - - % 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]; - command = cat(2, command, [' -f "' inputFile '" -of "' output_dir '"']); - end - - % 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}, '"']); - end - - if(isunix) - unix(command, '-echo') - else - dos(command); - end + for i=1:numel(buFiles) + inputFile = [buFiles(i).name]; + command = cat(2, command, sprintf(' -f "%s" ', inputFile)); end - + + + 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}, '"']); + end + + if(isunix) + unix(command, '-echo') + else + dos(command); + end + end \ No newline at end of file