diff --git a/.gitignore b/.gitignore index fc095e9..47e3d15 100644 --- a/.gitignore +++ b/.gitignore @@ -93,3 +93,5 @@ exe/releases/OpenFace_0.4.0_win_x64/ exe/releases/OpenFace_0.4.0_win_x86/ lib/3rdParty/CameraEnumerator/Release/ lib/local/Utilities/Release/ +exe/FaceLandmarkVidMulti/processed/ +matlab_runners/Demos/processed/multi_face_aligned/ diff --git a/exe/FaceLandmarkVid/FaceLandmarkVid.cpp b/exe/FaceLandmarkVid/FaceLandmarkVid.cpp index f317ca9..6f6fc09 100644 --- a/exe/FaceLandmarkVid/FaceLandmarkVid.cpp +++ b/exe/FaceLandmarkVid/FaceLandmarkVid.cpp @@ -91,6 +91,14 @@ int main (int argc, char **argv) vector arguments = get_arguments(argc, argv); + // no arguments: output usage + if (arguments.size() == 1) + { + cout << "For command line arguments see:" << endl; + cout << " https://github.com/TadasBaltrusaitis/OpenFace/wiki/Command-line-arguments"; + return 0; + } + LandmarkDetector::FaceModelParameters det_parameters(arguments); // The modules that are being used for tracking @@ -112,25 +120,9 @@ int main (int argc, char **argv) { // The sequence reader chooses what to open based on command line arguments provided - if(!sequence_reader.Open(arguments)) - { - // If failed to open because no input files specified, attempt to open a webcam - if (sequence_reader.no_input_specified && sequence_number == 0) - { - // If that fails, revert to webcam - INFO_STREAM("No input specified, attempting to open a webcam 0 at 640 x 480px"); - if (!sequence_reader.OpenWebcam(0, 640, 480)) - { - ERROR_STREAM("Failed to open the webcam"); - break; - } - } - else - { - // Either reached the end of sequences provided or failed to open them - break; - } - } + if (!sequence_reader.Open(arguments)) + break; + INFO_STREAM("Device or file opened"); cv::Mat captured_image = sequence_reader.GetNextFrame(); diff --git a/exe/FaceLandmarkVidMulti/CMakeLists.txt b/exe/FaceLandmarkVidMulti/CMakeLists.txt index 87b51c4..30ea617 100644 --- a/exe/FaceLandmarkVidMulti/CMakeLists.txt +++ b/exe/FaceLandmarkVidMulti/CMakeLists.txt @@ -5,12 +5,16 @@ include_directories(${TBB_ROOT_DIR}/include) include_directories(${LandmarkDetector_SOURCE_DIR}/include) include_directories(../../lib/local/LandmarkDetector/include) -include_directories(../../lib/local/Utilities/include) +include_directories(../../lib/local/FaceAnalyser/include) +include_directories(../../lib/local/GazeAnalyser/include) +include_directories(../../lib/local/Utilities/include) add_executable(FaceLandmarkVidMulti FaceLandmarkVidMulti.cpp) target_link_libraries(FaceLandmarkVidMulti LandmarkDetector) target_link_libraries(FaceLandmarkVidMulti Utilities) target_link_libraries(FaceLandmarkVidMulti dlib) +target_link_libraries(FaceLandmarkVidMulti FaceAnalyser) +target_link_libraries(FaceLandmarkVidMulti GazeAnalyser) target_link_libraries(FaceLandmarkVidMulti ${OpenCV_LIBS} ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${BLAS_LIBRARIES}) diff --git a/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj b/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj index 0eec021..f9679bb 100644 --- a/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj +++ b/exe/FaceLandmarkVidMulti/FaceLandmarkVidMulti.vcxproj @@ -105,7 +105,7 @@ Level3 Disabled - $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories) + $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;$(SolutionDir)\lib\local\GazeAnalyser\include;%(AdditionalIncludeDirectories) StreamingSIMDExtensions2 true @@ -117,7 +117,7 @@ Level3 Disabled - $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories) + $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;$(SolutionDir)\lib\local\GazeAnalyser\include;%(AdditionalIncludeDirectories) AdvancedVectorExtensions true @@ -131,7 +131,7 @@ MaxSpeed true true - $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories) + $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;$(SolutionDir)\lib\local\GazeAnalyser\include;%(AdditionalIncludeDirectories) StreamingSIMDExtensions2 MultiThreadedDLL true @@ -148,7 +148,7 @@ Full true false - $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories) + $(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\FaceAnalyser\include;%(AdditionalIncludeDirectories) AdvancedVectorExtensions MultiThreadedDLL true @@ -165,6 +165,12 @@ + + {0e7fc556-0e80-45ea-a876-dde4c2fedcd7} + + + {5f915541-f531-434f-9c81-79f5db58012b} + {bdc1d107-de17-4705-8e7b-cdde8bfb2bf8} diff --git a/matlab_runners/Head Pose Experiments/calcBUerror.m b/matlab_runners/Head Pose Experiments/calcBUerror.m index b05b203..28f86d4 100644 --- a/matlab_runners/Head Pose Experiments/calcBUerror.m +++ b/matlab_runners/Head Pose Experiments/calcBUerror.m @@ -15,14 +15,26 @@ rels_all = []; seq_ids = {}; for i = 1:numel(seqNames) + fname = [resDir seqNames{i} '.csv']; + if(i == 1) + % First read in the column names + tab = readtable(fname); + column_names = tab.Properties.VariableNames; + + confidence_id = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'confidence')); + rot_ids = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'pose_R')); + end + + all_params = dlmread(fname, ',', 1, 0); + + rot{i} = all_params(:, rot_ids); + rels = all_params(:, confidence_id); - [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 rels_all = cat(1, rels_all, rels); - rot{i} = [rx ry rz]; % Flip because of different conventions rot{i}(:,2) = -rot{i}(:,2); rot{i}(:,3) = -rot{i}(:,3); diff --git a/matlab_runners/Head Pose Experiments/calcBiwiError.m b/matlab_runners/Head Pose Experiments/calcBiwiError.m index e9b9e91..c998a8f 100644 --- a/matlab_runners/Head Pose Experiments/calcBiwiError.m +++ b/matlab_runners/Head Pose Experiments/calcBiwiError.m @@ -15,14 +15,26 @@ seq_ids = {}; for i=1:numel(seqNames) posesGround = load ([gtDir '/' seqNames{i} '/groundTruthPose.txt']); - - [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); - + + fname = [resDir seqNames{i} '.csv']; + if(i == 1) + % First read in the column names + tab = readtable(fname); + column_names = tab.Properties.VariableNames; + + confidence_id = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'confidence')); + rot_ids = cellfun(@(x) ~isempty(x) && x==1, strfind(column_names, 'pose_R')); + end + + all_params = dlmread(fname, ',', 1, 0); + + rot{i} = all_params(:, rot_ids); + rels = all_params(:, confidence_id); + % the reliabilities of head pose rels_all = cat(1, rels_all, rels); rotg{i} = posesGround(:,[5 6 7]); - rot{i} = [rx ry rz]; T = [tx ty tx]; % Correct the first frame so it corresponds to (0,0,0), as slightly