Some refinements for the multi face tracking support and cmake fixes.

This commit is contained in:
Tadas Baltrusaitis 2018-02-24 09:19:13 +00:00
parent a4de1d42a5
commit 4192e85a8f
6 changed files with 58 additions and 30 deletions

2
.gitignore vendored
View file

@ -93,3 +93,5 @@ exe/releases/OpenFace_0.4.0_win_x64/
exe/releases/OpenFace_0.4.0_win_x86/ exe/releases/OpenFace_0.4.0_win_x86/
lib/3rdParty/CameraEnumerator/Release/ lib/3rdParty/CameraEnumerator/Release/
lib/local/Utilities/Release/ lib/local/Utilities/Release/
exe/FaceLandmarkVidMulti/processed/
matlab_runners/Demos/processed/multi_face_aligned/

View file

@ -91,6 +91,14 @@ int main (int argc, char **argv)
vector<string> arguments = get_arguments(argc, argv); vector<string> 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); LandmarkDetector::FaceModelParameters det_parameters(arguments);
// The modules that are being used for tracking // 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 // The sequence reader chooses what to open based on command line arguments provided
if(!sequence_reader.Open(arguments)) if (!sequence_reader.Open(arguments))
{ break;
// 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;
}
}
INFO_STREAM("Device or file opened"); INFO_STREAM("Device or file opened");
cv::Mat captured_image = sequence_reader.GetNextFrame(); cv::Mat captured_image = sequence_reader.GetNextFrame();

View file

@ -5,12 +5,16 @@ include_directories(${TBB_ROOT_DIR}/include)
include_directories(${LandmarkDetector_SOURCE_DIR}/include) include_directories(${LandmarkDetector_SOURCE_DIR}/include)
include_directories(../../lib/local/LandmarkDetector/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) add_executable(FaceLandmarkVidMulti FaceLandmarkVidMulti.cpp)
target_link_libraries(FaceLandmarkVidMulti LandmarkDetector) target_link_libraries(FaceLandmarkVidMulti LandmarkDetector)
target_link_libraries(FaceLandmarkVidMulti Utilities) target_link_libraries(FaceLandmarkVidMulti Utilities)
target_link_libraries(FaceLandmarkVidMulti dlib) 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}) target_link_libraries(FaceLandmarkVidMulti ${OpenCV_LIBS} ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${BLAS_LIBRARIES})

View file

@ -105,7 +105,7 @@
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;$(SolutionDir)\lib\local\GazeAnalyser\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
@ -117,7 +117,7 @@
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;$(SolutionDir)\lib\local\GazeAnalyser\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
@ -131,7 +131,7 @@
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;$(SolutionDir)\lib\local\GazeAnalyser\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
@ -148,7 +148,7 @@
<Optimization>Full</Optimization> <Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>false</IntrinsicFunctions> <IntrinsicFunctions>false</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)\lib\local\LandmarkDetector\include;$(SolutionDir)\lib\local\Utilities\include;$(SolutionDir)\lib\local\GazeAnalyser\include;$(SolutionDir)\lib\local\FaceAnalyser\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet> <EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
@ -165,6 +165,12 @@
<ClCompile Include="FaceLandmarkVidMulti.cpp" /> <ClCompile Include="FaceLandmarkVidMulti.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\lib\local\FaceAnalyser\FaceAnalyser.vcxproj">
<Project>{0e7fc556-0e80-45ea-a876-dde4c2fedcd7}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\local\GazeAnalyser\GazeAnalyser.vcxproj">
<Project>{5f915541-f531-434f-9c81-79f5db58012b}</Project>
</ProjectReference>
<ProjectReference Include="..\..\lib\local\LandmarkDetector\LandmarkDetector.vcxproj"> <ProjectReference Include="..\..\lib\local\LandmarkDetector\LandmarkDetector.vcxproj">
<Project>{bdc1d107-de17-4705-8e7b-cdde8bfb2bf8}</Project> <Project>{bdc1d107-de17-4705-8e7b-cdde8bfb2bf8}</Project>
</ProjectReference> </ProjectReference>

View file

@ -15,14 +15,26 @@ rels_all = [];
seq_ids = {}; seq_ids = {};
for i = 1:numel(seqNames) 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']); posesGround = load ([gtDir seqNames{i} '.dat']);
% the reliabilities of head pose % the reliabilities of head pose
rels_all = cat(1, rels_all, rels); rels_all = cat(1, rels_all, rels);
rot{i} = [rx ry rz];
% Flip because of different conventions % Flip because of different conventions
rot{i}(:,2) = -rot{i}(:,2); rot{i}(:,2) = -rot{i}(:,2);
rot{i}(:,3) = -rot{i}(:,3); rot{i}(:,3) = -rot{i}(:,3);

View file

@ -15,14 +15,26 @@ seq_ids = {};
for i=1:numel(seqNames) for i=1:numel(seqNames)
posesGround = load ([gtDir '/' seqNames{i} '/groundTruthPose.txt']); 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 % the reliabilities of head pose
rels_all = cat(1, rels_all, rels); rels_all = cat(1, rels_all, rels);
rotg{i} = posesGround(:,[5 6 7]); rotg{i} = posesGround(:,[5 6 7]);
rot{i} = [rx ry rz];
T = [tx ty tx]; T = [tx ty tx];
% Correct the first frame so it corresponds to (0,0,0), as slightly % Correct the first frame so it corresponds to (0,0,0), as slightly