Adding output folder selection (trickier that it sounds due to lack of native WPF support)

This commit is contained in:
Tadas Baltrusaitis 2016-12-06 10:03:04 -05:00
parent 0befd5f756
commit 6499412259
15 changed files with 28478 additions and 12 deletions

View file

@ -30,7 +30,6 @@
</MenuItem> </MenuItem>
</MenuItem> </MenuItem>
<MenuItem Name="RecordingMenu" Header="Record"> <MenuItem Name="RecordingMenu" Header="Record">
<MenuItem Header="Set Location"></MenuItem>
<MenuItem Name="RecordAUCheckBox" IsCheckable="True" Header="Record AUs" Click="recordCheckBox_click"></MenuItem> <MenuItem Name="RecordAUCheckBox" IsCheckable="True" Header="Record AUs" Click="recordCheckBox_click"></MenuItem>
<MenuItem Name="RecordPoseCheckBox" IsCheckable="True" Header="Record pose" Click="recordCheckBox_click"></MenuItem> <MenuItem Name="RecordPoseCheckBox" IsCheckable="True" Header="Record pose" Click="recordCheckBox_click"></MenuItem>
<MenuItem Name="RecordLandmarks2DCheckBox" IsCheckable="True" Header="Record 2D landmarks" Click="recordCheckBox_click"></MenuItem> <MenuItem Name="RecordLandmarks2DCheckBox" IsCheckable="True" Header="Record 2D landmarks" Click="recordCheckBox_click"></MenuItem>
@ -42,7 +41,7 @@
<MenuItem Name="RecordTrackedVidCheckBox" IsCheckable="True" Header="Record tracked video" Click="recordCheckBox_click"></MenuItem> <MenuItem Name="RecordTrackedVidCheckBox" IsCheckable="True" Header="Record tracked video" Click="recordCheckBox_click"></MenuItem>
</MenuItem> </MenuItem>
<MenuItem Name="SettingsMenu" Header="Recording settings"> <MenuItem Name="SettingsMenu" Header="Recording settings">
<MenuItem Header="Set output location..."></MenuItem> <MenuItem Name="OutputLocationItem" Header="Set output location..." Click="OutputLocationItem_Click" ></MenuItem>
<MenuItem Header="Set output image size..." Click="setOutputImageSize_Click"></MenuItem> <MenuItem Header="Set output image size..." Click="setOutputImageSize_Click"></MenuItem>
</MenuItem> </MenuItem>
<MenuItem Header="AU settings"> <MenuItem Header="AU settings">

View file

@ -73,6 +73,7 @@ using CppInterop.LandmarkDetector;
using CameraInterop; using CameraInterop;
using FaceAnalyser_Interop; using FaceAnalyser_Interop;
using System.Globalization; using System.Globalization;
using Microsoft.WindowsAPICodePack.Dialogs;
namespace OpenFaceOffline namespace OpenFaceOffline
{ {
@ -1229,5 +1230,25 @@ namespace OpenFaceOffline
} }
} }
private void OutputLocationItem_Click(object sender, RoutedEventArgs e)
{
var dlg = new CommonOpenFileDialog();
dlg.Title = "Select output directory";
dlg.IsFolderPicker = true;
dlg.AllowNonFileSystemItems = false;
dlg.EnsureFileExists = true;
dlg.EnsurePathExists = true;
dlg.EnsureReadOnly = false;
dlg.EnsureValidNames = true;
dlg.Multiselect = false;
dlg.ShowPlacesList = true;
if (dlg.ShowDialog() == CommonFileDialogResult.Ok)
{
var folder = dlg.FileName;
record_root = folder;
}
}
} }
} }

View file

@ -58,6 +58,14 @@
<ApplicationIcon>logo1.ico</ApplicationIcon> <ApplicationIcon>logo1.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
@ -159,6 +167,9 @@
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>

View 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>

View file

@ -22,32 +22,32 @@ new_bp4d_dirs = {};
% This might take some time % This might take some time
for i = 1:numel(bp4d_dirs) for i = 1:numel(bp4d_dirs)
dirs = dir([bp4d_loc, '/', bp4d_dirs{i}, '/T*']); dirs = dir([bp4d_loc, '/', bp4d_dirs{i}, '/T*']);
tmp_dir = [bp4d_loc, '/../tmp/', bp4d_dirs{i}, '/']; tmp_dir = [bp4d_loc, '/../tmp/', bp4d_dirs{i}, '/'];
new_bp4d_dirs = cat(1, new_bp4d_dirs, tmp_dir); new_bp4d_dirs = cat(1, new_bp4d_dirs, tmp_dir);
if(~exist(tmp_dir, 'file')) if(~exist(tmp_dir, 'file'))
mkdir(tmp_dir); mkdir(tmp_dir);
% Move all images and resize them % Move all images and resize them
for d=1:numel(dirs) for d=1:numel(dirs)
in_files = dir([bp4d_loc, '/', bp4d_dirs{i}, '/', dirs(d).name, '/*.jpg']); in_files = dir([bp4d_loc, '/', bp4d_dirs{i}, '/', dirs(d).name, '/*.jpg']);
for img_ind=1:numel(in_files) for img_ind=1:numel(in_files)
img_file = [bp4d_loc, '/', bp4d_dirs{i}, '/', dirs(d).name, '/', in_files(img_ind).name]; img_file = [bp4d_loc, '/', bp4d_dirs{i}, '/', dirs(d).name, '/', in_files(img_ind).name];
img = imread(img_file); img = imread(img_file);
img = imresize(img, 0.5); img = imresize(img, 0.5);
img_out = [tmp_dir, dirs(d).name, '_', in_files(img_ind).name]; img_out = [tmp_dir, dirs(d).name, '_', in_files(img_ind).name];
imwrite(img, img_out); imwrite(img, img_out);
end end
end end
end end
end end
%% %%

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff