open source pkg v1
This commit is contained in:
6
pkg/OpenFace/gui/HeadPose-live/App.config
Normal file
6
pkg/OpenFace/gui/HeadPose-live/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
9
pkg/OpenFace/gui/HeadPose-live/App.xaml
Normal file
9
pkg/OpenFace/gui/HeadPose-live/App.xaml
Normal file
@@ -0,0 +1,9 @@
|
||||
<Application x:Class="HeadPose_live.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:HeadPose_live"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
17
pkg/OpenFace/gui/HeadPose-live/App.xaml.cs
Normal file
17
pkg/OpenFace/gui/HeadPose-live/App.xaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace HeadPose_live
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
179
pkg/OpenFace/gui/HeadPose-live/HeadPoseLive.csproj
Normal file
179
pkg/OpenFace/gui/HeadPose-live/HeadPoseLive.csproj
Normal file
@@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{F396362D-821E-4EA6-9BBF-1F6050844118}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>HeadPoseLive</RootNamespace>
|
||||
<AssemblyName>HeadPoseLive</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>logo1.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="ZeroMQ, Version=4.1.0.22, Culture=neutral, PublicKeyToken=4a9630883fd6c563, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\ZeroMQ.4.1.0.22\lib\net40\ZeroMQ.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Liability.xaml.cs">
|
||||
<DependentUpon>Liability.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TextEntryWindow.xaml.cs">
|
||||
<DependentUpon>TextEntryWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="Liability.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="TextEntryWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\lib\local\CppInerop\CppInerop.vcxproj">
|
||||
<Project>{78196985-ee54-411f-822b-5a23edf80642}</Project>
|
||||
<Name>CppInerop</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OpenFaceDemo\OpenFaceDemo.csproj">
|
||||
<Project>{e143a2aa-312e-4dfe-b61d-9a87ccbc8e90}</Project>
|
||||
<Name>OpenFaceDemo</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OpenFaceOffline\OpenFaceOffline.csproj">
|
||||
<Project>{a4760f41-2b1f-4144-b7b2-62785affe79b}</Project>
|
||||
<Name>OpenFaceOffline</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="logo1.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /I /E /Y /D "$(ProjectDir)logo1.ico" "$(ProjectDir)$(OutDir)"
|
||||
xcopy /I /E /Y /D "$(ProjectDir)logo1.png" "$(ProjectDir)$(OutDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\..\packages\ZeroMQ.4.1.0.22\build\net40\ZeroMQ.targets" Condition="Exists('..\..\packages\ZeroMQ.4.1.0.22\build\net40\ZeroMQ.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\ZeroMQ.4.1.0.22\build\net40\ZeroMQ.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\ZeroMQ.4.1.0.22\build\net40\ZeroMQ.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
26
pkg/OpenFace/gui/HeadPose-live/Liability.xaml
Normal file
26
pkg/OpenFace/gui/HeadPose-live/Liability.xaml
Normal file
@@ -0,0 +1,26 @@
|
||||
<Window x:Class="HeadPoseLive.Liability"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Liability" Height="300" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock TextWrapping="WrapWithOverflow" Margin="10,10,10,10" TextAlignment="Justify" Grid.Row="0">This software is provided by the copyright holders and contributors "as is" and
|
||||
any express or implied warranties, including, but not limited to, the implied
|
||||
warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
In no event shall copyright holders or contributors be liable for any direct,
|
||||
indirect, incidental, special, exemplary, or consequential damages
|
||||
(including, but not limited to, procurement of substitute goods or services;
|
||||
loss of use, data, or profits; or business interruption) however caused
|
||||
and on any theory of liability, whether in contract, strict liability,
|
||||
or tort (including negligence or otherwise) arising in any way out of
|
||||
the use of this software, even if advised of the possibility of such damage.</TextBlock>
|
||||
|
||||
<Button Grid.Row="1" HorizontalAlignment="Center" Click="Button_Click" Name="ContinueButton">
|
||||
Continue
|
||||
</Button>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
83
pkg/OpenFace/gui/HeadPose-live/Liability.xaml.cs
Normal file
83
pkg/OpenFace/gui/HeadPose-live/Liability.xaml.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017, Carnegie Mellon University and University of Cambridge,
|
||||
// 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 2.0: Facial Behavior Analysis Toolkit
|
||||
// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency
|
||||
// in IEEE International Conference on Automatic Face and Gesture Recognition, 2018
|
||||
//
|
||||
// Convolutional experts constrained local model for facial landmark detection.
|
||||
// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency,
|
||||
// in Computer Vision and Pattern Recognition Workshops, 2017.
|
||||
//
|
||||
// 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-specific 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
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace HeadPoseLive
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for Liability.xaml
|
||||
/// </summary>
|
||||
public partial class Liability : Window
|
||||
{
|
||||
public bool continue_pressed = false;
|
||||
|
||||
public Liability()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.KeyDown += new KeyEventHandler(TextEntry_KeyDown);
|
||||
FocusManager.SetFocusedElement(this, ContinueButton);
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
continue_pressed = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void TextEntry_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
continue_pressed = true;
|
||||
DialogResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
94
pkg/OpenFace/gui/HeadPose-live/MainWindow.xaml
Normal file
94
pkg/OpenFace/gui/HeadPose-live/MainWindow.xaml
Normal file
@@ -0,0 +1,94 @@
|
||||
<Window x:Class="HeadPoseLive.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Ophthalm_experiments="clr-namespace:HeadPoseLive"
|
||||
Title="Cambridge Face Tracker - Head Pose Experiments" MinHeight="400" MinWidth="640" WindowStartupLocation="CenterScreen" UseLayoutRounding="True" Closing="Window_Closing">
|
||||
<Window.Resources>
|
||||
<Style TargetType="{x:Type Image}">
|
||||
<Setter Property="RenderOptions.BitmapScalingMode"
|
||||
Value="Fant" />
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Grid Name="MainGrid" HorizontalAlignment="Stretch" MinWidth="620">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition MinWidth="300"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
<ColumnDefinition MinWidth="10" Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10"/>
|
||||
<RowDefinition MinHeight="200"/>
|
||||
<RowDefinition Height="50"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Column="1" Grid.Row="1" Background="DarkSalmon" Canvas.ZIndex="1" MouseDown="ResetButton_Click" Name="ResetButton" Content="Reset"/>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Width="110" Height="26" FontSize="16" Click="startRecordingButton_Click" Name="RecordingButton">Record trial 0</Button>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" VerticalAlignment="Top">
|
||||
<Button Name="PauseButton" Click="PauseButton_Click">
|
||||
Pause
|
||||
</Button>
|
||||
<Button Name="ScreenshotButton" Click="ScreenshotButton_Click" Margin="0,10,0,0">
|
||||
Take a screenshot
|
||||
</Button>
|
||||
<Button Name="MirrorImageButton" Click="MirrorButton_Click" Margin="0,10,0,0">
|
||||
Mirror image
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" Width="185">
|
||||
<Label Name="headOrientationLabel" Margin="0,0,0,0" FontSize="18" HorizontalContentAlignment="Left">Head Orientation</Label>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="16" Width="80" HorizontalContentAlignment="Left">Turn:</Label>
|
||||
<Label Name="YawLabel" FontSize="16" MinWidth="30" HorizontalContentAlignment="Right">0°</Label>
|
||||
<Label Name="YawLabelDir" FontSize="16" Width="70" HorizontalContentAlignment="Left">straight</Label>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="16" Width="80" HorizontalContentAlignment="Left">Up/down:</Label>
|
||||
<Label Name="PitchLabel" FontSize="16" Width="30" HorizontalContentAlignment="Right">0°</Label>
|
||||
<Label Name="PitchLabelDir" FontSize="16" Width="70" HorizontalContentAlignment="Left">straight</Label>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="16" Width="80" HorizontalContentAlignment="Left">Tilt:</Label>
|
||||
<Label Name="RollLabel" FontSize="16" Width="30" HorizontalContentAlignment="Right">0°</Label>
|
||||
<Label Name="RollLabelDir" FontSize="16" Width="70" HorizontalContentAlignment="Left">straight</Label>
|
||||
</StackPanel>
|
||||
<Label Name="gazeLabel" Margin="0,0,0,0" FontSize="18" HorizontalContentAlignment="Left">Gaze Orientation</Label>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="16" Width="80" HorizontalContentAlignment="Left">Left-right:</Label>
|
||||
<Label Name="YawLabelGaze" FontSize="16" MinWidth="30" HorizontalContentAlignment="Right">0°</Label>
|
||||
<Label Name="YawLabelGazeDir" FontSize="16" Width="70" HorizontalContentAlignment="Left">straight</Label>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="16" Width="80" HorizontalContentAlignment="Left">Up/down:</Label>
|
||||
<Label Name="PitchLabelGaze" FontSize="16" Width="30" HorizontalContentAlignment="Right">0°</Label>
|
||||
<Label Name="PitchLabelGazeDir" FontSize="16" Width="70" HorizontalContentAlignment="Left">straight</Label>
|
||||
</StackPanel>
|
||||
<Label Name="headPoseLabel" Margin="0,0,0,0" FontSize="18" HorizontalContentAlignment="Left">Pose</Label>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="16" HorizontalContentAlignment="Left" Width="20">X:</Label>
|
||||
<Label Name="XPoseLabel" FontSize="16" HorizontalContentAlignment="Right" Width="70">0 mm</Label>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="16" HorizontalContentAlignment="Left" Width="20">Y:</Label>
|
||||
<Label Name="YPoseLabel" FontSize="16" HorizontalContentAlignment="Right" Width="70">0 mm</Label>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="16" HorizontalContentAlignment="Left" Width="20">Z:</Label>
|
||||
<Label Name="ZPoseLabel" FontSize="16" HorizontalContentAlignment="Right" Width="70">0 mm</Label>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="2" VerticalAlignment="Bottom">
|
||||
<Button FontSize="16" HorizontalAlignment="Center" Click="CompleteButton_Click" Name="CompleteButton" >Start new subject</Button>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Width="80" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2">
|
||||
<Image RenderOptions.BitmapScalingMode="Fant" RenderOptions.EdgeMode="Aliased" x:Name="logoLabel" Source="/logo1.png" Stretch="Uniform" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
756
pkg/OpenFace/gui/HeadPose-live/MainWindow.xaml.cs
Normal file
756
pkg/OpenFace/gui/HeadPose-live/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,756 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017, Carnegie Mellon University and University of Cambridge,
|
||||
// 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 2.0: Facial Behavior Analysis Toolkit
|
||||
// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency
|
||||
// in IEEE International Conference on Automatic Face and Gesture Recognition, 2018
|
||||
//
|
||||
// Convolutional experts constrained local model for facial landmark detection.
|
||||
// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency,
|
||||
// in Computer Vision and Pattern Recognition Workshops, 2017.
|
||||
//
|
||||
// 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-specific 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
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
using OpenCVWrappers;
|
||||
using CppInterop;
|
||||
using CppInterop.LandmarkDetector;
|
||||
using System.Windows.Threading;
|
||||
using GazeAnalyser_Interop;
|
||||
using FaceDetectorInterop;
|
||||
|
||||
using ZeroMQ;
|
||||
using System.Drawing;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace HeadPoseLive
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
// Timing for measuring FPS
|
||||
#region High-Resolution Timing
|
||||
static DateTime startTime;
|
||||
static Stopwatch sw = new Stopwatch();
|
||||
|
||||
static MainWindow()
|
||||
{
|
||||
startTime = DateTime.Now;
|
||||
sw.Start();
|
||||
}
|
||||
|
||||
public static DateTime CurrentTime
|
||||
{
|
||||
get { return startTime + sw.Elapsed; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
OpenFaceOffline.FpsTracker processing_fps = new OpenFaceOffline.FpsTracker();
|
||||
|
||||
Thread processing_thread;
|
||||
Thread rec_thread;
|
||||
|
||||
string subject_id;
|
||||
bool record_video;
|
||||
bool record_head_pose;
|
||||
|
||||
// Controls if the view should be mirrored or not
|
||||
volatile bool mirror_image = false;
|
||||
|
||||
// Capturing and displaying the images
|
||||
OpenFaceOffline.OverlayImage webcam_img;
|
||||
|
||||
// Some members for displaying the results
|
||||
private WriteableBitmap latest_img;
|
||||
|
||||
// For tracking
|
||||
bool reset = false;
|
||||
|
||||
// For recording
|
||||
string record_root = "./head_pose_live_recordings/subject";
|
||||
string output_root;
|
||||
private Object recording_lock = new Object();
|
||||
int trial_id = 0;
|
||||
bool recording = false;
|
||||
int img_width;
|
||||
int img_height;
|
||||
|
||||
double seconds_to_record = 10;
|
||||
|
||||
System.IO.StreamWriter recording_success_file = null;
|
||||
|
||||
ConcurrentQueue<Tuple<RawImage, bool, List<float>>> recording_objects;
|
||||
|
||||
// For broadcasting the results
|
||||
ZeroMQ.ZContext zero_mq_context;
|
||||
ZeroMQ.ZSocket zero_mq_socket;
|
||||
|
||||
volatile bool running = true;
|
||||
volatile bool pause = false;
|
||||
|
||||
public void StartExperiment()
|
||||
{
|
||||
// Inquire more from the user
|
||||
|
||||
// Get the entry dialogue now for the subject ID
|
||||
trial_id = 0;
|
||||
TextEntryWindow subject_id_window = new TextEntryWindow();
|
||||
subject_id_window.Icon = this.Icon;
|
||||
|
||||
subject_id_window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
|
||||
if (subject_id_window.ShowDialog() == true)
|
||||
{
|
||||
|
||||
subject_id = subject_id_window.ResponseText;
|
||||
|
||||
// Remove trailing spaces and full stops at the end of the folder name
|
||||
int old_length;
|
||||
do
|
||||
{
|
||||
old_length = subject_id.Length;
|
||||
subject_id = subject_id.Trim();
|
||||
if (subject_id.Length > 0)
|
||||
{
|
||||
while (subject_id[subject_id.Length - 1].Equals('.'))
|
||||
{
|
||||
subject_id = subject_id.Substring(0, subject_id.Length - 1);
|
||||
}
|
||||
}
|
||||
} while (subject_id.Length != old_length);
|
||||
|
||||
output_root = record_root + subject_id + "/";
|
||||
|
||||
if (System.IO.Directory.Exists(output_root))
|
||||
{
|
||||
string messageBoxText = "The recording for subject already exists, are you sure you want to continue?";
|
||||
string caption = "Directory exists!";
|
||||
MessageBoxButton button = MessageBoxButton.YesNo;
|
||||
MessageBoxImage icon = MessageBoxImage.Warning;
|
||||
MessageBoxResult result = MessageBox.Show(messageBoxText, caption, button, icon);
|
||||
if (result == MessageBoxResult.No)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Else find the latest trial from which to continu
|
||||
int trial_id_not_found = 0;
|
||||
while (System.IO.File.Exists(output_root + '/' + "trial_" + trial_id_not_found + ".avi"))
|
||||
{
|
||||
trial_id_not_found++;
|
||||
}
|
||||
trial_id = trial_id_not_found;
|
||||
}
|
||||
|
||||
System.IO.Directory.CreateDirectory(output_root);
|
||||
|
||||
record_video = subject_id_window.RecordVideo;
|
||||
record_head_pose = subject_id_window.RecordHeadPose;
|
||||
RecordingButton.Content = "Record trial: " + trial_id;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
// Set the icon
|
||||
Uri iconUri = new Uri("logo1.ico", UriKind.RelativeOrAbsolute);
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
// Warn about the liability
|
||||
Liability liab = new Liability();
|
||||
liab.Icon = BitmapFrame.Create(iconUri);
|
||||
liab.ShowDialog();
|
||||
|
||||
if (!liab.continue_pressed)
|
||||
{
|
||||
this.Close();
|
||||
return;
|
||||
}
|
||||
|
||||
BitmapImage src = new BitmapImage();
|
||||
src.BeginInit();
|
||||
src.UriSource = new Uri("logo1.png", UriKind.RelativeOrAbsolute);
|
||||
src.CacheOption = BitmapCacheOption.OnLoad;
|
||||
src.EndInit();
|
||||
|
||||
logoLabel.Source = src;
|
||||
|
||||
// First make the user chooose a webcam
|
||||
OpenFaceOffline.CameraSelection cam_select = new OpenFaceOffline.CameraSelection();
|
||||
cam_select.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
if (!cam_select.no_cameras_found)
|
||||
{
|
||||
cam_select.ShowDialog();
|
||||
}
|
||||
|
||||
if (cam_select.camera_selected)
|
||||
{
|
||||
|
||||
// Create the capture device
|
||||
int cam_id = cam_select.selected_camera.Item1;
|
||||
img_width = cam_select.selected_camera.Item2;
|
||||
img_height = cam_select.selected_camera.Item3;
|
||||
|
||||
UtilitiesOF.SequenceReader reader = new UtilitiesOF.SequenceReader(cam_id, img_width, img_height);
|
||||
|
||||
if (reader.IsOpened())
|
||||
{
|
||||
|
||||
// Create the ZeroMQ context for broadcasting the results
|
||||
zero_mq_context = ZeroMQ.ZContext.Create();
|
||||
zero_mq_socket = new ZSocket(zero_mq_context, ZeroMQ.ZSocketType.PUB);
|
||||
|
||||
// Bind on localhost port 5000
|
||||
zero_mq_socket.Bind("tcp://127.0.0.1:5000");
|
||||
|
||||
processing_thread = new Thread(() => VideoLoop(reader));
|
||||
processing_thread.Name = "Webcam processing";
|
||||
processing_thread.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
string messageBoxText = "Failed to open a webcam";
|
||||
string caption = "Webcam failure";
|
||||
MessageBoxButton button = MessageBoxButton.OK;
|
||||
MessageBoxImage icon = MessageBoxImage.Warning;
|
||||
|
||||
// Display message box
|
||||
MessageBox.Show(messageBoxText, caption, button, icon);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Create an overlay image for display purposes
|
||||
webcam_img = new OpenFaceOffline.OverlayImage();
|
||||
|
||||
webcam_img.SetValue(Grid.RowProperty, 1);
|
||||
webcam_img.SetValue(Grid.ColumnProperty, 1);
|
||||
MainGrid.Children.Add(webcam_img);
|
||||
|
||||
StartExperiment();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
cam_select.Close();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool ProcessFrame(CLNF landmark_detector, GazeAnalyserManaged gaze_analyser, FaceModelParameters model_params, RawImage frame, RawImage grayscale_frame, float fx, float fy, float cx, float cy)
|
||||
{
|
||||
bool detection_succeeding = landmark_detector.DetectLandmarksInVideo(frame, model_params, grayscale_frame);
|
||||
gaze_analyser.AddNextFrame(landmark_detector, detection_succeeding, fx, fy, cx, cy);
|
||||
return detection_succeeding;
|
||||
|
||||
}
|
||||
|
||||
// Capturing and processing the video frame by frame
|
||||
private void RecordingLoop()
|
||||
{
|
||||
// Set up the recording objects first
|
||||
Thread.CurrentThread.IsBackground = true;
|
||||
|
||||
System.IO.StreamWriter output_head_pose_file = null;
|
||||
|
||||
if (record_head_pose)
|
||||
{
|
||||
String filename_poses = output_root + "/trial_" + trial_id + ".poses.txt";
|
||||
output_head_pose_file = new System.IO.StreamWriter(filename_poses);
|
||||
output_head_pose_file.WriteLine("time(ms), success, pose_X(mm), pose_Y(mm), pose_Z(mm), pitch(deg), yaw(deg), roll(deg)");
|
||||
}
|
||||
|
||||
VideoWriter video_writer = null;
|
||||
|
||||
if (record_video)
|
||||
{
|
||||
double fps = processing_fps.GetFPS();
|
||||
String filename_video = output_root + "/trial_" + trial_id + ".avi";
|
||||
video_writer = new VideoWriter(filename_video, img_width, img_height, fps, true);
|
||||
}
|
||||
|
||||
// The timiing should be when the item is captured, but oh well
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
|
||||
while (recording)
|
||||
{
|
||||
Tuple<RawImage, bool, List<float>> recording_object;
|
||||
if (recording_objects.TryDequeue(out recording_object))
|
||||
{
|
||||
|
||||
if (record_video)
|
||||
{
|
||||
video_writer.Write(recording_object.Item1);
|
||||
}
|
||||
|
||||
if (record_head_pose)
|
||||
{
|
||||
String output_pose_line = stopWatch.ElapsedMilliseconds.ToString();
|
||||
if (recording_object.Item2)
|
||||
output_pose_line += ", 1";
|
||||
else
|
||||
output_pose_line += ", 0";
|
||||
|
||||
for (int i = 0; i < recording_object.Item3.Count; ++i)
|
||||
{
|
||||
double num = recording_object.Item3[i];
|
||||
if (i > 2)
|
||||
{
|
||||
output_pose_line += ", " + num * 180 / Math.PI;
|
||||
}
|
||||
else
|
||||
{
|
||||
output_pose_line += ", " + num;
|
||||
}
|
||||
}
|
||||
output_head_pose_file.WriteLine(output_pose_line);
|
||||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
|
||||
// Clean up the recording
|
||||
if (record_head_pose)
|
||||
{
|
||||
output_head_pose_file.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Capturing and processing the video frame by frame
|
||||
private void VideoLoop(UtilitiesOF.SequenceReader reader)
|
||||
{
|
||||
Thread.CurrentThread.IsBackground = true;
|
||||
|
||||
String root = AppDomain.CurrentDomain.BaseDirectory;
|
||||
FaceModelParameters model_params = new FaceModelParameters(root, true, false, false);
|
||||
|
||||
// Initialize the face detector
|
||||
FaceDetector face_detector = new FaceDetector(model_params.GetHaarLocation(), model_params.GetMTCNNLocation());
|
||||
|
||||
// If MTCNN model not available, use HOG
|
||||
if (!face_detector.IsMTCNNLoaded())
|
||||
{
|
||||
model_params.SetFaceDetector(false, true, false);
|
||||
}
|
||||
|
||||
CLNF face_model = new CLNF(model_params);
|
||||
GazeAnalyserManaged gaze_analyser = new GazeAnalyserManaged();
|
||||
|
||||
DateTime? startTime = CurrentTime;
|
||||
|
||||
var lastFrameTime = CurrentTime;
|
||||
|
||||
while (running)
|
||||
{
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// CAPTURE FRAME AND DETECT LANDMARKS FOLLOWED BY THE REQUIRED IMAGE PROCESSING
|
||||
//////////////////////////////////////////////
|
||||
|
||||
RawImage frame = reader.GetNextImage();
|
||||
|
||||
lastFrameTime = CurrentTime;
|
||||
processing_fps.AddFrame();
|
||||
|
||||
var grayFrame = reader.GetCurrentFrameGray();
|
||||
|
||||
if (mirror_image)
|
||||
{
|
||||
frame.Mirror();
|
||||
grayFrame.Mirror();
|
||||
}
|
||||
|
||||
bool detectionSucceeding = ProcessFrame(face_model, gaze_analyser, model_params, frame, grayFrame, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy());
|
||||
|
||||
lock (recording_lock)
|
||||
{
|
||||
if (recording)
|
||||
{
|
||||
// Add objects to recording queues
|
||||
List<float> pose = new List<float>();
|
||||
face_model.GetPose(pose, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy());
|
||||
recording_objects.Enqueue(new Tuple<RawImage, bool, List<float>>(frame, detectionSucceeding, pose));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
List<Tuple<System.Windows.Point, System.Windows.Point>> lines = null;
|
||||
List<Tuple<float, float>> eye_landmarks = null;
|
||||
List<System.Windows.Point> landmarks = new List<System.Windows.Point>();
|
||||
List<Tuple<System.Windows.Point, System.Windows.Point>> gaze_lines = null;
|
||||
Tuple<float, float> gaze_angle = new Tuple<float, float>(0, 0);
|
||||
var visibilities = face_model.GetVisibilities();
|
||||
double scale = face_model.GetRigidParams()[0];
|
||||
|
||||
if (detectionSucceeding)
|
||||
{
|
||||
List<Tuple<float, float>> landmarks_doubles = face_model.CalculateAllLandmarks();
|
||||
|
||||
foreach (var p in landmarks_doubles)
|
||||
landmarks.Add(new System.Windows.Point(p.Item1, p.Item2));
|
||||
|
||||
eye_landmarks = face_model.CalculateVisibleEyeLandmarks();
|
||||
|
||||
gaze_lines = gaze_analyser.CalculateGazeLines(reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy());
|
||||
gaze_angle = gaze_analyser.GetGazeAngle();
|
||||
|
||||
lines = face_model.CalculateBox(reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy());
|
||||
}
|
||||
|
||||
if (reset)
|
||||
{
|
||||
face_model.Reset();
|
||||
reset = false;
|
||||
}
|
||||
|
||||
// Visualisation updating
|
||||
try
|
||||
{
|
||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
||||
{
|
||||
if (latest_img == null)
|
||||
latest_img = frame.CreateWriteableBitmap();
|
||||
|
||||
List<float> pose = new List<float>();
|
||||
face_model.GetPose(pose, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy());
|
||||
|
||||
int yaw = (int)(pose[4] * 180 / Math.PI + 0.5);
|
||||
int yaw_abs = Math.Abs(yaw);
|
||||
|
||||
int roll = (int)(pose[5] * 180 / Math.PI + 0.5);
|
||||
int roll_abs = Math.Abs(roll);
|
||||
|
||||
int pitch = (int)(pose[3] * 180 / Math.PI + 0.5);
|
||||
int pitch_abs = Math.Abs(pitch);
|
||||
|
||||
YawLabel.Content = yaw_abs + "°";
|
||||
RollLabel.Content = roll_abs + "°";
|
||||
PitchLabel.Content = pitch_abs + "°";
|
||||
|
||||
if (yaw > 0)
|
||||
YawLabelDir.Content = "Right";
|
||||
else if (yaw < 0)
|
||||
YawLabelDir.Content = "Left";
|
||||
else
|
||||
YawLabelDir.Content = "Straight";
|
||||
|
||||
if (pitch > 0)
|
||||
PitchLabelDir.Content = "Down";
|
||||
else if (pitch < 0)
|
||||
PitchLabelDir.Content = "Up";
|
||||
else
|
||||
PitchLabelDir.Content = "Straight";
|
||||
|
||||
if (roll > 0)
|
||||
RollLabelDir.Content = "Left";
|
||||
else if (roll < 0)
|
||||
RollLabelDir.Content = "Right";
|
||||
else
|
||||
RollLabelDir.Content = "Straight";
|
||||
|
||||
XPoseLabel.Content = (int)pose[0] + " mm";
|
||||
YPoseLabel.Content = (int)pose[1] + " mm";
|
||||
ZPoseLabel.Content = (int)pose[2] + " mm";
|
||||
|
||||
String x_angle = String.Format("{0:F0}°", gaze_angle.Item1 * (180.0 / Math.PI));
|
||||
String y_angle = String.Format("{0:F0}°", gaze_angle.Item2 * (180.0 / Math.PI));
|
||||
YawLabelGaze.Content = x_angle;
|
||||
PitchLabelGaze.Content = y_angle;
|
||||
|
||||
if (gaze_angle.Item1 > 0)
|
||||
YawLabelGazeDir.Content = "Right";
|
||||
else if (gaze_angle.Item1 < 0)
|
||||
YawLabelGazeDir.Content = "Left";
|
||||
else
|
||||
YawLabelGazeDir.Content = "Straight";
|
||||
|
||||
if (gaze_angle.Item2 > 0)
|
||||
PitchLabelGazeDir.Content = "Down";
|
||||
else if (gaze_angle.Item2 < 0)
|
||||
PitchLabelGazeDir.Content = "Up";
|
||||
else
|
||||
PitchLabelGazeDir.Content = "Straight";
|
||||
|
||||
double confidence = face_model.GetConfidence();
|
||||
|
||||
if (confidence < 0)
|
||||
confidence = 0;
|
||||
else if (confidence > 1)
|
||||
confidence = 1;
|
||||
|
||||
frame.UpdateWriteableBitmap(latest_img);
|
||||
webcam_img.Clear();
|
||||
|
||||
webcam_img.Source = latest_img;
|
||||
webcam_img.Confidence.Add(confidence);
|
||||
webcam_img.FPS = processing_fps.GetFPS();
|
||||
if(detectionSucceeding)
|
||||
{
|
||||
webcam_img.OverlayLines.Add(lines);
|
||||
webcam_img.OverlayPoints.Add(landmarks);
|
||||
webcam_img.OverlayPointsVisibility.Add(visibilities);
|
||||
webcam_img.FaceScale.Add(scale);
|
||||
|
||||
List<System.Windows.Point> eye_landmark_points = new List<System.Windows.Point>();
|
||||
foreach (var p in eye_landmarks)
|
||||
{
|
||||
eye_landmark_points.Add(new System.Windows.Point(p.Item1, p.Item2));
|
||||
}
|
||||
|
||||
|
||||
webcam_img.OverlayEyePoints.Add(eye_landmark_points);
|
||||
webcam_img.GazeLines.Add(gaze_lines);
|
||||
|
||||
// Publish the information for other applications
|
||||
String str_head_pose = String.Format("{0}:{1:F2}, {2:F2}, {3:F2}, {4:F2}, {5:F2}, {6:F2}", "HeadPose", pose[0], pose[1], pose[2],
|
||||
pose[3] * 180 / Math.PI, pose[4] * 180 / Math.PI, pose[5] * 180 / Math.PI);
|
||||
|
||||
zero_mq_socket.Send(new ZFrame(str_head_pose, Encoding.UTF8));
|
||||
|
||||
String str_gaze = String.Format("{0}:{1:F2}, {2:F2}", "GazeAngle", gaze_angle.Item1 * (180.0 / Math.PI), gaze_angle.Item2 * (180.0 / Math.PI));
|
||||
|
||||
zero_mq_socket.Send(new ZFrame(str_gaze, Encoding.UTF8));
|
||||
}
|
||||
}));
|
||||
|
||||
while (running & pause)
|
||||
{
|
||||
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
// Quitting
|
||||
break;
|
||||
}
|
||||
}
|
||||
reader.Close();
|
||||
System.Console.Out.WriteLine("Thread finished");
|
||||
}
|
||||
|
||||
private void startRecordingButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
lock (recording_lock)
|
||||
{
|
||||
RecordingButton.IsEnabled = false;
|
||||
CompleteButton.IsEnabled = false;
|
||||
PauseButton.IsEnabled = false;
|
||||
|
||||
recording_objects = new ConcurrentQueue<Tuple<RawImage, bool, List<float>>>();
|
||||
|
||||
recording = true;
|
||||
|
||||
new Thread(() =>
|
||||
{
|
||||
Thread.CurrentThread.IsBackground = true;
|
||||
|
||||
// Start the recording thread
|
||||
rec_thread = new Thread(RecordingLoop);
|
||||
rec_thread.Start();
|
||||
|
||||
double d = seconds_to_record * 1000;
|
||||
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
|
||||
while (d > 1000)
|
||||
{
|
||||
|
||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
||||
{
|
||||
RecordingButton.Content = ((int)(d / 1000)).ToString() + " seconds remaining";
|
||||
}));
|
||||
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
|
||||
d = seconds_to_record * 1000 - stopWatch.ElapsedMilliseconds;
|
||||
}
|
||||
|
||||
if (d > 0)
|
||||
{
|
||||
System.Threading.Thread.Sleep((int)(d));
|
||||
}
|
||||
|
||||
recording = false;
|
||||
|
||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
||||
{
|
||||
RecordingButton.Content = "0 seconds remaining";
|
||||
}));
|
||||
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
lock (recording_lock)
|
||||
{
|
||||
|
||||
// Wait for the recording thread to finish before enabling
|
||||
rec_thread.Join();
|
||||
|
||||
string messageBoxText = "Was the tracking successful?";
|
||||
string caption = "Success of tracking";
|
||||
MessageBoxButton button = MessageBoxButton.YesNo;
|
||||
MessageBoxImage icon = MessageBoxImage.Question;
|
||||
MessageBoxResult result = MessageBox.Show(messageBoxText, caption, button, icon);
|
||||
|
||||
if (recording_success_file == null)
|
||||
{
|
||||
recording_success_file = new System.IO.StreamWriter(output_root + "/recording_success.txt", true);
|
||||
}
|
||||
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
recording_success_file.WriteLine('1');
|
||||
}
|
||||
else
|
||||
{
|
||||
recording_success_file.WriteLine('0');
|
||||
}
|
||||
recording_success_file.Flush();
|
||||
|
||||
trial_id++;
|
||||
RecordingButton.Content = "Record trial: " + trial_id;
|
||||
RecordingButton.IsEnabled = true;
|
||||
CompleteButton.IsEnabled = true;
|
||||
PauseButton.IsEnabled = true;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
reset = true;
|
||||
}
|
||||
|
||||
private void CompleteButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
StartExperiment();
|
||||
}
|
||||
|
||||
private void MirrorButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
mirror_image = !mirror_image;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
|
||||
// Let it finish recording
|
||||
recording = false;
|
||||
if (rec_thread != null)
|
||||
{
|
||||
rec_thread.Join();
|
||||
}
|
||||
|
||||
// Stop capture and tracking
|
||||
running = false;
|
||||
if (processing_thread != null)
|
||||
{
|
||||
processing_thread.Join();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void MorrorButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void PauseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
pause = !pause;
|
||||
|
||||
if (pause)
|
||||
{
|
||||
PauseButton.Content = "Resume";
|
||||
}
|
||||
else
|
||||
{
|
||||
PauseButton.Content = "Pause";
|
||||
}
|
||||
}
|
||||
|
||||
private void ScreenshotButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
PresentationSource source = PresentationSource.FromVisual(Application.Current.MainWindow);
|
||||
|
||||
var topLeft = source.CompositionTarget.TransformToDevice.Transform(new System.Windows.Point(this.Left, this.Top));
|
||||
var bottomRight = source.CompositionTarget.TransformToDevice.Transform(new System.Windows.Point(this.Left + this.Width, this.Top + this.Height));
|
||||
|
||||
int Width = (int)(bottomRight.X - topLeft.X);
|
||||
int Height = (int)(bottomRight.Y - topLeft.Y);
|
||||
|
||||
using (Bitmap bmpScreenCapture = new Bitmap(Width,
|
||||
Height))
|
||||
{
|
||||
using (System.Drawing.Graphics g = Graphics.FromImage(bmpScreenCapture))
|
||||
{
|
||||
g.CopyFromScreen((int)(topLeft.X),
|
||||
(int)(topLeft.Y),
|
||||
0, 0,
|
||||
bmpScreenCapture.Size,
|
||||
CopyPixelOperation.SourceCopy);
|
||||
|
||||
// Write out the bitmap here encoded by a time-stamp?
|
||||
String fname = output_root + DateTime.Now.ToString("yyyy-MMM-dd--HH-mm-ss") + ".png";
|
||||
bmpScreenCapture.Save(fname, ImageFormat.Png);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
55
pkg/OpenFace/gui/HeadPose-live/Properties/AssemblyInfo.cs
Normal file
55
pkg/OpenFace/gui/HeadPose-live/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("HeadPose-live")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("HeadPose-live")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
63
pkg/OpenFace/gui/HeadPose-live/Properties/Resources.Designer.cs
generated
Normal file
63
pkg/OpenFace/gui/HeadPose-live/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace HeadPoseLive.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HeadPoseLive.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
pkg/OpenFace/gui/HeadPose-live/Properties/Resources.resx
Normal file
117
pkg/OpenFace/gui/HeadPose-live/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
pkg/OpenFace/gui/HeadPose-live/Properties/Settings.Designer.cs
generated
Normal file
26
pkg/OpenFace/gui/HeadPose-live/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace HeadPoseLive.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
17
pkg/OpenFace/gui/HeadPose-live/TextEntryWindow.xaml
Normal file
17
pkg/OpenFace/gui/HeadPose-live/TextEntryWindow.xaml
Normal file
@@ -0,0 +1,17 @@
|
||||
<Window x:Class="HeadPoseLive.TextEntryWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Configuration and subject information" Height="210" Width="300">
|
||||
<Grid>
|
||||
<StackPanel FocusManager.FocusedElement="{Binding ElementName=ResponseTextBox}">
|
||||
<TextBlock HorizontalAlignment="Center" Text="Enter subject ID" FontSize="20"/>
|
||||
<TextBox Margin="0,4,0,0" x:Name="ResponseTextBox" FontSize="20" Width="120" TextChanged="ResponseTextBox_TextChanged" />
|
||||
<Label Name="warningLabel" Visibility="Collapsed" FontStyle="Italic" Foreground="Red" HorizontalAlignment="Center">Can't use the following characters: " \ / | < > : * ?</Label>
|
||||
<CheckBox HorizontalAlignment="Center" x:Name="RecordVideoCheckBox" Margin="-25,10,0,0" Content="Record video"/>
|
||||
|
||||
<CheckBox Margin="0,6,0,0" IsChecked="True" HorizontalAlignment="Center" x:Name="RecordHeadPoseCheckBox" Content="Record head pose"/>
|
||||
|
||||
<Button Margin="0,8,0,0" Content="OK" Click="OKButton_Click" Width="100" VerticalAlignment="Bottom"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
129
pkg/OpenFace/gui/HeadPose-live/TextEntryWindow.xaml.cs
Normal file
129
pkg/OpenFace/gui/HeadPose-live/TextEntryWindow.xaml.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017, Carnegie Mellon University and University of Cambridge,
|
||||
// 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 2.0: Facial Behavior Analysis Toolkit
|
||||
// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency
|
||||
// in IEEE International Conference on Automatic Face and Gesture Recognition, 2018
|
||||
//
|
||||
// Convolutional experts constrained local model for facial landmark detection.
|
||||
// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency,
|
||||
// in Computer Vision and Pattern Recognition Workshops, 2017.
|
||||
//
|
||||
// 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-specific 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
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace HeadPoseLive
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for TextEntryWindow.xaml
|
||||
/// </summary>
|
||||
public partial class TextEntryWindow : Window
|
||||
{
|
||||
public TextEntryWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.KeyDown += new KeyEventHandler(TextEntry_KeyDown);
|
||||
|
||||
}
|
||||
|
||||
public string ResponseText
|
||||
{
|
||||
get { return ResponseTextBox.Text; }
|
||||
set { ResponseTextBox.Text = value; }
|
||||
}
|
||||
|
||||
public bool RecordVideo
|
||||
{
|
||||
get { return (bool)RecordVideoCheckBox.IsChecked; }
|
||||
set { RecordVideoCheckBox.IsChecked = value; }
|
||||
}
|
||||
|
||||
public bool RecordHeadPose
|
||||
{
|
||||
get { return (bool)RecordHeadPoseCheckBox.IsChecked; }
|
||||
set { RecordHeadPoseCheckBox.IsChecked = value; }
|
||||
}
|
||||
|
||||
|
||||
private void OKButton_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
|
||||
private void TextEntry_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not allow illegal characters like
|
||||
private void ResponseTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
Regex regex = new Regex("[/:*?<>|\"]");
|
||||
Regex regex2 = new Regex(@"[\\]");
|
||||
MatchCollection matches = regex.Matches(ResponseTextBox.Text);
|
||||
MatchCollection matches2 = regex2.Matches(ResponseTextBox.Text);
|
||||
if (matches.Count > 0 || matches2.Count > 0)
|
||||
{
|
||||
for (int i = matches.Count - 1; i >= 0; --i)
|
||||
{
|
||||
// Remove the illegal characters
|
||||
ResponseTextBox.Text = ResponseTextBox.Text.Substring(0, matches[i].Index) + ResponseTextBox.Text.Substring(matches[i].Index + 1);
|
||||
}
|
||||
|
||||
//tell the user
|
||||
for (int i = matches2.Count - 1; i >= 0; --i)
|
||||
{
|
||||
// Remove the illegal characters
|
||||
ResponseTextBox.Text = ResponseTextBox.Text.Substring(0, matches2[i].Index) + ResponseTextBox.Text.Substring(matches2[i].Index + 1);
|
||||
|
||||
}
|
||||
warningLabel.Visibility = System.Windows.Visibility.Visible;
|
||||
ResponseTextBox.SelectionStart = ResponseTextBox.Text.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
warningLabel.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
BIN
pkg/OpenFace/gui/HeadPose-live/logo1.ico
Normal file
BIN
pkg/OpenFace/gui/HeadPose-live/logo1.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
BIN
pkg/OpenFace/gui/HeadPose-live/logo1.png
Normal file
BIN
pkg/OpenFace/gui/HeadPose-live/logo1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 199 KiB |
4
pkg/OpenFace/gui/HeadPose-live/packages.config
Normal file
4
pkg/OpenFace/gui/HeadPose-live/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="ZeroMQ" version="4.1.0.22" targetFramework="net452" />
|
||||
</packages>
|
||||
6
pkg/OpenFace/gui/OpenFaceDemo/App.config
Normal file
6
pkg/OpenFace/gui/OpenFaceDemo/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
9
pkg/OpenFace/gui/OpenFaceDemo/App.xaml
Normal file
9
pkg/OpenFace/gui/OpenFaceDemo/App.xaml
Normal file
@@ -0,0 +1,9 @@
|
||||
<Application x:Class="OpenFaceDemo.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:OpenFaceDemo"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
17
pkg/OpenFace/gui/OpenFaceDemo/App.xaml.cs
Normal file
17
pkg/OpenFace/gui/OpenFaceDemo/App.xaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace OpenFaceDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
51
pkg/OpenFace/gui/OpenFaceDemo/MainWindow.xaml
Normal file
51
pkg/OpenFace/gui/OpenFaceDemo/MainWindow.xaml
Normal file
@@ -0,0 +1,51 @@
|
||||
<Window x:Class="OpenFaceDemo.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:OpenFaceDemo"
|
||||
xmlns:of="clr-namespace:OpenFaceOffline;assembly=OpenFaceOffline"
|
||||
mc:Ignorable="d"
|
||||
Title="OpenFace Analyser" Height="800" Width="1300" MinWidth="700" MinHeight="450" Closing="Window_Closing" WindowStartupLocation="CenterScreen" KeyDown="Window_KeyDown">
|
||||
<Grid Name="MainGrid" Margin="-1,1,1.333,-1.333">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.8*"/>
|
||||
<ColumnDefinition Width="1.8*"/>
|
||||
<ColumnDefinition Width="1.8*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20"/>
|
||||
<RowDefinition Height="1.5*" MinHeight="100"/>
|
||||
<RowDefinition Height="1.5*" MinHeight="100"/>
|
||||
<RowDefinition Height="1.5*" MinHeight="100"/>
|
||||
<RowDefinition Height="1.6*"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Menu IsMainMenu="True" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4">
|
||||
<MenuItem Header="File">
|
||||
<MenuItem Header="Open webcam" Click="openWebcamClick">
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Border Name="VideoBorder" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Grid.RowSpan="3" BorderBrush="Black" BorderThickness="1" Background="LightGray" Margin="5,5,0,0" >
|
||||
<of:OverlayImage x:Name="video" MouseDown="video_MouseDown" />
|
||||
</Border>
|
||||
|
||||
<local:AxesTimeSeriesPlot NumVertGrid="5" x:Name="headPosePlot" ShowLegend="True" MinVal="-1" MaxVal="1" MinHeight="180" Grid.Row="4" Grid.Column="0" Padding="60 20 30 40" RangeLabel="Head pose" Orientation="Horizontal">
|
||||
</local:AxesTimeSeriesPlot>
|
||||
|
||||
<local:AxesTimeSeriesPlot MinHeight="180" Grid.Row="4" Grid.Column="1" Padding="60 20 30 40" x:Name="gazePlot" ShowLegend="True" RangeLabel="Eye gaze" Orientation="Horizontal" MinVal="-20" MaxVal="20" NumVertGrid="5">
|
||||
</local:AxesTimeSeriesPlot>
|
||||
|
||||
<local:AxesTimeSeriesPlot Grid.Column="2" Grid.Row="1" MinHeight="130" ShowXLabel="False" Padding="60 20 30 10" x:Name="smilePlot" ShowLegend="True" XTicks="False" RangeLabel="Lips" Orientation="Horizontal" MinVal="0" MaxVal="1" NumVertGrid="5">
|
||||
</local:AxesTimeSeriesPlot>
|
||||
|
||||
<local:AxesTimeSeriesPlot Grid.Column="2" Grid.Row="2" MinHeight="130" ShowXLabel="False" Padding="60 20 30 10" x:Name="browPlot" ShowLegend="True" XTicks="False" RangeLabel="Brows" Orientation="Horizontal" MinVal="0" MaxVal="1" NumVertGrid="5">
|
||||
</local:AxesTimeSeriesPlot>
|
||||
|
||||
<local:AxesTimeSeriesPlot Grid.Column="2" Grid.Row="3" MinHeight="130" ShowXLabel="False" x:Name="eyePlot" ShowLegend="True" Padding="60 20 30 10" XTicks="False" RangeLabel="Other" Orientation="Horizontal" MinVal="0" MaxVal="1" NumVertGrid="5">
|
||||
</local:AxesTimeSeriesPlot>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
494
pkg/OpenFace/gui/OpenFaceDemo/MainWindow.xaml.cs
Normal file
494
pkg/OpenFace/gui/OpenFaceDemo/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,494 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017, Carnegie Mellon University and University of Cambridge,
|
||||
// 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 2.0: Facial Behavior Analysis Toolkit
|
||||
// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency
|
||||
// in IEEE International Conference on Automatic Face and Gesture Recognition, 2018
|
||||
//
|
||||
// Convolutional experts constrained local model for facial landmark detection.
|
||||
// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency,
|
||||
// in Computer Vision and Pattern Recognition Workshops, 2017.
|
||||
//
|
||||
// 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-specific 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
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Threading;
|
||||
using System.Windows.Threading;
|
||||
using System.Diagnostics;
|
||||
|
||||
// Internal libraries
|
||||
using OpenFaceOffline;
|
||||
using OpenCVWrappers;
|
||||
using CppInterop.LandmarkDetector;
|
||||
using FaceAnalyser_Interop;
|
||||
using FaceDetectorInterop;
|
||||
using GazeAnalyser_Interop;
|
||||
using UtilitiesOF;
|
||||
|
||||
|
||||
namespace OpenFaceDemo
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Members
|
||||
// -----------------------------------------------------------------
|
||||
// Timing for measuring FPS
|
||||
#region High-Resolution Timing
|
||||
static DateTime startTime;
|
||||
static Stopwatch sw = new Stopwatch();
|
||||
|
||||
static MainWindow()
|
||||
{
|
||||
startTime = DateTime.Now;
|
||||
sw.Start();
|
||||
}
|
||||
|
||||
public static DateTime CurrentTime
|
||||
{
|
||||
get { return startTime + sw.Elapsed; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
Thread processing_thread;
|
||||
|
||||
// Some members for displaying the results
|
||||
private WriteableBitmap latest_img;
|
||||
|
||||
private volatile bool thread_running;
|
||||
|
||||
FpsTracker processing_fps = new FpsTracker();
|
||||
|
||||
// Controlling the model reset
|
||||
volatile bool reset = false;
|
||||
Point? resetPoint = null;
|
||||
|
||||
// For selecting webcams
|
||||
CameraSelection cam_sec;
|
||||
|
||||
// For tracking
|
||||
FaceModelParameters face_model_params;
|
||||
|
||||
FaceAnalyserManaged face_analyser;
|
||||
CLNF landmark_detector;
|
||||
GazeAnalyserManaged gaze_analyser;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Set the icon
|
||||
Uri iconUri = new Uri("logo1.ico", UriKind.RelativeOrAbsolute);
|
||||
this.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
String root = AppDomain.CurrentDomain.BaseDirectory;
|
||||
|
||||
// TODO, create a demo version of parameters
|
||||
face_model_params = new FaceModelParameters(root, true, false, false);
|
||||
face_model_params.optimiseForVideo();
|
||||
|
||||
// Initialize the face detector
|
||||
FaceDetector face_detector = new FaceDetector(face_model_params.GetHaarLocation(), face_model_params.GetMTCNNLocation());
|
||||
|
||||
// If MTCNN model not available, use HOG
|
||||
if (!face_detector.IsMTCNNLoaded())
|
||||
{
|
||||
face_model_params.SetFaceDetector(false, true, false);
|
||||
}
|
||||
|
||||
landmark_detector = new CLNF(face_model_params);
|
||||
face_analyser = new FaceAnalyserManaged(root, true, 112, true);
|
||||
gaze_analyser = new GazeAnalyserManaged();
|
||||
|
||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
||||
{
|
||||
|
||||
headPosePlot.AssocColor(0, Colors.Blue);
|
||||
headPosePlot.AssocColor(1, Colors.Red);
|
||||
headPosePlot.AssocColor(2, Colors.Green);
|
||||
|
||||
headPosePlot.AssocName(1, "Turn");
|
||||
headPosePlot.AssocName(2, "Tilt");
|
||||
headPosePlot.AssocName(0, "Up/Down");
|
||||
|
||||
headPosePlot.AssocThickness(0, 2);
|
||||
headPosePlot.AssocThickness(1, 2);
|
||||
headPosePlot.AssocThickness(2, 2);
|
||||
|
||||
gazePlot.AssocColor(0, Colors.Red);
|
||||
gazePlot.AssocColor(1, Colors.Blue);
|
||||
|
||||
gazePlot.AssocName(0, "Left-right");
|
||||
gazePlot.AssocName(1, "Up-down");
|
||||
gazePlot.AssocThickness(0, 2);
|
||||
gazePlot.AssocThickness(1, 2);
|
||||
|
||||
smilePlot.AssocColor(0, Colors.Green);
|
||||
smilePlot.AssocColor(1, Colors.Red);
|
||||
smilePlot.AssocName(0, "Smile");
|
||||
smilePlot.AssocName(1, "Frown");
|
||||
smilePlot.AssocThickness(0, 2);
|
||||
smilePlot.AssocThickness(1, 2);
|
||||
|
||||
browPlot.AssocColor(0, Colors.Green);
|
||||
browPlot.AssocColor(1, Colors.Red);
|
||||
browPlot.AssocName(0, "Raise");
|
||||
browPlot.AssocName(1, "Furrow");
|
||||
browPlot.AssocThickness(0, 2);
|
||||
browPlot.AssocThickness(1, 2);
|
||||
|
||||
eyePlot.AssocColor(0, Colors.Green);
|
||||
eyePlot.AssocColor(1, Colors.Red);
|
||||
eyePlot.AssocName(0, "Eye widen");
|
||||
eyePlot.AssocName(1, "Nose wrinkle");
|
||||
eyePlot.AssocThickness(0, 2);
|
||||
eyePlot.AssocThickness(1, 2);
|
||||
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void StopTracking()
|
||||
{
|
||||
// First complete the running of the thread
|
||||
if (processing_thread != null)
|
||||
{
|
||||
// Tell the other thread to finish
|
||||
thread_running = false;
|
||||
processing_thread.Join();
|
||||
}
|
||||
}
|
||||
|
||||
// The main function call for processing the webcam feed
|
||||
private void ProcessingLoop(SequenceReader reader)
|
||||
{
|
||||
|
||||
thread_running = true;
|
||||
|
||||
Thread.CurrentThread.IsBackground = true;
|
||||
|
||||
DateTime? startTime = CurrentTime;
|
||||
|
||||
var lastFrameTime = CurrentTime;
|
||||
|
||||
landmark_detector.Reset();
|
||||
face_analyser.Reset();
|
||||
|
||||
int frame_id = 0;
|
||||
|
||||
double old_gaze_x = 0;
|
||||
double old_gaze_y = 0;
|
||||
|
||||
double smile_cumm = 0;
|
||||
double frown_cumm = 0;
|
||||
double brow_up_cumm = 0;
|
||||
double brow_down_cumm = 0;
|
||||
double widen_cumm = 0;
|
||||
double wrinkle_cumm = 0;
|
||||
|
||||
while (thread_running)
|
||||
{
|
||||
|
||||
// Loading an image file
|
||||
RawImage frame = reader.GetNextImage();
|
||||
RawImage gray_frame = reader.GetCurrentFrameGray();
|
||||
|
||||
lastFrameTime = CurrentTime;
|
||||
processing_fps.AddFrame();
|
||||
|
||||
// The face analysis step
|
||||
bool detection_succeeding = landmark_detector.DetectLandmarksInVideo(frame, face_model_params, gray_frame);
|
||||
face_analyser.AddNextFrame(frame, landmark_detector.CalculateAllLandmarks(), detection_succeeding, true);
|
||||
gaze_analyser.AddNextFrame(landmark_detector, detection_succeeding, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy());
|
||||
|
||||
double confidence = landmark_detector.GetConfidence();
|
||||
|
||||
if (confidence < 0)
|
||||
confidence = 0;
|
||||
else if (confidence > 1)
|
||||
confidence = 1;
|
||||
|
||||
List<float> pose = new List<float>();
|
||||
|
||||
landmark_detector.GetPose(pose, reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy());
|
||||
|
||||
List<float> non_rigid_params = landmark_detector.GetNonRigidParams();
|
||||
float scale = landmark_detector.GetRigidParams()[0];
|
||||
|
||||
double time_stamp = (DateTime.Now - (DateTime)startTime).TotalMilliseconds;
|
||||
|
||||
|
||||
List<Tuple<Point, Point>> lines = null;
|
||||
List<Tuple<float, float>> landmarks = null;
|
||||
List<Tuple<float, float>> eye_landmarks = null;
|
||||
List<Tuple<Point, Point>> gaze_lines = null;
|
||||
List<bool> visibilities = null;
|
||||
|
||||
Tuple<float, float> gaze_angle = gaze_analyser.GetGazeAngle();
|
||||
|
||||
if (detection_succeeding)
|
||||
{
|
||||
landmarks = landmark_detector.CalculateVisibleLandmarks();
|
||||
eye_landmarks = landmark_detector.CalculateVisibleEyeLandmarks();
|
||||
lines = landmark_detector.CalculateBox(reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy());
|
||||
gaze_lines = gaze_analyser.CalculateGazeLines(reader.GetFx(), reader.GetFy(), reader.GetCx(), reader.GetCy());
|
||||
visibilities = landmark_detector.GetVisibilities();
|
||||
}
|
||||
|
||||
// Visualisation
|
||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
||||
{
|
||||
|
||||
var au_regs = face_analyser.GetCurrentAUsReg();
|
||||
if (au_regs.Count > 0)
|
||||
{
|
||||
double smile = (au_regs["AU12"] + au_regs["AU06"] + au_regs["AU25"]) / 13.0;
|
||||
double frown = (au_regs["AU15"] + au_regs["AU17"]) / 12.0;
|
||||
|
||||
double brow_up = (au_regs["AU01"] + au_regs["AU02"]) / 10.0;
|
||||
double brow_down = au_regs["AU04"] / 5.0;
|
||||
|
||||
double eye_widen = au_regs["AU05"] / 3.0;
|
||||
double nose_wrinkle = au_regs["AU09"] / 4.0;
|
||||
|
||||
Dictionary<int, double> smileDict = new Dictionary<int, double>();
|
||||
smileDict[0] = 0.7 * smile_cumm + 0.3 * smile;
|
||||
smileDict[1] = 0.7 * frown_cumm + 0.3 * frown;
|
||||
smilePlot.AddDataPoint(new DataPointGraph() { Time = CurrentTime, values = smileDict, Confidence = confidence });
|
||||
|
||||
Dictionary<int, double> browDict = new Dictionary<int, double>();
|
||||
browDict[0] = 0.7 * brow_up_cumm + 0.3 * brow_up;
|
||||
browDict[1] = 0.7 * brow_down_cumm + 0.3 * brow_down;
|
||||
browPlot.AddDataPoint(new DataPointGraph() { Time = CurrentTime, values = browDict, Confidence = confidence });
|
||||
|
||||
Dictionary<int, double> eyeDict = new Dictionary<int, double>();
|
||||
eyeDict[0] = 0.7 * widen_cumm + 0.3 * eye_widen;
|
||||
eyeDict[1] = 0.7 * wrinkle_cumm + 0.3 * nose_wrinkle;
|
||||
eyePlot.AddDataPoint(new DataPointGraph() { Time = CurrentTime, values = eyeDict, Confidence = confidence });
|
||||
|
||||
smile_cumm = smileDict[0];
|
||||
frown_cumm = smileDict[1];
|
||||
brow_up_cumm = browDict[0];
|
||||
brow_down_cumm = browDict[1];
|
||||
widen_cumm = eyeDict[0];
|
||||
wrinkle_cumm = eyeDict[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
// If no AUs present disable the AU visualization
|
||||
MainGrid.ColumnDefinitions[2].Width = new GridLength(0);
|
||||
eyePlot.Visibility = Visibility.Collapsed;
|
||||
browPlot.Visibility = Visibility.Collapsed;
|
||||
smilePlot.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
Dictionary<int, double> poseDict = new Dictionary<int, double>();
|
||||
poseDict[0] = -pose[3];
|
||||
poseDict[1] = pose[4];
|
||||
poseDict[2] = pose[5];
|
||||
headPosePlot.AddDataPoint(new DataPointGraph() { Time = CurrentTime, values = poseDict, Confidence = confidence });
|
||||
|
||||
Dictionary<int, double> gazeDict = new Dictionary<int, double>();
|
||||
gazeDict[0] = gaze_angle.Item1 * (180.0 / Math.PI);
|
||||
gazeDict[0] = 0.5 * old_gaze_x + 0.5 * gazeDict[0];
|
||||
gazeDict[1] = -gaze_angle.Item2 * (180.0 / Math.PI);
|
||||
gazeDict[1] = 0.5 * old_gaze_y + 0.5 * gazeDict[1];
|
||||
gazePlot.AddDataPoint(new DataPointGraph() { Time = CurrentTime, values = gazeDict, Confidence = confidence });
|
||||
|
||||
old_gaze_x = gazeDict[0];
|
||||
old_gaze_y = gazeDict[1];
|
||||
|
||||
if (latest_img == null)
|
||||
{
|
||||
latest_img = frame.CreateWriteableBitmap();
|
||||
}
|
||||
|
||||
frame.UpdateWriteableBitmap(latest_img);
|
||||
|
||||
video.Source = latest_img;
|
||||
|
||||
video.FPS = processing_fps.GetFPS();
|
||||
|
||||
// First clear the old results
|
||||
video.Clear();
|
||||
|
||||
video.Confidence.Add(confidence);
|
||||
|
||||
if(detection_succeeding)
|
||||
{
|
||||
video.FaceScale.Add(scale);
|
||||
|
||||
video.OverlayLines.Add(lines);
|
||||
|
||||
List<Point> landmark_points = new List<Point>();
|
||||
foreach (var p in landmarks)
|
||||
{
|
||||
landmark_points.Add(new Point(p.Item1, p.Item2));
|
||||
}
|
||||
|
||||
List<Point> eye_landmark_points = new List<Point>();
|
||||
foreach (var p in eye_landmarks)
|
||||
{
|
||||
eye_landmark_points.Add(new Point(p.Item1, p.Item2));
|
||||
}
|
||||
|
||||
video.OverlayPoints.Add(landmark_points);
|
||||
video.OverlayEyePoints.Add(eye_landmark_points);
|
||||
video.OverlayPointsVisibility.Add(visibilities);
|
||||
video.OverlayEyePoints.Add(eye_landmark_points);
|
||||
|
||||
video.GazeLines.Add(gaze_lines);
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
if (reset)
|
||||
{
|
||||
// TODO add
|
||||
if (resetPoint.HasValue)
|
||||
{
|
||||
//landmark_detector.Reset(resetPoint.Value.X, resetPoint.Value.Y);
|
||||
resetPoint = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO add
|
||||
//landmark_detector.Reset();
|
||||
}
|
||||
|
||||
// TODO add
|
||||
//face_analyser.Reset();
|
||||
reset = false;
|
||||
|
||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
||||
{
|
||||
headPosePlot.ClearDataPoints();
|
||||
headPosePlot.ClearDataPoints();
|
||||
gazePlot.ClearDataPoints();
|
||||
smilePlot.ClearDataPoints();
|
||||
browPlot.ClearDataPoints();
|
||||
eyePlot.ClearDataPoints();
|
||||
}));
|
||||
}
|
||||
|
||||
frame_id++;
|
||||
|
||||
|
||||
}
|
||||
reader.Close();
|
||||
latest_img = null;
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// Button handling
|
||||
// --------------------------------------------------------
|
||||
|
||||
private void openWebcamClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
StopTracking();
|
||||
|
||||
if (cam_sec == null)
|
||||
{
|
||||
cam_sec = new CameraSelection();
|
||||
}
|
||||
else
|
||||
{
|
||||
cam_sec = new CameraSelection(cam_sec.cams);
|
||||
cam_sec.Visibility = System.Windows.Visibility.Visible;
|
||||
}
|
||||
|
||||
// Set the icon
|
||||
Uri iconUri = new Uri("logo1.ico", UriKind.RelativeOrAbsolute);
|
||||
cam_sec.Icon = BitmapFrame.Create(iconUri);
|
||||
|
||||
if (!cam_sec.no_cameras_found)
|
||||
cam_sec.ShowDialog();
|
||||
|
||||
if (cam_sec.camera_selected)
|
||||
{
|
||||
|
||||
int cam_id = cam_sec.selected_camera.Item1;
|
||||
int width = cam_sec.selected_camera.Item2;
|
||||
int height = cam_sec.selected_camera.Item3;
|
||||
|
||||
SequenceReader reader = new SequenceReader(cam_id, width, height);
|
||||
|
||||
processing_thread = new Thread(() => ProcessingLoop(reader));
|
||||
processing_thread.Name = "Webcam processing";
|
||||
processing_thread.Start();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Cleanup stuff when closing the window
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (processing_thread != null)
|
||||
{
|
||||
// Stop capture and tracking
|
||||
thread_running = false;
|
||||
processing_thread.Join();
|
||||
|
||||
}
|
||||
|
||||
if (face_analyser != null)
|
||||
face_analyser.Dispose();
|
||||
if(landmark_detector != null)
|
||||
landmark_detector.Dispose();
|
||||
|
||||
}
|
||||
|
||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.R)
|
||||
{
|
||||
reset = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void video_MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var clickPos = e.GetPosition(video);
|
||||
resetPoint = new Point(clickPos.X / video.ActualWidth, clickPos.Y / video.ActualHeight);
|
||||
reset = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
159
pkg/OpenFace/gui/OpenFaceDemo/OpenFaceDemo.csproj
Normal file
159
pkg/OpenFace/gui/OpenFaceDemo/OpenFaceDemo.csproj
Normal file
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E143A2AA-312E-4DFE-B61D-9A87CCBC8E90}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>OpenFaceDemo</RootNamespace>
|
||||
<AssemblyName>OpenFaceDemo</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>logo1.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="UI_items\AxesTimeSeriesPlot.xaml.cs">
|
||||
<DependentUpon>AxesTimeSeriesPlot.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="UI_items\AxesTimeSeriesPlot.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenFaceOffline\OpenFaceOffline.csproj">
|
||||
<Project>{a4760f41-2b1f-4144-b7b2-62785affe79b}</Project>
|
||||
<Name>OpenFaceOffline</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\local\CppInerop\CppInerop.vcxproj">
|
||||
<Project>{78196985-ee54-411f-822b-5a23edf80642}</Project>
|
||||
<Name>CppInerop</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="logo1.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /I /E /Y /D "$(ProjectDir)logo1.ico" "$(ProjectDir)$(OutDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
55
pkg/OpenFace/gui/OpenFaceDemo/Properties/AssemblyInfo.cs
Normal file
55
pkg/OpenFace/gui/OpenFaceDemo/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenFaceDemo")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("OpenFaceDemo")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
71
pkg/OpenFace/gui/OpenFaceDemo/Properties/Resources.Designer.cs
generated
Normal file
71
pkg/OpenFace/gui/OpenFaceDemo/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace OpenFaceDemo.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenFaceDemo.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
pkg/OpenFace/gui/OpenFaceDemo/Properties/Resources.resx
Normal file
117
pkg/OpenFace/gui/OpenFaceDemo/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
30
pkg/OpenFace/gui/OpenFaceDemo/Properties/Settings.Designer.cs
generated
Normal file
30
pkg/OpenFace/gui/OpenFaceDemo/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace OpenFaceDemo.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,8 @@
|
||||
<UserControl x:Class="OpenFaceDemo.AxesTimeSeriesPlot"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="200" d:DesignWidth="900">
|
||||
</UserControl>
|
||||
@@ -0,0 +1,397 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace OpenFaceDemo
|
||||
{
|
||||
public class DataPointGraph
|
||||
{
|
||||
public DataPointGraph()
|
||||
{
|
||||
Time = AxesTimeSeriesPlot.CurrentTime;
|
||||
|
||||
}
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
public Dictionary<int, double> values = new Dictionary<int, double>();
|
||||
|
||||
public double Confidence { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Interaction logic for AxesTimeSeriesPlot.xaml
|
||||
/// </summary>
|
||||
public partial class AxesTimeSeriesPlot : UserControl
|
||||
{
|
||||
|
||||
#region High-Resolution Timing
|
||||
static DateTime startTime;
|
||||
static Stopwatch sw = new Stopwatch();
|
||||
|
||||
public double MinVal { get; set; }
|
||||
public double MaxVal { get; set; }
|
||||
public int NumVertGrid { get; set; }
|
||||
|
||||
public bool ShowXLabel { get; set; }
|
||||
public bool ShowYLabel { get; set; }
|
||||
|
||||
public string RangeLabel { get; set; }
|
||||
|
||||
public bool XTicks { get; set; }
|
||||
|
||||
static AxesTimeSeriesPlot()
|
||||
{
|
||||
startTime = DateTime.Now;
|
||||
sw.Start();
|
||||
|
||||
}
|
||||
public static DateTime CurrentTime
|
||||
{
|
||||
get { return startTime + sw.Elapsed; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public Orientation Orientation { get; set; }
|
||||
|
||||
public bool ShowLegend { get; set; }
|
||||
|
||||
Queue<DataPointGraph> dataPoints = new Queue<DataPointGraph>();
|
||||
TimeSpan historyLength = TimeSpan.FromSeconds(10);
|
||||
Dictionary<int, Brush> brushes = new Dictionary<int, Brush>();
|
||||
Dictionary<int, int> brush_thicknesses = new Dictionary<int, int>();
|
||||
Dictionary<int, String> line_names = new Dictionary<int, String>();
|
||||
Dictionary<int, Color> brush_colors = new Dictionary<int, Color>();
|
||||
|
||||
// Knowing where to draw things
|
||||
private double MinAxesX { get; set; }
|
||||
private double MinAxesY { get; set; }
|
||||
private double MaxAxesX { get; set; }
|
||||
private double MaxAxesY { get; set; }
|
||||
|
||||
public AxesTimeSeriesPlot()
|
||||
{
|
||||
InitializeComponent();
|
||||
ShowLegend = false;
|
||||
ClipToBounds = true;
|
||||
DispatcherTimer dt = new DispatcherTimer(TimeSpan.FromMilliseconds(20), DispatcherPriority.Background, Timer_Tick, Dispatcher);
|
||||
|
||||
MinVal = -1;
|
||||
MaxVal = 1;
|
||||
NumVertGrid = 5;
|
||||
ShowXLabel = true;
|
||||
ShowYLabel = true;
|
||||
XTicks = true;
|
||||
|
||||
}
|
||||
|
||||
private void PruneData()
|
||||
{
|
||||
lock (dataPoints)
|
||||
{
|
||||
while (dataPoints.Count > 0 && dataPoints.Peek().Time < CurrentTime - historyLength - TimeSpan.FromSeconds(2))
|
||||
dataPoints.Dequeue();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddDataPoint(DataPointGraph dp)
|
||||
{
|
||||
lock (dataPoints)
|
||||
dataPoints.Enqueue(dp);
|
||||
}
|
||||
|
||||
public void ClearDataPoints()
|
||||
{
|
||||
lock (dataPoints)
|
||||
dataPoints.Clear();
|
||||
}
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
PruneData();
|
||||
|
||||
if (this.IsVisible)
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
public void AssocColor(int seriesId, Color b)
|
||||
{
|
||||
Color bTransparent = b;
|
||||
bTransparent.A = 0;
|
||||
|
||||
GradientStopCollection gs = new GradientStopCollection();
|
||||
gs.Add(new GradientStop(bTransparent, 0));
|
||||
gs.Add(new GradientStop(b, 0.2));
|
||||
LinearGradientBrush g = new LinearGradientBrush(gs, new Point(0, 0), Orientation == System.Windows.Controls.Orientation.Horizontal ? new Point(ActualWidth, 0) : new Point(0, ActualHeight));
|
||||
g.MappingMode = BrushMappingMode.Absolute;
|
||||
g.Freeze();
|
||||
brushes[seriesId] = g;
|
||||
|
||||
brush_colors[seriesId] = b;
|
||||
}
|
||||
|
||||
public void AssocThickness(int seriesId, int thickness)
|
||||
{
|
||||
brush_thicknesses[seriesId] = thickness;
|
||||
}
|
||||
|
||||
public void AssocName(int seriesId, String name)
|
||||
{
|
||||
line_names[seriesId] = name;
|
||||
}
|
||||
|
||||
protected override void OnRender(DrawingContext dc)
|
||||
{
|
||||
base.OnRender(dc);
|
||||
|
||||
if (Orientation == System.Windows.Controls.Orientation.Horizontal)
|
||||
RenderHorizontal(dc);
|
||||
else
|
||||
RenderVertical(dc);
|
||||
|
||||
}
|
||||
|
||||
// Grid rendering
|
||||
private void RenderHorizontal(DrawingContext dc)
|
||||
{
|
||||
Pen p = new Pen(Brushes.Black, 1);
|
||||
Pen q = new Pen(Brushes.LightGray, 1);
|
||||
|
||||
double padLeft = Padding.Left;
|
||||
double padBottom = Padding.Bottom - 2 + 10;
|
||||
double padTop = Padding.Top;
|
||||
double padRight = Padding.Right;
|
||||
|
||||
// Draw horizontal gridlines
|
||||
|
||||
double step_size = (MaxVal - MinVal) / (NumVertGrid - 1.0);
|
||||
|
||||
for (int i = 0; i < NumVertGrid; i++)
|
||||
{
|
||||
double y = (int)(padTop + ((NumVertGrid - 1.0) - i) * ((ActualHeight - padBottom - padTop) / (NumVertGrid - 1.0))) - 0.5;
|
||||
|
||||
|
||||
double y_val = MinVal + i * step_size;
|
||||
|
||||
if (y_val != 0)
|
||||
dc.DrawLine(q, new Point(padLeft, y), new Point(ActualWidth - padRight, y));
|
||||
else
|
||||
dc.DrawLine(p, new Point(padLeft, y), new Point(ActualWidth - padRight, y));
|
||||
|
||||
dc.DrawLine(p, new Point(padLeft - 10, y), new Point(padLeft, y));
|
||||
|
||||
var t = FormT((MinVal + i * step_size).ToString("0.0"), 10);
|
||||
dc.DrawText(t, new Point(padLeft - t.Width - 12, y - t.Height / 2));
|
||||
|
||||
if (i == 0)
|
||||
MinAxesY = y;
|
||||
if (i == NumVertGrid - 1)
|
||||
MaxAxesY = y;
|
||||
}
|
||||
|
||||
// Draw vertical gridlines
|
||||
|
||||
for (int i = 0; i < 11; i++)
|
||||
{
|
||||
double x = (int)(padLeft + (10 - i) * ((ActualWidth - padLeft - padRight) / 10.0)) - 0.5;
|
||||
if (i < 10)
|
||||
dc.DrawLine(q, new Point(x, ActualHeight - padBottom), new Point(x, padTop));
|
||||
dc.DrawLine(p, new Point(x, ActualHeight - padBottom + 10), new Point(x, ActualHeight - padBottom));
|
||||
|
||||
if (XTicks)
|
||||
{
|
||||
var t = FormT(i.ToString(), 10);
|
||||
dc.DrawText(t, new Point(x - t.Width / 2, ActualHeight - padBottom + t.Height));
|
||||
}
|
||||
if (i == 0)
|
||||
MaxAxesX = x;
|
||||
if (i == (11 - 1))
|
||||
MinAxesX = x;
|
||||
}
|
||||
|
||||
// Draw y axis
|
||||
dc.DrawLine(p, new Point(((int)padLeft) - 0.5, padTop), new Point(((int)padLeft) - 0.5, ActualHeight - padBottom));
|
||||
|
||||
//dc.DrawLine(p, new Point(MinAxesX, MinAxesY), new Point(MaxAxesX, MaxAxesY));
|
||||
//dc.DrawLine(p, new Point(MaxAxesX, padTop), new Point(MaxAxesX, ActualHeight - padBottom));
|
||||
|
||||
// Draw x axis label
|
||||
if (ShowXLabel)
|
||||
{
|
||||
FormattedText ft = FormT("History (seconds)", 20);
|
||||
dc.DrawText(ft, new Point(padLeft + (ActualWidth - padLeft - padRight) / 2 - ft.Width / 2, ActualHeight - ft.Height));
|
||||
}
|
||||
|
||||
// Draw y axis label
|
||||
if (ShowYLabel)
|
||||
{
|
||||
FormattedText ft = FormT(RangeLabel, 20);
|
||||
dc.PushTransform(new RotateTransform(-90));
|
||||
dc.DrawText(ft, new Point(-ft.Width - ActualHeight / 2 + ft.Width / 2, 0));
|
||||
dc.Pop();
|
||||
}
|
||||
|
||||
DataPointGraph[] localPoints;
|
||||
lock (dataPoints)
|
||||
localPoints = dataPoints.ToArray();
|
||||
|
||||
var pfs = new Dictionary<int, PathFigure>();
|
||||
|
||||
for (int i = 0; i < localPoints.Length; i++)
|
||||
{
|
||||
var ptTime = localPoints[i].Time;
|
||||
var ptAge = (DateTime.Now - ptTime).TotalSeconds;
|
||||
|
||||
foreach (var kvp in localPoints[i].values)
|
||||
{
|
||||
var seriesId = kvp.Key;
|
||||
|
||||
double v = (kvp.Value - MinVal) / (MaxVal - MinVal);
|
||||
|
||||
// X starts here MinAxesX
|
||||
// X ends here MaxAxesX
|
||||
|
||||
double y = MinAxesY - (MinAxesY - MaxAxesY) * v;
|
||||
double x = MaxAxesX - (CurrentTime - localPoints[i].Time).TotalMilliseconds * ((MaxAxesX-MinAxesX) / historyLength.TotalMilliseconds);
|
||||
|
||||
// Make sure everything is within bounds
|
||||
if (x < MinAxesX)
|
||||
continue;
|
||||
|
||||
y = Math.Min(MinAxesY, Math.Max(MaxAxesY, y));
|
||||
|
||||
if (!pfs.ContainsKey(seriesId))
|
||||
{
|
||||
pfs[seriesId] = new PathFigure();
|
||||
pfs[seriesId].IsClosed = false;
|
||||
pfs[seriesId].StartPoint = new Point(x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
pfs[seriesId].Segments.Add(new LineSegment(new Point(x, y), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (var kvp in pfs)
|
||||
{
|
||||
var seriesId = kvp.Key;
|
||||
var pf = kvp.Value;
|
||||
|
||||
Brush b = brushes.ContainsKey(seriesId) ? brushes[seriesId] : Brushes.Black;
|
||||
|
||||
int thickness = brush_thicknesses.ContainsKey(seriesId) ? brush_thicknesses[seriesId] : 2;
|
||||
|
||||
PathGeometry pg = new PathGeometry(new PathFigure[] { pf });
|
||||
|
||||
Pen p2 = new Pen(b, thickness);
|
||||
|
||||
dc.DrawGeometry(null, p2, pg);
|
||||
}
|
||||
|
||||
if (ShowLegend && line_names.Count > 0)
|
||||
{
|
||||
int height_one = 18;
|
||||
int height = height_one * line_names.Count;
|
||||
|
||||
Pen p2 = new Pen(Brushes.Black, 1);
|
||||
Brush legend_b = new SolidColorBrush(Color.FromRgb(255, 255, 255));
|
||||
|
||||
dc.DrawRectangle(legend_b, p2, new Rect(MinAxesX, MaxAxesY, 100, height));
|
||||
|
||||
int i = 0;
|
||||
foreach (var key_name_pair in line_names)
|
||||
{
|
||||
var line_name = key_name_pair.Value;
|
||||
FormattedText ft = FormT(line_name, 11);
|
||||
|
||||
// Draw the text
|
||||
dc.DrawText(ft, new Point(MinAxesX + 15, MaxAxesY + 1 + height_one * i));
|
||||
// Draw example lines
|
||||
|
||||
Brush legend_c = new SolidColorBrush(brush_colors[key_name_pair.Key]);
|
||||
Pen p_line = new Pen(legend_c, brush_thicknesses[key_name_pair.Key]);
|
||||
dc.DrawLine(p_line, new Point(MinAxesX, MaxAxesY + height_one * i - 1 + height_one / 2), new Point(MinAxesX + 14, MaxAxesY -1 + height_one * i + height_one / 2));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RenderVertical(DrawingContext dc)
|
||||
{
|
||||
Pen p = new Pen(Brushes.Black, 1);
|
||||
Pen q = new Pen(Brushes.LightGray, 1);
|
||||
|
||||
double padLeft = Padding.Left;
|
||||
double padBottom = Padding.Bottom - 2 + 10;
|
||||
double padTop = Padding.Top;
|
||||
double padRight = Padding.Right;
|
||||
|
||||
// Draw horizontal gridlines
|
||||
|
||||
for (int i = 0; i < 11; i++)
|
||||
{
|
||||
double y = (int)(padTop + (10 - i) * ((ActualHeight - padBottom - padTop) / 10.0)) - 0.5;
|
||||
if (i > 0)
|
||||
dc.DrawLine(q, new Point(padLeft, y), new Point(ActualWidth - padRight, y));
|
||||
dc.DrawLine(p, new Point(padLeft - 10, y), new Point(padLeft, y));
|
||||
var t = FormT(i.ToString(), 10);
|
||||
dc.DrawText(t, new Point(padLeft - t.Width - 12, y - t.Height / 2));
|
||||
}
|
||||
|
||||
// Draw vertical gridlines
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
double x = (int)(padLeft + (4 - i) * ((ActualWidth - padLeft - padRight) / 4.0)) - 0.5;
|
||||
if (i < 10)
|
||||
dc.DrawLine(q, new Point(x, ActualHeight - padBottom), new Point(x, padTop));
|
||||
dc.DrawLine(p, new Point(x, ActualHeight - padBottom + 10), new Point(x, ActualHeight - padBottom));
|
||||
|
||||
var t = FormT(((4 - i) / 2.0 - 1).ToString("0.0"), 10);
|
||||
dc.DrawText(t, new Point(x - t.Width / 2, ActualHeight - padBottom + t.Height));
|
||||
}
|
||||
|
||||
// Draw y axis
|
||||
|
||||
dc.DrawLine(p, new Point(((int)((ActualWidth - padRight - padLeft) / 2 + padLeft)) - 0.5, padTop), new Point(((int)((ActualWidth - padRight - padLeft) / 2 + padLeft)) - 0.5, ActualHeight - padBottom));
|
||||
|
||||
// Draw x axis
|
||||
dc.DrawLine(p, new Point(padLeft, ((int)((ActualHeight - padBottom))) - 0.5), new Point(ActualWidth - padRight, ((int)((ActualHeight - padBottom))) - 0.5));
|
||||
|
||||
// Draw x axis label
|
||||
|
||||
FormattedText ft = FormT(RangeLabel, 20);
|
||||
dc.DrawText(ft, new Point(padLeft + (ActualWidth - padLeft - padRight) / 2 - ft.Width / 2, ActualHeight - ft.Height));
|
||||
|
||||
// Draw y axis label
|
||||
|
||||
ft = FormT("History (seconds)", 20);
|
||||
dc.PushTransform(new RotateTransform(-90));
|
||||
dc.DrawText(ft, new Point(-ft.Width - ActualHeight / 2 + ft.Width / 2, 0));
|
||||
}
|
||||
|
||||
private FormattedText FormT(string text, int size)
|
||||
{
|
||||
return new FormattedText(text, CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, new Typeface("Verdana"), size, Brushes.Black);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
BIN
pkg/OpenFace/gui/OpenFaceDemo/logo1.ico
Normal file
BIN
pkg/OpenFace/gui/OpenFaceDemo/logo1.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
6
pkg/OpenFace/gui/OpenFaceOffline/App.config
Normal file
6
pkg/OpenFace/gui/OpenFaceOffline/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
9
pkg/OpenFace/gui/OpenFaceOffline/App.xaml
Normal file
9
pkg/OpenFace/gui/OpenFaceOffline/App.xaml
Normal file
@@ -0,0 +1,9 @@
|
||||
<Application x:Class="OpenFaceOffline.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:OpenFaceOffline"
|
||||
StartupUri="MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
75
pkg/OpenFace/gui/OpenFaceOffline/App.xaml.cs
Normal file
75
pkg/OpenFace/gui/OpenFaceOffline/App.xaml.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016, Carnegie Mellon University and University of Cambridge,
|
||||
// all rights reserved.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED “AS IS” FOR ACADEMIC USE ONLY AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY.
|
||||
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Notwithstanding the license granted herein, Licensee acknowledges that certain components
|
||||
// of the Software may be covered by so-called “open source” software licenses (“Open Source
|
||||
// Components”), which means any software licenses approved as open source licenses by the
|
||||
// Open Source Initiative or any substantially similar licenses, including without limitation any
|
||||
// license that, as a condition of distribution of the software licensed under such license,
|
||||
// requires that the distributor make the software available in source code format. Licensor shall
|
||||
// provide a list of Open Source Components for a particular version of the Software upon
|
||||
// Licensee’s request. Licensee will comply with the applicable terms of such licenses and to
|
||||
// the extent required by the licenses covering Open Source Components, the terms of such
|
||||
// licenses will apply in lieu of the terms of this Agreement. To the extent the terms of the
|
||||
// licenses applicable to Open Source Components prohibit any of the restrictions in this
|
||||
// License Agreement with respect to such Open Source Component, such restrictions will not
|
||||
// apply to such Open Source Component. To the extent the terms of the licenses applicable to
|
||||
// Open Source Components require Licensor to make an offer to provide source code or
|
||||
// related information in connection with the Software, such offer is hereby made. Any request
|
||||
// for source code or related information should be directed to cl-face-tracker-distribution@lists.cam.ac.uk
|
||||
// Licensee acknowledges receipt of notices for the Open Source Components for the initial
|
||||
// delivery of the Software.
|
||||
|
||||
// * 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
72
pkg/OpenFace/gui/OpenFaceOffline/FpsTracker.cs
Normal file
72
pkg/OpenFace/gui/OpenFaceOffline/FpsTracker.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2017, Carnegie Mellon University and University of Cambridge,
|
||||
// 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 2.0: Facial Behavior Analysis Toolkit
|
||||
// Tadas Baltrušaitis, Amir Zadeh, Yao Chong Lim, and Louis-Philippe Morency
|
||||
// in IEEE International Conference on Automatic Face and Gesture Recognition, 2018
|
||||
//
|
||||
// Convolutional experts constrained local model for facial landmark detection.
|
||||
// A. Zadeh, T. Baltrušaitis, and Louis-Philippe Morency,
|
||||
// in Computer Vision and Pattern Recognition Workshops, 2017.
|
||||
//
|
||||
// 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-specific 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
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
public class FpsTracker
|
||||
{
|
||||
public TimeSpan HistoryLength { get; set; }
|
||||
public FpsTracker()
|
||||
{
|
||||
HistoryLength = TimeSpan.FromSeconds(2);
|
||||
}
|
||||
|
||||
private Queue<DateTime> frameTimes = new Queue<DateTime>();
|
||||
|
||||
private void DiscardOldFrames()
|
||||
{
|
||||
while (frameTimes.Count > 0 && (MainWindow.CurrentTime - frameTimes.Peek()) > HistoryLength)
|
||||
frameTimes.Dequeue();
|
||||
}
|
||||
|
||||
public void AddFrame()
|
||||
{
|
||||
frameTimes.Enqueue(MainWindow.CurrentTime);
|
||||
DiscardOldFrames();
|
||||
}
|
||||
|
||||
public double GetFPS()
|
||||
{
|
||||
DiscardOldFrames();
|
||||
|
||||
if (frameTimes.Count == 0)
|
||||
return 0;
|
||||
|
||||
return frameTimes.Count / (MainWindow.CurrentTime - frameTimes.Peek()).TotalSeconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
199
pkg/OpenFace/gui/OpenFaceOffline/MainWindow.xaml
Normal file
199
pkg/OpenFace/gui/OpenFaceOffline/MainWindow.xaml
Normal file
@@ -0,0 +1,199 @@
|
||||
<Window x:Class="OpenFaceOffline.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:Sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:OpenFaceOffline"
|
||||
xmlns:OpenFaceOffline="clr-namespace:OpenFaceOffline"
|
||||
mc:Ignorable="d"
|
||||
Title="OpenFace offline" Height="500" Width="1300" MinWidth="700" MinHeight="350" Closing="Window_Closing" WindowStartupLocation="CenterScreen">
|
||||
<Grid Name="MainGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2.1*"/>
|
||||
<ColumnDefinition Width="0.8*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1.6*"/>
|
||||
<ColumnDefinition Width="0.01*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20"/>
|
||||
<RowDefinition Height="3*" MinHeight="220"/>
|
||||
<RowDefinition Height="0.4*"/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Menu IsMainMenu="True" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5">
|
||||
<MenuItem Header="File">
|
||||
<MenuItem Header="Open video(s)" Click="videoFileOpenClick">
|
||||
</MenuItem>
|
||||
<MenuItem Header="Open image directory (as sequence)" Click="imageSequenceFileOpenClick">
|
||||
</MenuItem>
|
||||
<MenuItem Header="Open image(s)" Click="individualImageFilesOpenClick">
|
||||
</MenuItem>
|
||||
<MenuItem Header="Open image directory" Click="individualImageDirectoryOpenClick">
|
||||
</MenuItem>
|
||||
<MenuItem Header="Open webcam" Click="openWebcamClick">
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Name="RecordingMenu" Header="Record" >
|
||||
<MenuItem IsCheckable="True" Header="Record AUs" IsChecked="{Binding RecordAUs}"/>
|
||||
<MenuItem IsCheckable="True" Header="Record pose" IsChecked="{Binding RecordPose}"/>
|
||||
<MenuItem IsCheckable="True" Header="Record 2D landmarks" IsChecked="{Binding Record2DLandmarks}" />
|
||||
<MenuItem IsCheckable="True" Header="Record gaze" IsChecked="{Binding RecordGaze}"/>
|
||||
<MenuItem IsCheckable="True" Header="Record 3D landmarks" IsChecked="{Binding Record3DLandmarks}"/>
|
||||
<MenuItem IsCheckable="True" Header="Record HOG" IsChecked="{Binding RecordHOG}"/>
|
||||
<MenuItem IsCheckable="True" Header="Record model parameters" IsChecked="{Binding RecordModelParameters}" />
|
||||
<MenuItem IsCheckable="True" Header="Record aligned faces" IsChecked="{Binding RecordAligned}"/>
|
||||
<MenuItem IsCheckable="True" Header="Record tracked images/videos" IsChecked="{Binding RecordTracked}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Name="SettingsMenu" Header="Recording settings">
|
||||
<MenuItem Name="OutputLocationItem" Header="Set output location..." Click="OutputLocationItem_Click" ></MenuItem>
|
||||
<MenuItem Header="Set output image size..." Click="setOutputImageSize_Click"></MenuItem>
|
||||
<MenuItem IsCheckable="True" Header="Mask aligned image" IsChecked="{Binding MaskAligned}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Name="AUSetting" Header="OpenFace settings" >
|
||||
<MenuItem IsCheckable="True" Header="Use dynamic AU models" IsChecked="{Binding DynamicAUModels}"/>
|
||||
<MenuItem Header="Set Camera parameters..." Click="setCameraParameters_Click"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="View">
|
||||
<MenuItem IsCheckable="True" Header="Show Video" Click="VisualisationChange" IsChecked="{Binding ShowTrackedVideo}"/>
|
||||
<MenuItem IsCheckable="True" Header="Show Appearance" Click="VisualisationChange" IsChecked="{Binding ShowAppearance}"/>
|
||||
<MenuItem IsCheckable="True" Header="Show Geometry" Click="VisualisationChange" IsChecked="{Binding ShowGeometry}"/>
|
||||
<MenuItem IsCheckable="True" Header="Show AUs" Click="VisualisationChange" IsChecked="{Binding ShowAUs}"/>
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem Header="Face Detector" Name="FaceDetectorMenu">
|
||||
<MenuItem x:Name="FaceDetHaar" Header="OpenCV (Haar)" IsCheckable="true" IsChecked="{Binding DetectorHaar}" Click="ExclusiveMenuItem_Click"></MenuItem>
|
||||
<MenuItem x:Name="FaceDetHOG" Header="dlib (HOG-SVM)" IsCheckable="true" IsChecked="{Binding DetectorHOG}" Click="ExclusiveMenuItem_Click"></MenuItem>
|
||||
<MenuItem x:Name="FaceDetCNN" Header="OpenFace (MTCNN)" IsCheckable="true" IsChecked="{Binding DetectorCNN}" Click="ExclusiveMenuItem_Click"></MenuItem>
|
||||
</MenuItem>
|
||||
|
||||
<MenuItem Header="Landmark Detector" Name="LandmarkDetectorMenu">
|
||||
<MenuItem x:Name="LandmarkDetCLM" Header="CLM" IsCheckable="true" IsChecked="{Binding LandmarkDetectorCLM}" Click="ExclusiveMenuItem_Click"></MenuItem>
|
||||
<MenuItem x:Name="LandmarkDetCLNF" Header="CLNF" IsCheckable="true" IsChecked="{Binding LandmarkDetectorCLNF}" Click="ExclusiveMenuItem_Click"></MenuItem>
|
||||
<MenuItem x:Name="LandmarkDetCECLM" Header="CE-CLM" IsCheckable="true" IsChecked="{Binding LandmarkDetectorCECLM}" Click="ExclusiveMenuItem_Click"></MenuItem>
|
||||
</MenuItem>
|
||||
|
||||
</Menu>
|
||||
<Border Grid.Row="1" Grid.Column="4">
|
||||
<Label></Label>
|
||||
</Border>
|
||||
<Border Name="VideoBorder" Grid.Row="1" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Background="LightGray" Margin="5,5,0,0">
|
||||
<OpenFaceOffline:OverlayImage x:Name="overlay_image" />
|
||||
</Border>
|
||||
|
||||
<GroupBox Name="AppearanceBorder" Grid.Row="1" Grid.Column="1" BorderBrush="Black" BorderThickness="1" MinHeight="100">
|
||||
<GroupBox.Header>
|
||||
Appearance features
|
||||
</GroupBox.Header>
|
||||
<Grid HorizontalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Row="0">
|
||||
<OpenFaceOffline:SimpleImage x:Name="AlignedFace" MaxHeight="150"/>
|
||||
</Border>
|
||||
<Border Grid.Row="1">
|
||||
<OpenFaceOffline:SimpleImage x:Name="AlignedHOG" MaxHeight="150"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Name="GeometryBorder" Grid.Row="1" Grid.Column="2" BorderBrush="Black" BorderThickness="1" MinHeight="100">
|
||||
<GroupBox.Header>
|
||||
Geometry features
|
||||
</GroupBox.Header>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Vertical" Grid.Row="0" >
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<StackPanel Width="120" >
|
||||
<Label Name="headOrientationLabel" FontSize="18" HorizontalContentAlignment="Left">Orientation</Label>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="12" Width="60" HorizontalContentAlignment="Left">Turn:</Label>
|
||||
<Label Name="YawLabel" FontSize="12" MinWidth="30" HorizontalContentAlignment="Right">0°</Label>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="12" Width="60" HorizontalContentAlignment="Left">Up/down:</Label>
|
||||
<Label Name="PitchLabel" FontSize="12" Width="30" HorizontalContentAlignment="Right">0°</Label>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="12" Width="60" HorizontalContentAlignment="Left">Tilt:</Label>
|
||||
<Label Name="RollLabel" FontSize="12" Width="30" HorizontalContentAlignment="Right">0°</Label>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Line X1="0" X2="0" Y1="20" Y2="90" Width="2" Stroke="Gray"></Line>
|
||||
<StackPanel>
|
||||
<Label Name="headPoseLabel" FontSize="18" HorizontalContentAlignment="Left">Pose</Label>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="12" HorizontalContentAlignment="Left" Width="20">X:</Label>
|
||||
<Label Name="XPoseLabel" FontSize="12" HorizontalContentAlignment="Right" Width="50">0 mm</Label>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="12" HorizontalContentAlignment="Left" Width="20">Y:</Label>
|
||||
<Label Name="YPoseLabel" FontSize="12" HorizontalContentAlignment="Right" Width="50">0 mm</Label>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,0,0,0" FontSize="12" HorizontalContentAlignment="Left" Width="20">Z:</Label>
|
||||
<Label Name="ZPoseLabel" FontSize="12" HorizontalContentAlignment="Right" Width="50">0 mm</Label>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<StackPanel Width="120" >
|
||||
<Label Name="gazePanelLabel" FontSize="18" HorizontalContentAlignment="Left">Gaze</Label>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,-5,0,0" FontSize="12" Width="60" HorizontalContentAlignment="Left">Left-right:</Label>
|
||||
<Label Margin="0,-5,0,0" Name="GazeXLabel" FontSize="12" MinWidth="30" HorizontalContentAlignment="Right">0</Label>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Margin="5,-5,0,0" FontSize="12" Width="60" HorizontalContentAlignment="Left">Up/down:</Label>
|
||||
<Label Margin="0,-5,0,0" Name="GazeYLabel" FontSize="12" Width="30" HorizontalContentAlignment="Right">0</Label>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" VerticalAlignment="Center">
|
||||
<OpenFaceOffline:MultiBarGraph x:Name="nonRigidGraph" HorizontalAlignment="Center" MinHeight="100"/>
|
||||
<Label HorizontalAlignment="Center">Non rigid parameters</Label>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<GroupBox Name="ActionUnitBorder" Grid.Row="1" Grid.Column="3" BorderBrush="Black" BorderThickness="1" MinHeight="100">
|
||||
<GroupBox.Header>
|
||||
Action Units
|
||||
</GroupBox.Header>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<GroupBox>
|
||||
<GroupBox.Header>
|
||||
Classification
|
||||
</GroupBox.Header>
|
||||
<OpenFaceOffline:MultiBarGraphHorz x:Name="auClassGraph" HorizontalAlignment="Center" MinWidth="100"/>
|
||||
<!--"<StackPanel Name="AU_classes_panel">
|
||||
</StackPanel>-->
|
||||
</GroupBox>
|
||||
<GroupBox>
|
||||
<GroupBox.Header>
|
||||
Regression
|
||||
</GroupBox.Header>
|
||||
<OpenFaceOffline:MultiBarGraphHorz x:Name="auRegGraph" HorizontalAlignment="Center" MinWidth="100"/>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<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="StopButton_Click" Name="StopButton">Stop</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>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
1099
pkg/OpenFace/gui/OpenFaceOffline/MainWindow.xaml.cs
Normal file
1099
pkg/OpenFace/gui/OpenFaceOffline/MainWindow.xaml.cs
Normal file
File diff suppressed because it is too large
Load Diff
222
pkg/OpenFace/gui/OpenFaceOffline/OpenFaceOffline.csproj
Normal file
222
pkg/OpenFace/gui/OpenFaceOffline/OpenFaceOffline.csproj
Normal file
@@ -0,0 +1,222 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A4760F41-2B1F-4144-B7B2-62785AFFE79B}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>OpenFaceOffline</RootNamespace>
|
||||
<AssemblyName>OpenFaceOffline</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>logo1.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\WindowsAPICodePack-Core.1.1.2\lib\Microsoft.WindowsAPICodePack.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAPICodePack.Shell, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\WindowsAPICodePack-Shell.1.1.1\lib\Microsoft.WindowsAPICodePack.Shell.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="FpsTracker.cs" />
|
||||
<Compile Include="UI_items\BarGraph.xaml.cs">
|
||||
<DependentUpon>BarGraph.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI_items\BarGraphHorizontal.xaml.cs">
|
||||
<DependentUpon>BarGraphHorizontal.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI_items\CameraParametersEntry.xaml.cs">
|
||||
<DependentUpon>CameraParametersEntry.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI_items\CameraSelection.xaml.cs">
|
||||
<DependentUpon>CameraSelection.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI_items\MultiBarGraph.xaml.cs">
|
||||
<DependentUpon>MultiBarGraph.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI_items\MultiBarGraphHorz.xaml.cs">
|
||||
<DependentUpon>MultiBarGraphHorz.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI_items\NumberEntryWindow.xaml.cs">
|
||||
<DependentUpon>NumberEntryWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI_items\OverlayImage.xaml.cs">
|
||||
<DependentUpon>OverlayImage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI_items\SimpleImage.xaml.cs">
|
||||
<DependentUpon>SimpleImage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="UI_items\BarGraph.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI_items\BarGraphHorizontal.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI_items\CameraParametersEntry.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI_items\CameraSelection.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI_items\MultiBarGraph.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI_items\MultiBarGraphHorz.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI_items\NumberEntryWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI_items\OverlayImage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI_items\SimpleImage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\lib\local\CppInerop\CppInerop.vcxproj">
|
||||
<Project>{78196985-ee54-411f-822b-5a23edf80642}</Project>
|
||||
<Name>CppInerop</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="logo1.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /I /E /Y /D "$(ProjectDir)logo1.ico" "$(ProjectDir)$(OutDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
55
pkg/OpenFace/gui/OpenFaceOffline/Properties/AssemblyInfo.cs
Normal file
55
pkg/OpenFace/gui/OpenFaceOffline/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("OpenFaceOffline")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("OpenFaceOffline")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
71
pkg/OpenFace/gui/OpenFaceOffline/Properties/Resources.Designer.cs
generated
Normal file
71
pkg/OpenFace/gui/OpenFaceOffline/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace OpenFaceOffline.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenFaceOffline.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
pkg/OpenFace/gui/OpenFaceOffline/Properties/Resources.resx
Normal file
117
pkg/OpenFace/gui/OpenFaceOffline/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
30
pkg/OpenFace/gui/OpenFaceOffline/Properties/Settings.Designer.cs
generated
Normal file
30
pkg/OpenFace/gui/OpenFaceOffline/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace OpenFaceOffline.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
17
pkg/OpenFace/gui/OpenFaceOffline/UI_items/BarGraph.xaml
Normal file
17
pkg/OpenFace/gui/OpenFaceOffline/UI_items/BarGraph.xaml
Normal file
@@ -0,0 +1,17 @@
|
||||
<UserControl x:Class="OpenFaceOffline.BarGraph"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="100" d:DesignWidth="100">
|
||||
<StackPanel HorizontalAlignment="Center" >
|
||||
|
||||
<Border Name="barContainerPos" Background="PowderBlue" Width="32" DockPanel.Dock="Top" MinHeight="50">
|
||||
<Rectangle Name="barPos" Fill="CadetBlue" Height="0" VerticalAlignment="Bottom"/>
|
||||
</Border>
|
||||
<Border Name="barContainerNeg" Background="PowderBlue" Width="32" MinHeight="50">
|
||||
<Rectangle Name="barNeg" Fill="CadetBlue" Height="0" VerticalAlignment="Top"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
97
pkg/OpenFace/gui/OpenFaceOffline/UI_items/BarGraph.xaml.cs
Normal file
97
pkg/OpenFace/gui/OpenFaceOffline/UI_items/BarGraph.xaml.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016, Carnegie Mellon University and University of Cambridge,
|
||||
// all rights reserved.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED “AS IS” FOR ACADEMIC USE ONLY AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY.
|
||||
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Notwithstanding the license granted herein, Licensee acknowledges that certain components
|
||||
// of the Software may be covered by so-called “open source” software licenses (“Open Source
|
||||
// Components”), which means any software licenses approved as open source licenses by the
|
||||
// Open Source Initiative or any substantially similar licenses, including without limitation any
|
||||
// license that, as a condition of distribution of the software licensed under such license,
|
||||
// requires that the distributor make the software available in source code format. Licensor shall
|
||||
// provide a list of Open Source Components for a particular version of the Software upon
|
||||
// Licensee’s request. Licensee will comply with the applicable terms of such licenses and to
|
||||
// the extent required by the licenses covering Open Source Components, the terms of such
|
||||
// licenses will apply in lieu of the terms of this Agreement. To the extent the terms of the
|
||||
// licenses applicable to Open Source Components prohibit any of the restrictions in this
|
||||
// License Agreement with respect to such Open Source Component, such restrictions will not
|
||||
// apply to such Open Source Component. To the extent the terms of the licenses applicable to
|
||||
// Open Source Components require Licensor to make an offer to provide source code or
|
||||
// related information in connection with the Software, such offer is hereby made. Any request
|
||||
// for source code or related information should be directed to cl-face-tracker-distribution@lists.cam.ac.uk
|
||||
// Licensee acknowledges receipt of notices for the Open Source Components for the initial
|
||||
// delivery of the Software.
|
||||
|
||||
// * 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for BarGraph.xaml
|
||||
/// </summary>
|
||||
public partial class BarGraph : UserControl
|
||||
{
|
||||
private double targetValue = 0;
|
||||
|
||||
public BarGraph()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetValue(double value)
|
||||
{
|
||||
targetValue = 1.5 * value;
|
||||
if (targetValue > 0)
|
||||
{
|
||||
if (targetValue > barContainerPos.ActualHeight)
|
||||
targetValue = barContainerPos.ActualHeight;
|
||||
|
||||
barPos.Height = targetValue;
|
||||
barNeg.Height = 0;
|
||||
}
|
||||
if (targetValue < 0)
|
||||
{
|
||||
if (-targetValue > barContainerNeg.ActualHeight)
|
||||
targetValue = -barContainerNeg.ActualHeight;
|
||||
|
||||
barPos.Height = 0;
|
||||
barNeg.Height = -targetValue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<UserControl x:Class="OpenFaceOffline.BarGraphHorizontal"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="30" d:DesignWidth="200">
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left" >
|
||||
<Label Name="Label" FontSize="10" Width="120">AU name</Label>
|
||||
<Border Name="barContainerPos" Background="PowderBlue" Height="12" DockPanel.Dock="Left" MinWidth="60">
|
||||
<Rectangle Name="barPos" Fill="CadetBlue" Width="0" HorizontalAlignment="Left"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,100 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016, Carnegie Mellon University and University of Cambridge,
|
||||
// all rights reserved.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED “AS IS” FOR ACADEMIC USE ONLY AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY.
|
||||
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Notwithstanding the license granted herein, Licensee acknowledges that certain components
|
||||
// of the Software may be covered by so-called “open source” software licenses (“Open Source
|
||||
// Components”), which means any software licenses approved as open source licenses by the
|
||||
// Open Source Initiative or any substantially similar licenses, including without limitation any
|
||||
// license that, as a condition of distribution of the software licensed under such license,
|
||||
// requires that the distributor make the software available in source code format. Licensor shall
|
||||
// provide a list of Open Source Components for a particular version of the Software upon
|
||||
// Licensee’s request. Licensee will comply with the applicable terms of such licenses and to
|
||||
// the extent required by the licenses covering Open Source Components, the terms of such
|
||||
// licenses will apply in lieu of the terms of this Agreement. To the extent the terms of the
|
||||
// licenses applicable to Open Source Components prohibit any of the restrictions in this
|
||||
// License Agreement with respect to such Open Source Component, such restrictions will not
|
||||
// apply to such Open Source Component. To the extent the terms of the licenses applicable to
|
||||
// Open Source Components require Licensor to make an offer to provide source code or
|
||||
// related information in connection with the Software, such offer is hereby made. Any request
|
||||
// for source code or related information should be directed to cl-face-tracker-distribution@lists.cam.ac.uk
|
||||
// Licensee acknowledges receipt of notices for the Open Source Components for the initial
|
||||
// delivery of the Software.
|
||||
|
||||
// * 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for BarGraphHorizontal.xaml
|
||||
/// </summary>
|
||||
public partial class BarGraphHorizontal : UserControl
|
||||
{
|
||||
double targetValue = 0;
|
||||
|
||||
public BarGraphHorizontal(String label)
|
||||
{
|
||||
InitializeComponent();
|
||||
Label.Content = label;
|
||||
}
|
||||
|
||||
public void SetValue(double value)
|
||||
{
|
||||
targetValue = value;
|
||||
barPos.Width = targetValue * barContainerPos.ActualWidth;
|
||||
}
|
||||
|
||||
public double GetTarget()
|
||||
{
|
||||
return targetValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<Window x:Class="OpenFaceOffline.CameraParametersEntry"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Title="Input camera parameters" Height="180" Width="300" ResizeMode="NoResize">
|
||||
<Grid Background="WhiteSmoke">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.7*"/>
|
||||
<ColumnDefinition Width="0.25*"/>
|
||||
<ColumnDefinition Width="0.25*"/>
|
||||
<ColumnDefinition Width="0.25*"/>
|
||||
<ColumnDefinition Width="0.25*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
<RowDefinition Height="0.5*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" HorizontalAlignment="Left" Text="Enter camera parameters manually:" FontSize="13" VerticalAlignment="Center"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0">Focal lengths</Label>
|
||||
<Label Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center">fx=</Label>
|
||||
<TextBox Grid.Row="1" Grid.Column="2" VerticalContentAlignment="Center" IsEnabled="False" x:Name="fxTextBox" />
|
||||
<Label Grid.Row="1" Grid.Column="3" HorizontalAlignment="Right">fy=</Label>
|
||||
<TextBox Grid.Row="1" Grid.Column="4" VerticalContentAlignment="Center" IsEnabled="False" x:Name="fyTextBox" />
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0">Optical centre lengths</Label>
|
||||
<Label Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right">cx=</Label>
|
||||
<TextBox Grid.Row="2" Grid.Column="2" VerticalContentAlignment="Center" IsEnabled="False" x:Name="cxTextBox" />
|
||||
<Label Grid.Row="2" Grid.Column="3" HorizontalAlignment="Right">cy=</Label>
|
||||
<TextBox Grid.Row="2" Grid.Column="4" VerticalContentAlignment="Center" IsEnabled="False" x:Name="cyTextBox"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="5" Name="warningLabel" Visibility="Hidden" FontStyle="Italic" Foreground="Red" HorizontalAlignment="Center">Parameters have to be a non negative reals</Label>
|
||||
<Label Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4" FontSize="13">Infer parameters automatically</Label>
|
||||
<Separator Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="5" VerticalAlignment="Top"></Separator>
|
||||
<CheckBox Name="automaticCheckBox" Grid.Row="4" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="True" Click="CheckBox_Click"></CheckBox>
|
||||
<Button Grid.Row="5" Grid.Column="5" Content="OK" Click="OKButton_Click" Width="40" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
@@ -0,0 +1,219 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016, Carnegie Mellon University and University of Cambridge,
|
||||
// all rights reserved.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED “AS IS” FOR ACADEMIC USE ONLY AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY.
|
||||
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Notwithstanding the license granted herein, Licensee acknowledges that certain components
|
||||
// of the Software may be covered by so-called “open source” software licenses (“Open Source
|
||||
// Components”), which means any software licenses approved as open source licenses by the
|
||||
// Open Source Initiative or any substantially similar licenses, including without limitation any
|
||||
// license that, as a condition of distribution of the software licensed under such license,
|
||||
// requires that the distributor make the software available in source code format. Licensor shall
|
||||
// provide a list of Open Source Components for a particular version of the Software upon
|
||||
// Licensee’s request. Licensee will comply with the applicable terms of such licenses and to
|
||||
// the extent required by the licenses covering Open Source Components, the terms of such
|
||||
// licenses will apply in lieu of the terms of this Agreement. To the extent the terms of the
|
||||
// licenses applicable to Open Source Components prohibit any of the restrictions in this
|
||||
// License Agreement with respect to such Open Source Component, such restrictions will not
|
||||
// apply to such Open Source Component. To the extent the terms of the licenses applicable to
|
||||
// Open Source Components require Licensor to make an offer to provide source code or
|
||||
// related information in connection with the Software, such offer is hereby made. Any request
|
||||
// for source code or related information should be directed to cl-face-tracker-distribution@lists.cam.ac.uk
|
||||
// Licensee acknowledges receipt of notices for the Open Source Components for the initial
|
||||
// delivery of the Software.
|
||||
|
||||
// * 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for TextEntryWindow.xaml
|
||||
/// </summary>
|
||||
public partial class CameraParametersEntry : Window
|
||||
{
|
||||
public CameraParametersEntry(float fx, float fy, float cx, float cy)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.KeyDown += new KeyEventHandler(TextEntry_KeyDown);
|
||||
|
||||
if(fx == -1 || fy == -1 || cx == -1 || cy == -1)
|
||||
{
|
||||
this.fx = 500; this.fy = 500; this.cx = 320; this.cy = 240;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.fx = fx; this.fy = fy; this.cx = cx; this.cy = cy;
|
||||
automaticCheckBox.IsChecked = false;
|
||||
fxTextBox.IsEnabled = true;
|
||||
fyTextBox.IsEnabled = true;
|
||||
cxTextBox.IsEnabled = true;
|
||||
cyTextBox.IsEnabled = true;
|
||||
}
|
||||
|
||||
fxTextBox.Text = this.fx.ToString();
|
||||
fyTextBox.Text = this.fy.ToString();
|
||||
cxTextBox.Text = this.cx.ToString();
|
||||
cyTextBox.Text = this.cy.ToString();
|
||||
|
||||
fxTextBox.TextChanged += ResponseTextBox_TextChanged;
|
||||
fyTextBox.TextChanged += ResponseTextBox_TextChanged;
|
||||
cxTextBox.TextChanged += ResponseTextBox_TextChanged;
|
||||
cyTextBox.TextChanged += ResponseTextBox_TextChanged;
|
||||
|
||||
}
|
||||
|
||||
private void OKButton_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
|
||||
private void TextEntry_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
private float fx = -1, fy = -1, cx = -1, cy = -1;
|
||||
|
||||
public bool IsAutomatic
|
||||
{
|
||||
get { return automaticCheckBox.IsChecked == true; }
|
||||
}
|
||||
public float Fx
|
||||
{
|
||||
get { return automaticCheckBox.IsChecked == true ? -1 : fx; }
|
||||
}
|
||||
|
||||
public float Fy
|
||||
{
|
||||
get { return automaticCheckBox.IsChecked == true ? -1 : fy; }
|
||||
}
|
||||
public float Cx
|
||||
{
|
||||
get { return automaticCheckBox.IsChecked == true ? -1 : cx; }
|
||||
}
|
||||
public float Cy
|
||||
{
|
||||
get { return automaticCheckBox.IsChecked == true ? -1 : cy; }
|
||||
}
|
||||
|
||||
private void CheckBox_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(automaticCheckBox.IsChecked == true)
|
||||
{
|
||||
fxTextBox.IsEnabled = false;
|
||||
fyTextBox.IsEnabled = false;
|
||||
cxTextBox.IsEnabled = false;
|
||||
cyTextBox.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
fxTextBox.IsEnabled = true;
|
||||
fyTextBox.IsEnabled = true;
|
||||
cxTextBox.IsEnabled = true;
|
||||
cyTextBox.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not allow illegal characters like
|
||||
private void ResponseTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
float fx_n = (float)Double.Parse(fxTextBox.Text);
|
||||
float fy_n = (float)Double.Parse(fyTextBox.Text);
|
||||
float cx_n = (float)Double.Parse(cxTextBox.Text);
|
||||
float cy_n = (float)Double.Parse(cyTextBox.Text);
|
||||
|
||||
if (fx_n > 0 && fy_n > 0 && cx_n > 0 && cy_n > 0)
|
||||
{
|
||||
fx = fx_n;
|
||||
fy = fy_n;
|
||||
cx = cx_n;
|
||||
cy = cy_n;
|
||||
warningLabel.Visibility = System.Windows.Visibility.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
warningLabel.Visibility = System.Windows.Visibility.Visible;
|
||||
|
||||
fxTextBox.Text = fx.ToString();
|
||||
fyTextBox.Text = fy.ToString();
|
||||
cxTextBox.Text = cx.ToString();
|
||||
cyTextBox.Text = cy.ToString();
|
||||
|
||||
fxTextBox.SelectionStart = fxTextBox.Text.Length;
|
||||
fyTextBox.SelectionStart = fyTextBox.Text.Length;
|
||||
cxTextBox.SelectionStart = cxTextBox.Text.Length;
|
||||
cyTextBox.SelectionStart = cyTextBox.Text.Length;
|
||||
|
||||
}
|
||||
}
|
||||
catch (FormatException except)
|
||||
{
|
||||
fxTextBox.Text = fx.ToString();
|
||||
fyTextBox.Text = fy.ToString();
|
||||
cxTextBox.Text = cx.ToString();
|
||||
cyTextBox.Text = cy.ToString();
|
||||
|
||||
fxTextBox.SelectionStart = fxTextBox.Text.Length;
|
||||
fyTextBox.SelectionStart = fyTextBox.Text.Length;
|
||||
cxTextBox.SelectionStart = cxTextBox.Text.Length;
|
||||
cyTextBox.SelectionStart = cyTextBox.Text.Length;
|
||||
|
||||
warningLabel.Visibility = System.Windows.Visibility.Visible;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<Window x:Class="OpenFaceOffline.CameraSelection"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:OpenFaceOffline"
|
||||
mc:Ignorable="d"
|
||||
Title="Camera selection" Height="460" Width="600" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Closing="Window_Closing">
|
||||
<Grid>
|
||||
<Grid Name="camerasPanel" Visibility="Hidden">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="320" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.ColumnSpan="10" HorizontalContentAlignment="Center" FontSize="20">Choose Video Source</Label>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="0" Name="ThumbnailPanel" HorizontalAlignment="Center">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="25" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
</Grid>
|
||||
<!-- Click="OpenFile_Click" -->
|
||||
<Button Width="150" Grid.Row="3" Height="35" Grid.ColumnSpan="10" FontSize="20" Click="Button_Click">Select camera</Button>
|
||||
</Grid>
|
||||
<Grid Name="LoadingGrid" Visibility="Visible">
|
||||
<StackPanel Grid.Row="1" Name="ProgressBar" Margin="20">
|
||||
<Label HorizontalAlignment="Center" FontSize="18">Loading Webcams</Label>
|
||||
<ProgressBar Height="20" Minimum="0" Maximum="100" Name="pbStatus" IsIndeterminate="True" />
|
||||
<Label HorizontalAlignment="Center" FontSize="18">Might take some time the first time</Label>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
@@ -0,0 +1,244 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
using CppInterop;
|
||||
using System.Windows.Threading;
|
||||
using System.Threading;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CameraSelection.xaml
|
||||
/// </summary>
|
||||
public partial class CameraSelection : Window
|
||||
{
|
||||
|
||||
List<Border> sample_images;
|
||||
List<ComboBox> combo_boxes;
|
||||
|
||||
// id, width, height
|
||||
public Tuple<int, int, int> selected_camera;
|
||||
|
||||
List<List<Tuple<int, int>>> resolutions_all;
|
||||
int selected_camera_idx = -1;
|
||||
|
||||
// indicate if user clicked on camera
|
||||
public bool camera_selected = false;
|
||||
|
||||
public bool no_cameras_found = false;
|
||||
|
||||
public List<Tuple<int, String, List<Tuple<int, int>>, OpenCVWrappers.RawImage>> cams;
|
||||
|
||||
public void PopulateCameraSelections()
|
||||
{
|
||||
this.KeyDown += new KeyEventHandler(CameraSelection_KeyDown);
|
||||
|
||||
// Finding the cameras here
|
||||
if (cams == null)
|
||||
{
|
||||
String root = AppDomain.CurrentDomain.BaseDirectory;
|
||||
//cams = CameraInterop.Capture.GetCameras(root);
|
||||
cams = UtilitiesOF.SequenceReader.GetCameras(root);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
sample_images = new List<Border>();
|
||||
|
||||
// Each cameras corresponding resolutions
|
||||
resolutions_all = new List<List<Tuple<int, int>>>();
|
||||
combo_boxes = new List<ComboBox>();
|
||||
|
||||
foreach (var s in cams)
|
||||
{
|
||||
|
||||
var b = s.Item4.CreateWriteableBitmap();
|
||||
s.Item4.UpdateWriteableBitmap(b);
|
||||
b.Freeze();
|
||||
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
int idx = i;
|
||||
Image img = new Image();
|
||||
img.Source = b;
|
||||
img.Margin = new Thickness(5);
|
||||
|
||||
ColumnDefinition col_def = new ColumnDefinition();
|
||||
ThumbnailPanel.ColumnDefinitions.Add(col_def);
|
||||
|
||||
Border img_border = new Border();
|
||||
img_border.SetValue(Grid.ColumnProperty, i);
|
||||
img_border.SetValue(Grid.RowProperty, 0);
|
||||
img_border.CornerRadius = new CornerRadius(5);
|
||||
|
||||
StackPanel img_panel = new StackPanel();
|
||||
|
||||
Label camera_name_label = new Label();
|
||||
camera_name_label.Content = s.Item2;
|
||||
camera_name_label.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
|
||||
img_panel.Children.Add(camera_name_label);
|
||||
img.Height = 200;
|
||||
img_panel.Children.Add(img);
|
||||
img_border.Child = img_panel;
|
||||
|
||||
sample_images.Add(img_border);
|
||||
|
||||
ThumbnailPanel.Children.Add(img_border);
|
||||
|
||||
ComboBox resolutions = new ComboBox();
|
||||
resolutions.Width = 80;
|
||||
combo_boxes.Add(resolutions);
|
||||
|
||||
resolutions_all.Add(new List<Tuple<int, int>>());
|
||||
|
||||
foreach (var r in s.Item3)
|
||||
{
|
||||
resolutions.Items.Add(r.Item1 + "x" + r.Item2);
|
||||
resolutions_all[resolutions_all.Count - 1].Add(new Tuple<int, int>(r.Item1, r.Item2));
|
||||
|
||||
}
|
||||
|
||||
resolutions.SelectedIndex = 0;
|
||||
for (int res = 0; res < s.Item3.Count; ++res)
|
||||
{
|
||||
if (s.Item3[res].Item1 >= 640 && s.Item3[res].Item2 >= 480)
|
||||
{
|
||||
resolutions.SelectedIndex = res;
|
||||
break;
|
||||
}
|
||||
}
|
||||
resolutions.SetValue(Grid.ColumnProperty, i);
|
||||
resolutions.SetValue(Grid.RowProperty, 2);
|
||||
ThumbnailPanel.Children.Add(resolutions);
|
||||
|
||||
img_panel.MouseDown += (sender, e) =>
|
||||
{
|
||||
ChooseCamera(idx);
|
||||
};
|
||||
|
||||
resolutions.DropDownOpened += (sender, e) =>
|
||||
{
|
||||
ChooseCamera(idx);
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
i++;
|
||||
|
||||
}
|
||||
if (cams.Count > 0)
|
||||
{
|
||||
no_cameras_found = false;
|
||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
||||
{
|
||||
ChooseCamera(0);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
string messageBoxText = "No cameras detected, please connect a webcam";
|
||||
string caption = "Camera error!";
|
||||
MessageBoxButton button = MessageBoxButton.OK;
|
||||
MessageBoxImage icon = MessageBoxImage.Warning;
|
||||
MessageBox.Show(messageBoxText, caption, button, icon);
|
||||
selected_camera_idx = -1;
|
||||
no_cameras_found = true;
|
||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
||||
{
|
||||
this.Close();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
public CameraSelection()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
// We want to display the loading screen first
|
||||
Thread load_cameras = new Thread(LoadCameras);
|
||||
load_cameras.Start();
|
||||
}
|
||||
|
||||
public void LoadCameras()
|
||||
{
|
||||
Thread.CurrentThread.IsBackground = true;
|
||||
PopulateCameraSelections();
|
||||
|
||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
||||
{
|
||||
LoadingGrid.Visibility = System.Windows.Visibility.Hidden;
|
||||
camerasPanel.Visibility = System.Windows.Visibility.Visible;
|
||||
}));
|
||||
}
|
||||
|
||||
public CameraSelection(List<Tuple<int, String, List<Tuple<int, int>>, OpenCVWrappers.RawImage>> cams)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.cams = cams;
|
||||
PopulateCameraSelections();
|
||||
|
||||
Dispatcher.Invoke(DispatcherPriority.Render, new TimeSpan(0, 0, 0, 0, 200), (Action)(() =>
|
||||
{
|
||||
LoadingGrid.Visibility = System.Windows.Visibility.Hidden;
|
||||
camerasPanel.Visibility = System.Windows.Visibility.Visible;
|
||||
}));
|
||||
}
|
||||
|
||||
private void ChooseCamera(int idx)
|
||||
{
|
||||
selected_camera_idx = idx;
|
||||
|
||||
foreach (var img in sample_images)
|
||||
{
|
||||
img.BorderThickness = new Thickness(1);
|
||||
img.BorderBrush = Brushes.Gray;
|
||||
}
|
||||
sample_images[idx].BorderThickness = new Thickness(4);
|
||||
sample_images[idx].BorderBrush = Brushes.Green;
|
||||
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Select();
|
||||
}
|
||||
|
||||
private void CameraSelection_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
Select();
|
||||
}
|
||||
}
|
||||
|
||||
private void Select()
|
||||
{
|
||||
camera_selected = true;
|
||||
|
||||
int selected_res = combo_boxes[selected_camera_idx].SelectedIndex;
|
||||
Tuple<int, int> resolution_selected = resolutions_all[selected_camera_idx][selected_res];
|
||||
|
||||
selected_camera = new Tuple<int, int, int>(selected_camera_idx, resolution_selected.Item1, resolution_selected.Item2);
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Do not close it as user might want to open it again
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
pkg/OpenFace/gui/OpenFaceOffline/UI_items/MultiBarGraph.xaml
Normal file
11
pkg/OpenFace/gui/OpenFaceOffline/UI_items/MultiBarGraph.xaml
Normal file
@@ -0,0 +1,11 @@
|
||||
<UserControl x:Class="OpenFaceOffline.MultiBarGraph"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="100" d:DesignWidth="300">
|
||||
<Grid Name="barGrid">
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
120
pkg/OpenFace/gui/OpenFaceOffline/UI_items/MultiBarGraph.xaml.cs
Normal file
120
pkg/OpenFace/gui/OpenFaceOffline/UI_items/MultiBarGraph.xaml.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016, Carnegie Mellon University and University of Cambridge,
|
||||
// all rights reserved.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED “AS IS” FOR ACADEMIC USE ONLY AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY.
|
||||
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Notwithstanding the license granted herein, Licensee acknowledges that certain components
|
||||
// of the Software may be covered by so-called “open source” software licenses (“Open Source
|
||||
// Components”), which means any software licenses approved as open source licenses by the
|
||||
// Open Source Initiative or any substantially similar licenses, including without limitation any
|
||||
// license that, as a condition of distribution of the software licensed under such license,
|
||||
// requires that the distributor make the software available in source code format. Licensor shall
|
||||
// provide a list of Open Source Components for a particular version of the Software upon
|
||||
// Licensee’s request. Licensee will comply with the applicable terms of such licenses and to
|
||||
// the extent required by the licenses covering Open Source Components, the terms of such
|
||||
// licenses will apply in lieu of the terms of this Agreement. To the extent the terms of the
|
||||
// licenses applicable to Open Source Components prohibit any of the restrictions in this
|
||||
// License Agreement with respect to such Open Source Component, such restrictions will not
|
||||
// apply to such Open Source Component. To the extent the terms of the licenses applicable to
|
||||
// Open Source Components require Licensor to make an offer to provide source code or
|
||||
// related information in connection with the Software, such offer is hereby made. Any request
|
||||
// for source code or related information should be directed to cl-face-tracker-distribution@lists.cam.ac.uk
|
||||
// Licensee acknowledges receipt of notices for the Open Source Components for the initial
|
||||
// delivery of the Software.
|
||||
|
||||
// * 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MultiBarGraph.xaml
|
||||
/// </summary>
|
||||
public partial class MultiBarGraph : UserControl
|
||||
{
|
||||
|
||||
int num_bars = 0;
|
||||
List<BarGraph> graphs;
|
||||
|
||||
public MultiBarGraph()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
graphs = new List<BarGraph>();
|
||||
}
|
||||
|
||||
public void Update(List<float> data)
|
||||
{
|
||||
// Create new bars if necessary
|
||||
if (num_bars != data.Count)
|
||||
{
|
||||
graphs = new List<BarGraph>();
|
||||
num_bars = data.Count;
|
||||
barGrid.Children.Clear();
|
||||
barGrid.ColumnDefinitions.Clear();
|
||||
foreach (var value in data)
|
||||
{
|
||||
BarGraph newBar = new BarGraph();
|
||||
newBar.SetValue(value);
|
||||
graphs.Add(newBar);
|
||||
barGrid.ColumnDefinitions.Add(new ColumnDefinition());
|
||||
Grid.SetColumn(newBar, graphs.Count);
|
||||
barGrid.Children.Add(newBar);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Update the bars
|
||||
for (int i = 0; i < data.Count; ++i)
|
||||
{
|
||||
graphs[i].SetValue(data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<UserControl x:Class="OpenFaceOffline.MultiBarGraphHorz"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
|
||||
<Grid Name="barGrid">
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,150 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016, Carnegie Mellon University and University of Cambridge,
|
||||
// all rights reserved.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED “AS IS” FOR ACADEMIC USE ONLY AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY.
|
||||
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Notwithstanding the license granted herein, Licensee acknowledges that certain components
|
||||
// of the Software may be covered by so-called “open source” software licenses (“Open Source
|
||||
// Components”), which means any software licenses approved as open source licenses by the
|
||||
// Open Source Initiative or any substantially similar licenses, including without limitation any
|
||||
// license that, as a condition of distribution of the software licensed under such license,
|
||||
// requires that the distributor make the software available in source code format. Licensor shall
|
||||
// provide a list of Open Source Components for a particular version of the Software upon
|
||||
// Licensee’s request. Licensee will comply with the applicable terms of such licenses and to
|
||||
// the extent required by the licenses covering Open Source Components, the terms of such
|
||||
// licenses will apply in lieu of the terms of this Agreement. To the extent the terms of the
|
||||
// licenses applicable to Open Source Components prohibit any of the restrictions in this
|
||||
// License Agreement with respect to such Open Source Component, such restrictions will not
|
||||
// apply to such Open Source Component. To the extent the terms of the licenses applicable to
|
||||
// Open Source Components require Licensor to make an offer to provide source code or
|
||||
// related information in connection with the Software, such offer is hereby made. Any request
|
||||
// for source code or related information should be directed to cl-face-tracker-distribution@lists.cam.ac.uk
|
||||
// Licensee acknowledges receipt of notices for the Open Source Components for the initial
|
||||
// delivery of the Software.
|
||||
|
||||
// * 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MultiBarGraphHorz.xaml
|
||||
/// </summary>
|
||||
public partial class MultiBarGraphHorz : UserControl
|
||||
{
|
||||
int num_bars = 0;
|
||||
Dictionary<String, BarGraphHorizontal> graphs;
|
||||
|
||||
// Name mapping
|
||||
Dictionary<String, String> mapping;
|
||||
|
||||
public MultiBarGraphHorz()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
graphs = new Dictionary<string, BarGraphHorizontal>();
|
||||
|
||||
mapping = new Dictionary<string, string>();
|
||||
mapping["AU01"] = "Inner Brow raiser";
|
||||
mapping["AU02"] = "Outer Brow raiser";
|
||||
mapping["AU04"] = "Brow lowerer";
|
||||
mapping["AU05"] = "Upper lid raiser";
|
||||
mapping["AU06"] = "Cheek raiser";
|
||||
mapping["AU07"] = "Lid tightener";
|
||||
mapping["AU09"] = "Nose wrinkler";
|
||||
mapping["AU10"] = "Upper lip raiser";
|
||||
mapping["AU12"] = "Lip corner puller (smile)";
|
||||
mapping["AU14"] = "Dimpler";
|
||||
mapping["AU15"] = "Lip corner depressor";
|
||||
mapping["AU17"] = "Chin Raiser";
|
||||
mapping["AU20"] = "Lip Stretcher";
|
||||
mapping["AU23"] = "Lip tightener";
|
||||
mapping["AU25"] = "Lips part";
|
||||
mapping["AU26"] = "Jaw drop";
|
||||
mapping["AU28"] = "Lip suck";
|
||||
mapping["AU45"] = "Blink";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Update(Dictionary<String, double> data)
|
||||
{
|
||||
// Create new bars if necessary
|
||||
if (num_bars != data.Count)
|
||||
{
|
||||
num_bars = data.Count;
|
||||
barGrid.Children.Clear();
|
||||
barGrid.RowDefinitions.Clear();
|
||||
graphs.Clear();
|
||||
|
||||
// Make sure AUs are sorted
|
||||
var data_labels = data.Keys.ToList();
|
||||
data_labels.Sort();
|
||||
|
||||
foreach (var label in data_labels)
|
||||
{
|
||||
BarGraphHorizontal newBar = new BarGraphHorizontal(label + " - " + mapping[label]);
|
||||
newBar.SetValue(data[label]);
|
||||
barGrid.RowDefinitions.Add(new RowDefinition());
|
||||
Grid.SetRow(newBar, graphs.Count);
|
||||
graphs.Add(label, newBar);
|
||||
barGrid.Children.Add(newBar);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Update the bars
|
||||
foreach (var value in data)
|
||||
{
|
||||
graphs[value.Key].SetValue(value.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<Window x:Class="OpenFaceOffline.NumberEntryWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Title="Output image size" Height="110" Width="250" ResizeMode="NoResize">
|
||||
<Grid Background="WhiteSmoke">
|
||||
<StackPanel>
|
||||
<StackPanel FocusManager.FocusedElement="{Binding ElementName=ResponseTextBox}" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<TextBlock HorizontalAlignment="Center" Text="Output image size:" FontSize="12" VerticalAlignment="Center" Margin="0,0,10,0"/>
|
||||
<TextBox Margin="0,4,0,0" x:Name="ResponseTextBox_x" FontSize="12" Width="50" TextChanged="ResponseTextBox_TextChanged" />
|
||||
<Label>x</Label>
|
||||
<TextBox Margin="0,4,0,0" x:Name="ResponseTextBox_y" FontSize="12" Width="50" TextChanged="ResponseTextBox_TextChanged" IsEnabled="False" />
|
||||
</StackPanel>
|
||||
<Label Name="warningLabel" Visibility="Hidden" FontStyle="Italic" Foreground="Red" HorizontalAlignment="Center" VerticalAlignment="Center">Has to be a non negative integer</Label>
|
||||
<Button Content="OK" Click="OKButton_Click" Width="50" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,149 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016, Carnegie Mellon University and University of Cambridge,
|
||||
// all rights reserved.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED “AS IS” FOR ACADEMIC USE ONLY AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY.
|
||||
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Notwithstanding the license granted herein, Licensee acknowledges that certain components
|
||||
// of the Software may be covered by so-called “open source” software licenses (“Open Source
|
||||
// Components”), which means any software licenses approved as open source licenses by the
|
||||
// Open Source Initiative or any substantially similar licenses, including without limitation any
|
||||
// license that, as a condition of distribution of the software licensed under such license,
|
||||
// requires that the distributor make the software available in source code format. Licensor shall
|
||||
// provide a list of Open Source Components for a particular version of the Software upon
|
||||
// Licensee’s request. Licensee will comply with the applicable terms of such licenses and to
|
||||
// the extent required by the licenses covering Open Source Components, the terms of such
|
||||
// licenses will apply in lieu of the terms of this Agreement. To the extent the terms of the
|
||||
// licenses applicable to Open Source Components prohibit any of the restrictions in this
|
||||
// License Agreement with respect to such Open Source Component, such restrictions will not
|
||||
// apply to such Open Source Component. To the extent the terms of the licenses applicable to
|
||||
// Open Source Components require Licensor to make an offer to provide source code or
|
||||
// related information in connection with the Software, such offer is hereby made. Any request
|
||||
// for source code or related information should be directed to cl-face-tracker-distribution@lists.cam.ac.uk
|
||||
// Licensee acknowledges receipt of notices for the Open Source Components for the initial
|
||||
// delivery of the Software.
|
||||
|
||||
// * 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for TextEntryWindow.xaml
|
||||
/// </summary>
|
||||
public partial class NumberEntryWindow : Window
|
||||
{
|
||||
public NumberEntryWindow(int initValue)
|
||||
{
|
||||
InitializeComponent();
|
||||
ResponseTextBox_x.Text = initValue.ToString();
|
||||
ResponseTextBox_y.Text = initValue.ToString();
|
||||
OutputInt = initValue;
|
||||
this.KeyDown += new KeyEventHandler(TextEntry_KeyDown);
|
||||
|
||||
}
|
||||
|
||||
//private string ResponseText_x
|
||||
//{
|
||||
// get { return ResponseTextBox_x.Text; }
|
||||
// set { ResponseTextBox_x.Text = value; }
|
||||
//}
|
||||
//private string ResponseText_y
|
||||
//{
|
||||
// get { return ResponseTextBox_y.Text; }
|
||||
// set { ResponseTextBox_y.Text = value; }
|
||||
//}
|
||||
|
||||
public int OutputInt;
|
||||
|
||||
private void OKButton_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
|
||||
private void TextEntry_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
DialogResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not allow illegal characters like
|
||||
private void ResponseTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
int OutputIntNew = Int32.Parse(ResponseTextBox_x.Text);
|
||||
if(OutputIntNew > 0)
|
||||
{
|
||||
OutputInt = OutputIntNew;
|
||||
warningLabel.Visibility = System.Windows.Visibility.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
warningLabel.Visibility = System.Windows.Visibility.Visible;
|
||||
ResponseTextBox_x.Text = OutputInt.ToString();
|
||||
ResponseTextBox_x.SelectionStart = ResponseTextBox_x.Text.Length;
|
||||
|
||||
}
|
||||
}
|
||||
catch (FormatException except)
|
||||
{
|
||||
ResponseTextBox_x.Text = OutputInt.ToString();
|
||||
ResponseTextBox_x.SelectionStart = ResponseTextBox_x.Text.Length;
|
||||
warningLabel.Visibility = System.Windows.Visibility.Visible;
|
||||
}
|
||||
|
||||
ResponseTextBox_y.Text = OutputInt.ToString();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<Image x:Class="OpenFaceOffline.OverlayImage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300" >
|
||||
</Image>
|
||||
256
pkg/OpenFace/gui/OpenFaceOffline/UI_items/OverlayImage.xaml.cs
Normal file
256
pkg/OpenFace/gui/OpenFaceOffline/UI_items/OverlayImage.xaml.cs
Normal file
@@ -0,0 +1,256 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016, Carnegie Mellon University and University of Cambridge,
|
||||
// all rights reserved.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED “AS IS” FOR ACADEMIC USE ONLY AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY.
|
||||
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Notwithstanding the license granted herein, Licensee acknowledges that certain components
|
||||
// of the Software may be covered by so-called “open source” software licenses (“Open Source
|
||||
// Components”), which means any software licenses approved as open source licenses by the
|
||||
// Open Source Initiative or any substantially similar licenses, including without limitation any
|
||||
// license that, as a condition of distribution of the software licensed under such license,
|
||||
// requires that the distributor make the software available in source code format. Licensor shall
|
||||
// provide a list of Open Source Components for a particular version of the Software upon
|
||||
// Licensee’s request. Licensee will comply with the applicable terms of such licenses and to
|
||||
// the extent required by the licenses covering Open Source Components, the terms of such
|
||||
// licenses will apply in lieu of the terms of this Agreement. To the extent the terms of the
|
||||
// licenses applicable to Open Source Components prohibit any of the restrictions in this
|
||||
// License Agreement with respect to such Open Source Component, such restrictions will not
|
||||
// apply to such Open Source Component. To the extent the terms of the licenses applicable to
|
||||
// Open Source Components require Licensor to make an offer to provide source code or
|
||||
// related information in connection with the Software, such offer is hereby made. Any request
|
||||
// for source code or related information should be directed to cl-face-tracker-distribution@lists.cam.ac.uk
|
||||
// Licensee acknowledges receipt of notices for the Open Source Components for the initial
|
||||
// delivery of the Software.
|
||||
|
||||
// * 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for OverlayImage.xaml
|
||||
/// </summary>
|
||||
public partial class OverlayImage : Image
|
||||
{
|
||||
public OverlayImage()
|
||||
{
|
||||
InitializeComponent();
|
||||
OverlayLines = new List<List<Tuple<Point, Point>>>();
|
||||
OverlayPoints = new List<List<Point>>();
|
||||
OverlayPointsVisibility = new List<List<bool>>();
|
||||
OverlayEyePoints = new List<List<Point>>();
|
||||
GazeLines = new List<List<Tuple<Point, Point>>>();
|
||||
Confidence = new List<double>();
|
||||
FaceScale = new List<double>();
|
||||
|
||||
Progress = -1;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
OverlayLines.Clear();
|
||||
OverlayPoints.Clear();
|
||||
OverlayPointsVisibility.Clear();
|
||||
OverlayEyePoints.Clear();
|
||||
GazeLines.Clear();
|
||||
Confidence.Clear();
|
||||
FaceScale.Clear();
|
||||
}
|
||||
|
||||
protected override void OnRender(DrawingContext dc)
|
||||
{
|
||||
base.OnRender(dc);
|
||||
|
||||
if (OverlayLines == null)
|
||||
OverlayLines = new List<List<Tuple<Point, Point>>>();
|
||||
|
||||
if (OverlayPoints == null)
|
||||
OverlayPoints = new List<List<Point>>();
|
||||
|
||||
if (OverlayPointsVisibility == null)
|
||||
OverlayPointsVisibility = new List<List<bool>>();
|
||||
|
||||
if (OverlayEyePoints == null)
|
||||
OverlayEyePoints = new List<List<Point>>();
|
||||
|
||||
if (Source == null || !(Source is WriteableBitmap))
|
||||
return;
|
||||
|
||||
var width = ((WriteableBitmap)Source).PixelWidth;
|
||||
var height = ((WriteableBitmap)Source).PixelHeight;
|
||||
|
||||
// Go over all faces
|
||||
for (int i = 0; i < OverlayPoints.Count; i++)
|
||||
{
|
||||
|
||||
// The point and line size should be proportional to the face size and the image scaling
|
||||
double scaling_p = 0.88 * FaceScale[i] * ActualWidth / width;
|
||||
|
||||
// Low confidence leads to more transparent visualization
|
||||
double confidence = Confidence[i];
|
||||
if (confidence < 0.4)
|
||||
{
|
||||
confidence = 0.4;
|
||||
}
|
||||
|
||||
// Don't let it get too small
|
||||
if (scaling_p < 0.6)
|
||||
scaling_p = 0.6;
|
||||
|
||||
foreach (var line in OverlayLines[i])
|
||||
{
|
||||
|
||||
var p1 = new Point(ActualWidth * line.Item1.X / width, ActualHeight * line.Item1.Y / height);
|
||||
var p2 = new Point(ActualWidth * line.Item2.X / width, ActualHeight * line.Item2.Y / height);
|
||||
dc.DrawLine(new Pen(new SolidColorBrush(Color.FromArgb(200, (byte)(100 + (155 * (1 - confidence))), (byte)(100 + (155 * confidence)), 100)), 2.0 * scaling_p), p1, p2);
|
||||
}
|
||||
|
||||
foreach (var line in GazeLines[i])
|
||||
{
|
||||
|
||||
var p1 = new Point(ActualWidth * line.Item1.X / width, ActualHeight * line.Item1.Y / height);
|
||||
var p2 = new Point(ActualWidth * line.Item2.X / width, ActualHeight * line.Item2.Y / height);
|
||||
|
||||
var dir = p2 - p1;
|
||||
p2 = p1 + dir * scaling_p * 2;
|
||||
dc.DrawLine(new Pen(new SolidColorBrush(Color.FromArgb(200, (byte)(240), (byte)(30), (byte)100)), 5.0 * scaling_p), p1, p2);
|
||||
|
||||
}
|
||||
|
||||
for (int j = 0; j < OverlayPoints[i].Count; j++)
|
||||
{
|
||||
var p = OverlayPoints[i][j];
|
||||
|
||||
var q = new Point(ActualWidth * p.X / width, ActualHeight * p.Y / height);
|
||||
|
||||
if(OverlayPointsVisibility[i].Count == 0 || OverlayPointsVisibility[i][j])
|
||||
{
|
||||
dc.DrawEllipse(new SolidColorBrush(Color.FromArgb((byte)(230 * confidence), 255, 50, 50)), null, q, 2.75 * scaling_p, 3.0 * scaling_p);
|
||||
dc.DrawEllipse(new SolidColorBrush(Color.FromArgb((byte)(230 * confidence), 255, 255, 100)), null, q, 1.75 * scaling_p, 2.0 * scaling_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw fainter if landmark not visible
|
||||
dc.DrawEllipse(new SolidColorBrush(Color.FromArgb((byte)(125 * confidence), 255, 50, 50)), null, q, 2.75 * scaling_p, 3.0 * scaling_p);
|
||||
dc.DrawEllipse(new SolidColorBrush(Color.FromArgb((byte)(125 * confidence), 255, 255, 100)), null, q, 1.75 * scaling_p, 2.0 * scaling_p);
|
||||
}
|
||||
}
|
||||
|
||||
for (int id = 0; id < OverlayEyePoints[i].Count; id++)
|
||||
{
|
||||
|
||||
var q1 = new Point(ActualWidth * OverlayEyePoints[i][id].X / width, ActualHeight * OverlayEyePoints[i][id].Y / height);
|
||||
|
||||
// The the eye points can be defined for multiple faces, turn id's to be relevant to one face
|
||||
|
||||
int next_point = id + 1;
|
||||
|
||||
if (id == 7) next_point = 0;
|
||||
if (id == 19) next_point = 8;
|
||||
if (id == 27) next_point = 20;
|
||||
|
||||
if (id == 35) next_point = 28;
|
||||
if (id == 47) next_point = 36;
|
||||
if (id == 55) next_point = 48;
|
||||
|
||||
var q2 = new Point(ActualWidth * OverlayEyePoints[i][next_point].X / width, ActualHeight * OverlayEyePoints[i][next_point].Y / height);
|
||||
|
||||
if (id < 28 && (id < 8 || id > 19) || (id >= 28 &&(id - 28<8 || id - 28 >19)))
|
||||
{
|
||||
dc.DrawLine(new Pen(new SolidColorBrush(Color.FromArgb(200, (byte)(240), (byte)(30), (byte)100)), 1.5 * scaling_p), q1, q2);
|
||||
}
|
||||
else
|
||||
{
|
||||
dc.DrawLine(new Pen(new SolidColorBrush(Color.FromArgb(200, (byte)(100), (byte)(30), (byte)240)), 2.5 * scaling_p), q1, q2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only display the confidence of the last face
|
||||
double scaling = ActualWidth / 400.0;
|
||||
|
||||
int confidence_width = (int)(107.0 * scaling);
|
||||
int confidence_height = (int)(18.0 * scaling);
|
||||
|
||||
int final_id = Confidence.Count - 1;
|
||||
|
||||
Brush conf_brush = new SolidColorBrush(Color.FromRgb((byte)((1 - Confidence[final_id]) * 255), (byte)(Confidence[final_id] * 255), (byte)40));
|
||||
dc.DrawRoundedRectangle(conf_brush, new Pen(Brushes.Black, 0.5 * scaling), new Rect(ActualWidth - confidence_width - 1, 0, confidence_width, confidence_height), 3.0 * scaling, 3.0 * scaling);
|
||||
|
||||
FormattedText txt = new FormattedText("Confidence: " + (int)(100 * Confidence[final_id]) + "%", System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, new Typeface("Verdana"), 12.0 * scaling, Brushes.Black);
|
||||
dc.DrawText(txt, new Point(ActualWidth - confidence_width + 2, 2));
|
||||
|
||||
int fps_width = (int)(52.0 * scaling);
|
||||
int fps_height = (int)(18.0 * scaling);
|
||||
|
||||
dc.DrawRoundedRectangle(Brushes.WhiteSmoke, new Pen(Brushes.Black, 0.5 * scaling), new Rect(0, 0, fps_width, fps_height), 3.0 * scaling, 3.0 * scaling);
|
||||
FormattedText fps_txt = new FormattedText("FPS: " + (int)FPS, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, new Typeface("Verdana"), 12.0 * scaling, Brushes.Black);
|
||||
dc.DrawText(fps_txt, new Point(2.0 * scaling, 0));
|
||||
|
||||
old_width = width;
|
||||
old_height = height;
|
||||
|
||||
// Drawing a progress bar at the bottom of the image
|
||||
if (Progress > 0)
|
||||
{
|
||||
int progress_bar_height = (int)(6.0 * scaling);
|
||||
dc.DrawRectangle(Brushes.GreenYellow, new Pen(Brushes.Black, 0.5 * scaling), new Rect(0, ActualHeight - progress_bar_height, Progress * ActualWidth, progress_bar_height));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// To allow for visualizing multiple faces use a List of Lists
|
||||
public List<List<Tuple<Point, Point>>> OverlayLines { get; set; }
|
||||
public List<List<Tuple<Point, Point>>> GazeLines { get; set; }
|
||||
public List<List<Point>> OverlayPoints { get; set; }
|
||||
public List<List<bool>> OverlayPointsVisibility { get; set; }
|
||||
public List<List<Point>> OverlayEyePoints { get; set; }
|
||||
public List<double> FaceScale { get; set; }
|
||||
public List<double> Confidence { get; set; }
|
||||
public double FPS { get; set; }
|
||||
|
||||
// 0 to 1 indicates how much video has been processed so far
|
||||
public double Progress { get; set; }
|
||||
|
||||
int old_width;
|
||||
int old_height;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<Image x:Class="OpenFaceOffline.SimpleImage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300" >
|
||||
</Image>
|
||||
@@ -0,0 +1,94 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2016, Carnegie Mellon University and University of Cambridge,
|
||||
// all rights reserved.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED “AS IS” FOR ACADEMIC USE ONLY AND ANY EXPRESS
|
||||
// OR IMPLIED WARRANTIES WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY.
|
||||
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Notwithstanding the license granted herein, Licensee acknowledges that certain components
|
||||
// of the Software may be covered by so-called “open source” software licenses (“Open Source
|
||||
// Components”), which means any software licenses approved as open source licenses by the
|
||||
// Open Source Initiative or any substantially similar licenses, including without limitation any
|
||||
// license that, as a condition of distribution of the software licensed under such license,
|
||||
// requires that the distributor make the software available in source code format. Licensor shall
|
||||
// provide a list of Open Source Components for a particular version of the Software upon
|
||||
// Licensee’s request. Licensee will comply with the applicable terms of such licenses and to
|
||||
// the extent required by the licenses covering Open Source Components, the terms of such
|
||||
// licenses will apply in lieu of the terms of this Agreement. To the extent the terms of the
|
||||
// licenses applicable to Open Source Components prohibit any of the restrictions in this
|
||||
// License Agreement with respect to such Open Source Component, such restrictions will not
|
||||
// apply to such Open Source Component. To the extent the terms of the licenses applicable to
|
||||
// Open Source Components require Licensor to make an offer to provide source code or
|
||||
// related information in connection with the Software, such offer is hereby made. Any request
|
||||
// for source code or related information should be directed to cl-face-tracker-distribution@lists.cam.ac.uk
|
||||
// Licensee acknowledges receipt of notices for the Open Source Components for the initial
|
||||
// delivery of the Software.
|
||||
|
||||
// * 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.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for OverlayImage.xaml
|
||||
/// </summary>
|
||||
public partial class SimpleImage : Image
|
||||
{
|
||||
public SimpleImage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnRender(DrawingContext dc)
|
||||
{
|
||||
base.OnRender(dc);
|
||||
|
||||
if (Source == null || !(Source is WriteableBitmap))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
54
pkg/OpenFace/gui/OpenFaceOffline/confirm_gui_output.m
Normal file
54
pkg/OpenFace/gui/OpenFaceOffline/confirm_gui_output.m
Normal file
@@ -0,0 +1,54 @@
|
||||
addpath('../../matlab_runners/Demos');
|
||||
|
||||
root1 = "C:\Users\Tadas Baltrusaitis\Documents\OpenFace-CECLM_clean\exe\FeatureExtraction\processed";
|
||||
root2 = "C:\Users\Tadas Baltrusaitis\Documents\OpenFace-CECLM_clean\x64\Release\processed";
|
||||
|
||||
gui_files = dir(sprintf('%s/*.csv', root1));
|
||||
|
||||
for i = 1:numel(gui_files)
|
||||
|
||||
table_gui = readtable(sprintf('%s/%s', root1, gui_files(i).name));
|
||||
table_console = readtable(sprintf('%s/%s', root2, gui_files(i).name));
|
||||
|
||||
var_names = table_console.Properties.VariableNames;
|
||||
|
||||
for v =1:numel(var_names)
|
||||
|
||||
feat_gui = table_gui{:,var_names(v)};
|
||||
feat_console = table_console{:,var_names(v)};
|
||||
feat_diff = norm(abs(feat_gui - feat_console));
|
||||
if(feat_diff > 0.0001)
|
||||
fprintf('%s error - %.3f\n', var_names{v}, feat_diff);
|
||||
end
|
||||
end
|
||||
|
||||
% Compare the HOG file
|
||||
[~,name,~] = fileparts(gui_files(i).name);
|
||||
[hog_gui, valid_gui] = Read_HOG_file(sprintf('%s/%s.hog', root1, name));
|
||||
[hog_console, valid_console] = Read_HOG_file(sprintf('%s/%s.hog', root2, name));
|
||||
|
||||
feat_diff = norm(abs(hog_gui(:) - hog_console(:)));
|
||||
if(feat_diff > 0.0001)
|
||||
fprintf('HOG error - %.3f\n', feat_diff);
|
||||
end
|
||||
|
||||
feat_diff = norm(abs(valid_gui - valid_console));
|
||||
if(feat_diff > 0.0001)
|
||||
fprintf('Valid error - %.3f\n', feat_diff);
|
||||
end
|
||||
|
||||
% Compare the simalign ones
|
||||
gui_aligns = dir(sprintf('%s/%s_aligned/*.bmp', root1, name));
|
||||
console_aligns = dir(sprintf('%s/%s_aligned/*.bmp', root2, name));
|
||||
|
||||
for j=1:numel(gui_aligns)
|
||||
gui_align = imread(sprintf('%s/%s_aligned/%s', root1, name, gui_aligns(j).name));
|
||||
console_align = imread(sprintf('%s/%s_aligned/%s', root2, name, console_aligns(j).name));
|
||||
feat_diff = norm(abs(double(gui_align(:)) - double(console_align(:))));
|
||||
if(feat_diff > 0.1)
|
||||
fprintf('Aligned error - %.3f\n', feat_diff);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
BIN
pkg/OpenFace/gui/OpenFaceOffline/logo1.ico
Normal file
BIN
pkg/OpenFace/gui/OpenFaceOffline/logo1.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
5
pkg/OpenFace/gui/OpenFaceOffline/packages.config
Normal file
5
pkg/OpenFace/gui/OpenFaceOffline/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="WindowsAPICodePack-Core" version="1.1.2" targetFramework="net452" />
|
||||
<package id="WindowsAPICodePack-Shell" version="1.1.1" targetFramework="net452" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user