diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-04-08 00:44:51 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-04-08 00:44:51 +0300 |
| commit | 08dd6000fe3a218221003876a699f448835b62e4 (patch) | |
| tree | 6ef67384b80cd8176a4a2de8d09fae103a092357 /Software/Visual_Studio/MachineStudio/Modules | |
| parent | 3254beb8358745efc6988df3d52a24fcb858fcdd (diff) | |
| download | Tango-08dd6000fe3a218221003876a699f448835b62e4.tar.gz Tango-08dd6000fe3a218221003876a699f448835b62e4.zip | |
Working on TCC...
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
5 files changed, 336 insertions, 55 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs index c1f5d4f48..9f54837cb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.Core.Helpers; +using Tango.TCC.BL; namespace Tango.MachineStudio.ColorCapture.Models { @@ -67,6 +68,42 @@ namespace Tango.MachineStudio.ColorCapture.Models set { _sampleHeight = value; RaisePropertyChangedAuto(); } } + private bool _autoRelease; + public bool AutoRelease + { + get { return _autoRelease; } + set { _autoRelease = value; RaisePropertyChangedAuto(); } + } + + private double _similarityTolerance; + public double SimilarityTolerance + { + get { return _similarityTolerance; } + set { _similarityTolerance = value; RaisePropertyChangedAuto(); } + } + + private DeltaEComparisons _deltaEComparison; + public DeltaEComparisons DeltaEComparison + { + get { return _deltaEComparison; } + set { _deltaEComparison = value; RaisePropertyChangedAuto(); } + } + + private CardDetectionHistogramMethods _histogramComparison; + public CardDetectionHistogramMethods HistogramComparison + { + get { return _histogramComparison; } + set { _histogramComparison = value; RaisePropertyChangedAuto(); } + } + + private bool _enableDoubleChecking; + public bool EnableDoubleChecking + { + get { return _enableDoubleChecking; } + set { _enableDoubleChecking = value; RaisePropertyChangedAuto(); } + } + + public CaptureConfig() { Columns = 10; @@ -74,9 +111,13 @@ namespace Tango.MachineStudio.ColorCapture.Models TargetIndex = 89; SampleWidth = 300; SampleHeight = 330; + SimilarityTolerance = 50; SamplesFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "TCC Samples"); BenchmarksFile = Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "TCC", "benchmarks_rgb_lab.csv"); TemplateFile = Path.Combine(AssemblyHelper.GetCurrentAssemblyFolder(), "TCC", "template.bmp"); + DeltaEComparison = DeltaEComparisons.CieDe2000; + HistogramComparison = CardDetectionHistogramMethods.Chi_Square; + EnableDoubleChecking = true; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs new file mode 100644 index 000000000..8f3ab87c8 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.ColorCapture.Models +{ + public enum DeltaEComparisons + { + Cie1976, + Cie94, + CieDe2000, + Cmc + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj index 1679f2af9..c30520f13 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj @@ -104,6 +104,7 @@ <Compile Include="Models\BenchmarkItem.cs" /> <Compile Include="Models\CaptureConfig.cs" /> <Compile Include="Models\CaptureItem.cs" /> + <Compile Include="Models\DeltaEComparisons.cs" /> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> </Compile> @@ -150,6 +151,10 @@ <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> <Name>Tango.BL</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.CircularGauge\Tango.CircularGauge.csproj"> + <Project>{6efd5895-177b-4bbb-af52-29f4d53b3fbd}</Project> + <Name>Tango.CircularGauge</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs index 5b9d20bc4..21bb0baf0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs @@ -37,6 +37,8 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels private BitmapSource _last_original_source; private DetectionOutput _last_detection_output; private byte[] templateBitmap; + private DeltaEComparisons _lastDeltaEComparison; + private IColorSpaceComparison _deltaEComparison; public IVideoCaptureProvider VideoProvider { get; set; } @@ -124,6 +126,20 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels set { _config = value; RaisePropertyChangedAuto(); } } + private bool _isPaused; + public bool IsPaused + { + get { return _isPaused; } + set { _isPaused = value; RaisePropertyChangedAuto(); } + } + + private double _similarity; + public double Similarity + { + get { return _similarity; } + set { _similarity = value; RaisePropertyChangedAuto(); } + } + public RelayCommand ImportBenchmarksCommand { get; set; } public RelayCommand ExportBenchmarksCommand { get; set; } @@ -233,6 +249,19 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels var rgb = new Lab(MeasureL, _measureA, _measureB).ToRgb(); Color refColor = Color.FromArgb(255, (byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + CsvFile<DetectionColor> means_csv = new CsvFile<DetectionColor>(new CsvDestination(sample_folder + "\\means.csv")); + + foreach (var item in ColorDetector.EmptyColorMatrixFiducials(new DetectionInput() + { + Columns = Config.Columns, + Rows = Config.Rows, + }, _last_detection_output)) + { + means_csv.Append(item); + } + + means_csv.Dispose(); + var captureItem = new CaptureItem() { Image = rectified_file, @@ -250,6 +279,8 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels File.WriteAllText(capture_item_file, captureItem.ToJsonString()); CaptureItems.Insert(0, captureItem); + + Clear(); } catch (Exception ex) { @@ -313,13 +344,17 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels { if (SelectedVideoDevice.IsStarted) { - _abort = true; - SelectedVideoDevice.Stop(); - ProcessedColor = System.Windows.Media.Colors.Transparent; - CapturedColor = System.Windows.Media.Colors.Transparent; - Colors = null; - DetectedSource = null; - CaptureDeltaEController.Clear(); + if (!IsPaused) + { + _abort = true; + SelectedVideoDevice.Stop(); + Clear(); + } + else + { + IsPaused = false; + Clear(); + } } else { @@ -330,6 +365,16 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels } } + private void Clear() + { + ProcessedColor = System.Windows.Media.Colors.Transparent; + CapturedColor = System.Windows.Media.Colors.Transparent; + Colors = null; + DetectedSource = null; + CaptureDeltaEController.Clear(); + Similarity = 0; + } + private void OnSelectedVideoDeviceChanged(CaptureDevice previousDevice, CaptureDevice newDevice) { if (previousDevice != null) @@ -346,7 +391,7 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels private async void OnVideoFrameReceived(object sender, Video.DirectShow.EventArguments.FrameReceivedEventArgs args) { - if (_abort) return; + if (_abort || IsPaused) return; if (_cardDetector.CanDetect) { @@ -359,10 +404,23 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels DesiredBitmapHeight = Config.SampleHeight, TargetIndex = Config.TargetIndex, TemplateBitmapBytes = templateBitmap, + SimilarityTolerance = Config.SimilarityTolerance, + HistogramMethod = Config.HistogramComparison, + EnableDoubleChecking = Config.EnableDoubleChecking, }); + if (result.Similarity > 0) + { + Similarity = result.Similarity; + } + if (result.IsDetected) { + if (Config.AutoRelease) + { + IsPaused = true; + } + _last_original_source = result.Source; _last_detection_output = result.ColorDetectionOutput; @@ -386,7 +444,7 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels //calculate delta E. Lab measureLab = new Lab(MeasureL, MeasureA, MeasureB); - DeltaE = measureLab.Compare(new Rgb(ProcessedColor.R, ProcessedColor.G, ProcessedColor.B), new CieDe2000Comparison()); + DeltaE = measureLab.Compare(new Rgb(ProcessedColor.R, ProcessedColor.G, ProcessedColor.B), GetDeltaEComparison()); }); } } @@ -432,5 +490,32 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels SettingsManager.Default.GetOrCreate<ColorCaptureSettings>().Config = Config; SettingsManager.Default.Save(); } + + private IColorSpaceComparison GetDeltaEComparison() + { + if (_lastDeltaEComparison != Config.DeltaEComparison || _deltaEComparison == null) + { + _lastDeltaEComparison = Config.DeltaEComparison; + + if (Config.DeltaEComparison == DeltaEComparisons.Cie1976) + { + _deltaEComparison = new Cie1976Comparison(); + } + else if (Config.DeltaEComparison == DeltaEComparisons.Cie94) + { + _deltaEComparison = new Cie94Comparison(); + } + else if (Config.DeltaEComparison == DeltaEComparisons.CieDe2000) + { + _deltaEComparison = new CieDe2000Comparison(); + } + else if (Config.DeltaEComparison == DeltaEComparisons.Cmc) + { + _deltaEComparison = new CmcComparison(); + } + } + + return _deltaEComparison; + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml index c1555fbcd..d6f4890d7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml @@ -1,9 +1,11 @@ <UserControl x:Class="Tango.MachineStudio.ColorCapture.Views.MainView" 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:models="clr-namespace:Tango.MachineStudio.ColorCapture.Models" + xmlns:gauge="clr-namespace:Tango.CircularGauge;assembly=Tango.CircularGauge" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.ColorCapture.ViewModels" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" @@ -11,6 +13,7 @@ xmlns:componentsX="clr-namespace:RealTimeGraphX.WPF.Components;assembly=RealTimeGraphX.WPF" xmlns:controls="clr-namespace:Tango.MachineStudio.ColorCapture.Controls" xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:tcc="clr-namespace:Tango.TCC.BL;assembly=Tango.TCC.BL" xmlns:realtimeGraphX="clr-namespace:RealTimeGraphX.WPF.Surfaces;assembly=RealTimeGraphX.WPF" xmlns:global="clr-namespace:Tango.MachineStudio.ColorCapture" xmlns:local="clr-namespace:Tango.MachineStudio.ColorCapture.Views" @@ -18,14 +21,26 @@ d:DesignHeight="1080" d:DesignWidth="1920" Background="#202020" Foreground="#BBBBBB" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> <UserControl.Resources> - <SolidColorBrush x:Key="Foreground" Color="#BBBBBB" /> - <SolidColorBrush x:Key="Background" Color="#202020" /> - <SolidColorBrush x:Key="Accent" Color="{StaticResource AccentColor}" /> - <SolidColorBrush x:Key="Red" Color="#FF5F5F" /> - <SolidColorBrush x:Key="Green" Color="#68E46E" /> - <SolidColorBrush x:Key="Blue" Color="#64B8EC" /> - <SolidColorBrush x:Key="BorderBrush" Color="#3E3E3E" /> - <SolidColorBrush x:Key="LightBackground" Color="#303030" /> + + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml"> + </ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml"> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + + <SolidColorBrush x:Key="Foreground" Color="#BBBBBB" /> + <SolidColorBrush x:Key="Background" Color="#202020" /> + <SolidColorBrush x:Key="Accent" Color="#03A9F4" /> + <SolidColorBrush x:Key="Red" Color="#FF5F5F" /> + <SolidColorBrush x:Key="Green" Color="#68E46E" /> + <SolidColorBrush x:Key="Blue" Color="#64B8EC" /> + <SolidColorBrush x:Key="BorderBrush" Color="#3E3E3E" /> + <SolidColorBrush x:Key="LightBackground" Color="#303030" /> + + <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> + </ResourceDictionary> </UserControl.Resources> <Grid Margin="20"> @@ -62,6 +77,7 @@ <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="800"/> + <ColumnDefinition Width="200"/> <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions> @@ -82,6 +98,22 @@ <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="False"> <Setter Property="Kind" Value="Play"></Setter> </DataTrigger> + <DataTrigger Binding="{Binding IsPaused}" Value="True"> + <Setter Property="Kind" Value="Play"></Setter> + <DataTrigger.EnterActions> + <BeginStoryboard x:Name="blink"> + <Storyboard> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01" RepeatBehavior="Forever"> + <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="0" /> + <DiscreteDoubleKeyFrame KeyTime="00:00:0.5" Value="1" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <RemoveStoryboard BeginStoryboardName="blink" /> + </DataTrigger.ExitActions> + </DataTrigger> </Style.Triggers> </Style> </materialDesign:PackIcon.Style> @@ -91,27 +123,94 @@ </DockPanel> <Border Padding="2" Background="{StaticResource LightBackground}" BorderThickness="1" BorderBrush="{StaticResource Accent}" Margin="0 10 0 0"> - <Image Source="{Binding SelectedVideoDevice.VideoSource,Mode=OneWay,IsAsync=True}" Stretch="Fill"> - <Image.Style> - <Style TargetType="Image"> - <Setter Property="Visibility" Value="Hidden"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="True"> - <Setter Property="Visibility" Value="Visible"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="False"> - <Setter Property="Visibility" Value="Hidden"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </Image.Style> - </Image> + <Grid> + <Image Source="{Binding SelectedVideoDevice.VideoSource,Mode=OneWay,IsAsync=True}" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"> + <Image.Style> + <Style TargetType="Image"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="False"> + <Setter Property="Visibility" Value="Hidden"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + + <Border HorizontalAlignment="Center" VerticalAlignment="Bottom" Padding="40 10" CornerRadius="20" Margin="20" Visibility="{Binding SelectedVideoDevice.IsStarted,Converter={StaticResource BoolToVisConverter}}"> + <Border.Background> + <SolidColorBrush Color="Black" Opacity="0.5"></SolidColorBrush> + </Border.Background> + + <TextBlock Foreground="{StaticResource Accent}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Text" Value="Scanning..."></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsPaused}" Value="True"> + <Setter Property="Text" Value="Card captured. Press 'play 'to resume scanning."></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </Border> + </Grid> </Border> </DockPanel> </Grid> </Border> - <Grid Grid.Column="1" Margin="200 60 0 0" HorizontalAlignment="Left"> + <Grid Grid.Column="1"> + <DockPanel Margin="20 130 20 20" VerticalAlignment="Top"> + <TextBlock DockPanel.Dock="Top" FontSize="14" HorizontalAlignment="Center" FontWeight="SemiBold" Foreground="{StaticResource Accent}">Similarity</TextBlock> + <Viewbox Margin="0 10 0 0"> + <gauge:CircularGaugeControl + Radius="150" + ScaleRadius="110" + ScaleStartAngle="120" + ScaleSweepAngle="300" + PointerLength="85" + PointerCapRadius="35" + MinValue="0" + MaxValue="100" + MajorDivisionsCount="10" + MinorDivisionsCount="5" + CurrentValue="{Binding Similarity}" + ImageSize="40,50" + RangeIndicatorThickness="8" + RangeIndicatorRadius="120" + RangeIndicatorLightRadius="10" + RangeIndicatorLightOffset="80" + ScaleLabelRadius="90" + ScaleLabelSize="40,20" + ScaleLabelFontSize="18" + DialTextFontSize="18" + ScaleLabelForeground="LightGray" + MajorTickSize="10,3" + MinorTickSize="3,1" + MajorTickColor="LightGray" + MinorTickColor="LightGray" + ImageOffset="-50" + GaugeBackgroundColor="Black" + PointerThickness ="16" + OptimalRangeStartValue="{Binding Config.SimilarityTolerance}" + OptimalRangeEndValue="100" + OptimalRangeColor="#04CB04" + AboveOptimalRangeColor="#FF5151" + DialTextOffset="40" + DialTextColor="Black" + > + + </gauge:CircularGaugeControl> + </Viewbox> + </DockPanel> + </Grid> + + <Grid Grid.Column="2" Margin="0 60 0 0" HorizontalAlignment="Left"> <Grid.RowDefinitions> <RowDefinition Height="180*"/> <RowDefinition Height="130*"/> @@ -206,6 +305,7 @@ <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="800"/> + <ColumnDefinition Width="200"/> <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions> <DockPanel> @@ -265,7 +365,7 @@ <DataGridTemplateColumn Header="#" Width="50"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> - <Image Width="30" Height="30" Source="{Binding Image}"></Image> + <Image Width="30" Height="30" Source="{Binding Image}" Stretch="Fill"></Image> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> @@ -312,10 +412,17 @@ </sharedControls:DoubleClickDataGrid> </DockPanel> - <DockPanel Grid.Column="1" Margin="120 0 60 0"> - <TextBlock HorizontalAlignment="Center" Margin="0 0 0 0" DockPanel.Dock="Top" Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold" FontSize="16">Delta E Distance</TextBlock> + <DockPanel Grid.Column="2" Margin="0 0 60 0"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" DockPanel.Dock="Top"> + <TextBlock Foreground="{StaticResource AccentColorBrush}" FontWeight="SemiBold" FontSize="16">Delta E Distance</TextBlock> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0"> + <Run>(</Run> + <Run Text="{Binding Config.DeltaEComparison}"></Run> + <Run>)</Run> + </TextBlock> + </StackPanel> <Grid> - <Border Margin="0 10 0 0" Padding="20 0 20 0" BorderThickness="1" BorderBrush="#202020"> + <Border Margin="0 10 0 0" Padding="0 0 15 0" BorderThickness="1" BorderBrush="#202020"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="55"/> @@ -358,7 +465,7 @@ </DataTemplate> </TabItem.HeaderTemplate> - <Grid Margin="0 20 20 20"> + <Grid Margin="0 40 20 20"> <DockPanel> <StackPanel Margin="0 10 0 0" HorizontalAlignment="Right" Orientation="Horizontal" DockPanel.Dock="Bottom"> <Button Command="{Binding ImportBenchmarksCommand}" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="45" MinWidth="150">IMPORT</Button> @@ -454,23 +561,27 @@ </DataTemplate> </TabItem.HeaderTemplate> - <Border Width="700" Margin="0 100 0 0" VerticalAlignment="Center" TextElement.FontSize="20" Background="{StaticResource LightBackground}" Padding="20" CornerRadius="10"> + <Border Width="750" Margin="0 0 0 0" VerticalAlignment="Center" TextElement.FontSize="16" Background="{StaticResource LightBackground}" Padding="20" CornerRadius="10" BorderThickness="1" BorderBrush="{StaticResource Accent}"> <Grid> <Grid.ColumnDefinitions> - <ColumnDefinition Width="144*"/> - <ColumnDefinition Width="293*"/> - <ColumnDefinition Width="163*"/> + <ColumnDefinition Width="196*"/> + <ColumnDefinition Width="331*"/> + <ColumnDefinition Width="193*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> - <RowDefinition Height="50"/> - <RowDefinition Height="50"/> - <RowDefinition Height="50"/> - <RowDefinition Height="50"/> - <RowDefinition Height="50"/> - <RowDefinition Height="50"/> - <RowDefinition Height="50"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> <RowDefinition Height="200"/> - <RowDefinition Height="705*"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> + <RowDefinition Height="40"/> </Grid.RowDefinitions> <TextBlock VerticalAlignment="Bottom" Height="27">Columns</TextBlock> @@ -490,19 +601,42 @@ <TextBlock Grid.Row="5" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Samples Folder</TextBlock> <TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Config.SamplesFolder}" IsReadOnly="True" FontSize="10"></TextBox> - <Button Command="{Binding SelectSamplesFolderCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="5" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1">SELECT</Button> + <Button Command="{Binding SelectSamplesFolderCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="5" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="31">SELECT</Button> <TextBlock Grid.Row="6" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Benchmarks</TextBlock> <TextBox Grid.Row="6" Grid.Column="1" Text="{Binding Config.BenchmarksFile}" IsReadOnly="True" FontSize="10"></TextBox> - <Button Command="{Binding SelectBenchmarksFileCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="6" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1">SELECT</Button> + <Button Command="{Binding SelectBenchmarksFileCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="6" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="31">SELECT</Button> <TextBlock Grid.Row="7" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Template</TextBlock> <DockPanel Grid.Row="7" Grid.Column="1"> <TextBox Margin="0 10 0 0" DockPanel.Dock="Bottom" Text="{Binding Config.TemplateFile}" IsReadOnly="True" FontSize="10"></TextBox> - <Image Width="150" Height="150" Source="{Binding Config.TemplateFile}" Stretch="Fill"></Image> + <DockPanel> + <TextBlock DockPanel.Dock="Right" FontSize="12" VerticalAlignment="Center" HorizontalAlignment="Right"> + <Run Text="{Binding ElementName=img,Path=Source.Width,Mode=OneWay,StringFormat='0'}"></Run> <Run>x</Run> <Run Text="{Binding ElementName=img,Path=Source.Height,Mode=OneWay,StringFormat='0'}"></Run> + </TextBlock> + <Border Width="150" Height="150" BorderThickness="1" BorderBrush="{StaticResource Accent}" Padding="1"> + <Image x:Name="img" Source="{Binding Config.TemplateFile}" Stretch="Fill"></Image> + </Border> + </DockPanel> </DockPanel> - <Button Command="{Binding SelectTemplateFileCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="7" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1">SELECT</Button> + <Button Command="{Binding SelectTemplateFileCommand}" Width="120" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="7" Grid.Column="2" Style="{StaticResource MaterialDesignFlatButton}" BorderBrush="{StaticResource Accent}" BorderThickness="1" Height="31">SELECT</Button> + + <TextBlock Grid.Row="8" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Similarity Tolerance</TextBlock> + <Slider Minimum="0" Maximum="100" Value="{Binding Config.SimilarityTolerance}" TickFrequency="1" IsSnapToTickEnabled="True" Grid.Row="8" Grid.Column="1" VerticalAlignment="Bottom" Height="18"></Slider> + <TextBlock Grid.Row="8" Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Text="{Binding Config.SimilarityTolerance}"></TextBlock> + + <TextBlock Grid.Row="9" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Auto Release</TextBlock> + <ToggleButton IsChecked="{Binding Config.AutoRelease}" Grid.Row="9" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"></ToggleButton> + + <TextBlock Grid.Row="10" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Delta E Standard</TextBlock> + <ComboBox Grid.Row="10" Grid.Column="1" Margin="0 8 0 0" ItemsSource="{Binding Source={x:Type models:DeltaEComparisons},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Config.DeltaEComparison}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox> + + <TextBlock Grid.Row="11" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Histogram Similarity</TextBlock> + <ComboBox Grid.Row="11" Grid.Column="1" Margin="0 8 0 0" ItemsSource="{Binding Source={x:Type tcc:CardDetectionHistogramMethods},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Config.HistogramComparison}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox> + + <TextBlock Grid.Row="12" Grid.Column="0" VerticalAlignment="Bottom" Height="27">Double Checking</TextBlock> + <ToggleButton IsChecked="{Binding Config.EnableDoubleChecking}" Grid.Row="12" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom"></ToggleButton> </Grid> </Border> </TabItem> |
