Working on the GUI, enabling and disabling of the menus
This commit is contained in:
parent
e0f71fb67c
commit
25cb1c7ecb
3 changed files with 56 additions and 93 deletions
11
OpenFace.sln
11
OpenFace.sln
|
@ -33,8 +33,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CamCom", "lib\local\CamCom\
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFaceOffline", "gui\OpenFaceOffline\OpenFaceOffline.csproj", "{A4760F41-2B1F-4144-B7B2-62785AFFE79B}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFaceOffline", "gui\OpenFaceOffline\OpenFaceOffline.csproj", "{A4760F41-2B1F-4144-B7B2-62785AFFE79B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenFaceDemo", "gui\OpenFaceDemo\OpenFaceDemo.csproj", "{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Win32 = Debug|Win32
|
Debug|Win32 = Debug|Win32
|
||||||
|
@ -131,14 +129,6 @@ Global
|
||||||
{A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Release|Win32.Build.0 = Release|x86
|
{A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Release|Win32.Build.0 = Release|x86
|
||||||
{A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Release|x64.ActiveCfg = Release|Any CPU
|
{A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
{A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Release|x64.Build.0 = Release|Any CPU
|
{A4760F41-2B1F-4144-B7B2-62785AFFE79B}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Debug|Win32.ActiveCfg = Debug|x86
|
|
||||||
{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Debug|Win32.Build.0 = Debug|x86
|
|
||||||
{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Release|Win32.ActiveCfg = Release|x86
|
|
||||||
{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Release|Win32.Build.0 = Release|x86
|
|
||||||
{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -155,6 +145,5 @@ Global
|
||||||
{78196985-EE54-411F-822B-5A23EDF80642} = {D5F7B3E2-01FE-4F4A-8CE1-274D74D395D4}
|
{78196985-EE54-411F-822B-5A23EDF80642} = {D5F7B3E2-01FE-4F4A-8CE1-274D74D395D4}
|
||||||
{0CEC6A75-17BA-4DC5-9405-C74154921E60} = {D5F7B3E2-01FE-4F4A-8CE1-274D74D395D4}
|
{0CEC6A75-17BA-4DC5-9405-C74154921E60} = {D5F7B3E2-01FE-4F4A-8CE1-274D74D395D4}
|
||||||
{A4760F41-2B1F-4144-B7B2-62785AFFE79B} = {C9D8D0B0-11EC-41CB-8524-2DDB5BE94297}
|
{A4760F41-2B1F-4144-B7B2-62785AFFE79B} = {C9D8D0B0-11EC-41CB-8524-2DDB5BE94297}
|
||||||
{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90} = {C9D8D0B0-11EC-41CB-8524-2DDB5BE94297}
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -166,7 +166,6 @@
|
||||||
<StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Grid.Row="2" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<Button VerticalAlignment="Top" IsEnabled="False" Click="PauseButton_Click" Name="PauseButton">Pause</Button>
|
<Button VerticalAlignment="Top" IsEnabled="False" Click="PauseButton_Click" Name="PauseButton">Pause</Button>
|
||||||
<Button VerticalAlignment="Top" IsEnabled="False" Click="StopButton_Click" Name="StopButton">Stop</Button>
|
<Button VerticalAlignment="Top" IsEnabled="False" Click="StopButton_Click" Name="StopButton">Stop</Button>
|
||||||
<Button VerticalAlignment="Top" IsEnabled="False" Click="ResetButton_Click" Name="ResetButton">Reset</Button>
|
|
||||||
<Button VerticalAlignment="Top" IsEnabled="False" Click="SkipButton_Click" Name="NextFrameButton">>> 1</Button>
|
<Button VerticalAlignment="Top" IsEnabled="False" Click="SkipButton_Click" Name="NextFrameButton">>> 1</Button>
|
||||||
<Button VerticalAlignment="Top" IsEnabled="False" Click="SkipButton_Click" Name="NextFiveFramesButton">>> 5</Button>
|
<Button VerticalAlignment="Top" IsEnabled="False" Click="SkipButton_Click" Name="NextFiveFramesButton">>> 5</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
|
@ -123,8 +123,6 @@ namespace OpenFaceOffline
|
||||||
|
|
||||||
volatile bool detectionSucceeding = false;
|
volatile bool detectionSucceeding = false;
|
||||||
|
|
||||||
volatile bool reset = false;
|
|
||||||
|
|
||||||
// For tracking
|
// For tracking
|
||||||
FaceModelParameters clnf_params;
|
FaceModelParameters clnf_params;
|
||||||
CLNF clnf_model;
|
CLNF clnf_model;
|
||||||
|
@ -133,20 +131,20 @@ namespace OpenFaceOffline
|
||||||
// Recording parameters (default values)
|
// Recording parameters (default values)
|
||||||
Recorder recorder;
|
Recorder recorder;
|
||||||
|
|
||||||
public bool RecordAligned { get; set; } // Aligned face images
|
public bool RecordAligned { get; set; } = false; // Aligned face images
|
||||||
public bool RecordHOG { get; set; } // HOG features extracted from face images
|
public bool RecordHOG { get; set; } = false; // HOG features extracted from face images
|
||||||
public bool Record2DLandmarks { get; set; } // 2D locations of facial landmarks (in pixels)
|
public bool Record2DLandmarks { get; set; } = true; // 2D locations of facial landmarks (in pixels)
|
||||||
public bool Record3DLandmarks { get; set; } // 3D locations of facial landmarks (in pixels)
|
public bool Record3DLandmarks { get; set; } = true; // 3D locations of facial landmarks (in pixels)
|
||||||
public bool RecordModelParameters { get; set; } // Facial shape parameters (rigid and non-rigid geometry)
|
public bool RecordModelParameters { get; set; } = true; // Facial shape parameters (rigid and non-rigid geometry)
|
||||||
public bool RecordPose { get; set; } // Head pose (position and orientation)
|
public bool RecordPose { get; set; } = true; // Head pose (position and orientation)
|
||||||
public bool RecordAUs { get; set; } // Facial action units
|
public bool RecordAUs { get; set; } = true; // Facial action units
|
||||||
public bool RecordGaze { get; set; } // Eye gaze
|
public bool RecordGaze { get; set; } = true; // Eye gaze
|
||||||
|
|
||||||
// Visualisation options
|
// Visualisation options
|
||||||
public bool ShowTrackedVideo { get; set; } // Eye gaze
|
public bool ShowTrackedVideo { get; set; } = true; // Showing the actual tracking
|
||||||
public bool ShowAppearance { get; set; } // Eye gaze
|
public bool ShowAppearance { get; set; } = true; // Showing appeaance features like HOG
|
||||||
public bool ShowGeometry { get; set; } // Eye gaze
|
public bool ShowGeometry { get; set; } = true; // Showing geometry features, pose, gaze, and non-rigid
|
||||||
public bool ShowAUs { get; set; } // Eye gaze
|
public bool ShowAUs { get; set; } = true; // Showing Facial Action Units
|
||||||
|
|
||||||
int image_output_size = 112;
|
int image_output_size = 112;
|
||||||
|
|
||||||
|
@ -154,11 +152,11 @@ namespace OpenFaceOffline
|
||||||
|
|
||||||
// TODO indication that track is done
|
// TODO indication that track is done
|
||||||
|
|
||||||
// Where the recording is done (by default in a record directory, from where the application executed), TODO maybe the same folder as iput?
|
// Where the recording is done (by default in a record directory, from where the application executed)
|
||||||
String record_root = "./record";
|
String record_root = "./record";
|
||||||
|
|
||||||
// For AU prediction
|
// For AU prediction, if videos are long dynamic models should be used
|
||||||
public bool DynamicAUModels { get; set; }
|
public bool DynamicAUModels { get; set; } = true;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
|
@ -169,18 +167,6 @@ namespace OpenFaceOffline
|
||||||
Uri iconUri = new Uri("logo1.ico", UriKind.RelativeOrAbsolute);
|
Uri iconUri = new Uri("logo1.ico", UriKind.RelativeOrAbsolute);
|
||||||
this.Icon = BitmapFrame.Create(iconUri);
|
this.Icon = BitmapFrame.Create(iconUri);
|
||||||
|
|
||||||
// Setup the default features that will be recorded
|
|
||||||
Record2DLandmarks = true; Record3DLandmarks = true; RecordModelParameters = true; RecordModelParameters = true;
|
|
||||||
RecordGaze = true; RecordAUs = true; RecordPose = true;
|
|
||||||
RecordAligned = false; RecordHOG = false;
|
|
||||||
|
|
||||||
ShowTrackedVideo = true;
|
|
||||||
ShowAppearance = true;
|
|
||||||
ShowGeometry = true;
|
|
||||||
ShowAUs = true;
|
|
||||||
|
|
||||||
DynamicAUModels = true;
|
|
||||||
|
|
||||||
String root = AppDomain.CurrentDomain.BaseDirectory;
|
String root = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
|
||||||
clnf_params = new FaceModelParameters(root, false);
|
clnf_params = new FaceModelParameters(root, false);
|
||||||
|
@ -192,21 +178,13 @@ namespace OpenFaceOffline
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
// Actual work gets done here
|
// Actual work gets done here
|
||||||
|
|
||||||
// The main function call for processing images or video files
|
// The main function call for processing images or video files, TODO rename this as it is not a loop
|
||||||
private void ProcessingLoop(String[] filenames, int cam_id = -1, int width = -1, int height = -1, bool multi_face = false)
|
private void ProcessingLoop(String[] filenames, int cam_id = -1, int width = -1, int height = -1, bool multi_face = false)
|
||||||
{
|
{
|
||||||
|
SetupFeatureExtractionMode();
|
||||||
|
|
||||||
thread_running = true;
|
thread_running = true;
|
||||||
|
|
||||||
// Grab the boolean values of the check-boxes
|
|
||||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
|
||||||
{
|
|
||||||
ResetButton.IsEnabled = true;
|
|
||||||
PauseButton.IsEnabled = true;
|
|
||||||
StopButton.IsEnabled = true;
|
|
||||||
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Create the video capture and call the VideoLoop
|
// Create the video capture and call the VideoLoop
|
||||||
if (filenames != null)
|
if (filenames != null)
|
||||||
{
|
{
|
||||||
|
@ -308,17 +286,7 @@ namespace OpenFaceOffline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO this should be up a level
|
EndFeatureExtractionMode();
|
||||||
// Some GUI clean up
|
|
||||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
|
||||||
{
|
|
||||||
Console.WriteLine("Cleaning up after processing is done");
|
|
||||||
PauseButton.IsEnabled = false;
|
|
||||||
StopButton.IsEnabled = false;
|
|
||||||
ResetButton.IsEnabled = false;
|
|
||||||
NextFiveFramesButton.IsEnabled = false;
|
|
||||||
NextFrameButton.IsEnabled = false;
|
|
||||||
}));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,13 +433,6 @@ namespace OpenFaceOffline
|
||||||
|
|
||||||
VisualizeFeatures(frame, landmarks, fx, fy, cx, cy, progress);
|
VisualizeFeatures(frame, landmarks, fx, fy, cx, cy, progress);
|
||||||
|
|
||||||
if (reset)
|
|
||||||
{
|
|
||||||
clnf_model.Reset();
|
|
||||||
face_analyser.Reset();
|
|
||||||
reset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (thread_running & thread_paused && skip_frames == 0)
|
while (thread_running & thread_paused && skip_frames == 0)
|
||||||
{
|
{
|
||||||
Thread.Sleep(10);
|
Thread.Sleep(10);
|
||||||
|
@ -566,12 +527,6 @@ namespace OpenFaceOffline
|
||||||
|
|
||||||
VisualizeFeatures(frame, landmarks, fx, fy, cx, cy, progress);
|
VisualizeFeatures(frame, landmarks, fx, fy, cx, cy, progress);
|
||||||
|
|
||||||
if (reset)
|
|
||||||
{
|
|
||||||
clnf_model.Reset();
|
|
||||||
face_analyser.Reset();
|
|
||||||
reset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (thread_running & thread_paused && skip_frames == 0)
|
while (thread_running & thread_paused && skip_frames == 0)
|
||||||
{
|
{
|
||||||
|
@ -799,6 +754,39 @@ namespace OpenFaceOffline
|
||||||
// TODO change what next and back buttons do?
|
// TODO change what next and back buttons do?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable GUI components that should not be active during processing
|
||||||
|
private void SetupFeatureExtractionMode()
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke((Action)(() =>
|
||||||
|
{
|
||||||
|
SettingsMenu.IsEnabled = false;
|
||||||
|
RecordingMenu.IsEnabled = false;
|
||||||
|
AUSetting.IsEnabled = false;
|
||||||
|
|
||||||
|
PauseButton.IsEnabled = true;
|
||||||
|
StopButton.IsEnabled = true;
|
||||||
|
NextFiveFramesButton.IsEnabled = false;
|
||||||
|
NextFrameButton.IsEnabled = false;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the processing is done re-enable the components
|
||||||
|
private void EndFeatureExtractionMode()
|
||||||
|
{
|
||||||
|
|
||||||
|
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 2, 0), (Action)(() =>
|
||||||
|
{
|
||||||
|
SettingsMenu.IsEnabled = true;
|
||||||
|
RecordingMenu.IsEnabled = true;
|
||||||
|
AUSetting.IsEnabled = true;
|
||||||
|
|
||||||
|
PauseButton.IsEnabled = false;
|
||||||
|
StopButton.IsEnabled = false;
|
||||||
|
NextFiveFramesButton.IsEnabled = false;
|
||||||
|
NextFrameButton.IsEnabled = false;
|
||||||
|
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------
|
// ----------------------------------------------------------
|
||||||
// Opening Videos/Images
|
// Opening Videos/Images
|
||||||
|
@ -918,17 +906,6 @@ namespace OpenFaceOffline
|
||||||
NextFrameButton.IsEnabled = false;
|
NextFrameButton.IsEnabled = false;
|
||||||
NextFiveFramesButton.IsEnabled = false;
|
NextFiveFramesButton.IsEnabled = false;
|
||||||
StopButton.IsEnabled = false;
|
StopButton.IsEnabled = false;
|
||||||
ResetButton.IsEnabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resetting the tracker
|
|
||||||
private void ResetButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (processing_thread != null)
|
|
||||||
{
|
|
||||||
// Stop capture and tracking
|
|
||||||
reset = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -939,8 +916,6 @@ namespace OpenFaceOffline
|
||||||
// Stop capture and tracking
|
// Stop capture and tracking
|
||||||
thread_paused = !thread_paused;
|
thread_paused = !thread_paused;
|
||||||
|
|
||||||
ResetButton.IsEnabled = !thread_paused;
|
|
||||||
|
|
||||||
NextFrameButton.IsEnabled = thread_paused;
|
NextFrameButton.IsEnabled = thread_paused;
|
||||||
NextFiveFramesButton.IsEnabled = thread_paused;
|
NextFiveFramesButton.IsEnabled = thread_paused;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue