aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2019-04-08 00:44:51 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2019-04-08 00:44:51 +0300
commit08dd6000fe3a218221003876a699f448835b62e4 (patch)
tree6ef67384b80cd8176a4a2de8d09fae103a092357 /Software/Visual_Studio
parent3254beb8358745efc6988df3d52a24fcb858fcdd (diff)
downloadTango-08dd6000fe3a218221003876a699f448835b62e4.tar.gz
Tango-08dd6000fe3a218221003876a699f448835b62e4.zip
Working on TCC...
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnkbin1445 -> 1530 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnkbin1516 -> 1581 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnkbin1292 -> 1529 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnkbin1310 -> 1547 bytes
-rw-r--r--Software/Visual_Studio/Build/Shortcuts/Transport Router.lnkbin1341 -> 1578 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/CaptureConfig.cs41
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/DeltaEComparisons.cs16
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj5
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs103
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml226
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs17
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml2
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/App.config45
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs6
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionHistogramMethods.cs17
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionResult.cs2
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs13
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/ColorDetector.cs21
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Device.cs16
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs42
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs18
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj17
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionRequest.cs2
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs2
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionRequest.cs13
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs32
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginRequest.cs20
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginResponse.cs15
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.BL/packages.config1
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/ArucoUtils.cpp1
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cppbin6636 -> 10128 bytes
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.hbin1104 -> 1240 bytes
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h3
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionResult.h2
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.CardDetector/Tango.TCC.CardDetector.vcxproj6
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.OpenCV.DLL/Tango.TCC.OpenCV.DLL.csproj36
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs27
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs48
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj6
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config43
-rw-r--r--Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config1
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs2
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs19
43 files changed, 804 insertions, 82 deletions
diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
index cd539235a..09f542836 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
index 691007139..ff9db3779 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
index 8264c04b0..86ac8562d 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
index 00f4779a7..b0950b3d7 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Stubs Execution GUI.lnk
Binary files differ
diff --git a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
index c82e7cff2..5285bbf10 100644
--- a/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
+++ b/Software/Visual_Studio/Build/Shortcuts/Transport Router.lnk
Binary files differ
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>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs
index 3aa9d4c88..f710cf082 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Video/DefaultVideoCaptureProvider.cs
@@ -28,16 +28,17 @@ namespace Tango.MachineStudio.Common.Video
var availableDevices = CaptureDevice.GetAvailableCaptureDevices();
- for (int i = 0; i < 3; i++)
+ for (int i = 0; i < availableDevices.Count; i++)
{
- if (i > availableDevices.Count - 1)
- {
- AvailableCaptureDevices.Add(new CaptureDevice() { Device = null });
- }
- else
+ AvailableCaptureDevices.Add(new CaptureDevice() { Device = availableDevices[i] });
+ }
+
+ while (AvailableCaptureDevices.Count < 3)
+ {
+ AvailableCaptureDevices.Add(new CaptureDevice()
{
- AvailableCaptureDevices.Add(new CaptureDevice() { Device = availableDevices[i] });
- }
+ Device = null,
+ });
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
index 9794404b9..7c4e960ec 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml
@@ -124,7 +124,7 @@
</StackPanel>
<StackPanel Margin="20 0 0 0" Orientation="Horizontal" VerticalAlignment="Center">
- <ToggleButton IsChecked="{Binding EnableKeepAlive}" VerticalAlignment="Center" ToolTip="Upload hardware configuration after connection is successful"></ToggleButton>
+ <ToggleButton IsChecked="{Binding EnableKeepAlive}" VerticalAlignment="Center" ToolTip="Allow a keep alive mechanism to improve lost connection detection"></ToggleButton>
<TextBlock VerticalAlignment="Center" FontSize="10" Margin="5 0 0 0">Keep Alive</TextBlock>
</StackPanel>
</StackPanel>
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/App.config b/Software/Visual_Studio/TCC/Tango.TCC.BL/App.config
new file mode 100644
index 000000000..8f1b939fd
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/App.config
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs
index bd8b394ad..e63e0bdd1 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionConfig.cs
@@ -16,6 +16,9 @@ namespace Tango.TCC.BL
public int Rows { get; set; }
public int TargetIndex { get; set; }
public byte[] TemplateBitmapBytes { get; set; }
+ public double SimilarityTolerance { get; set; }
+ public CardDetectionHistogramMethods HistogramMethod { get; set; }
+ public bool EnableDoubleChecking { get; set; }
public CardDetectionConfig()
{
@@ -24,7 +27,10 @@ namespace Tango.TCC.BL
Columns = 10;
Rows = 11;
TargetIndex = 89;
+ SimilarityTolerance = 20;
Benchmarks = new List<DetectionBenchmark>();
+ HistogramMethod = CardDetectionHistogramMethods.Intersection;
+ EnableDoubleChecking = true;
}
}
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionHistogramMethods.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionHistogramMethods.cs
new file mode 100644
index 000000000..26125ea3f
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionHistogramMethods.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.TCC.BL
+{
+ public enum CardDetectionHistogramMethods
+ {
+ Correlation = 0,
+ Chi_Square = 1,
+ Intersection = 2,
+ BhattacharyyaDistance = 3,
+ None = 4,
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionResult.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionResult.cs
index 0cf7f3d67..117317dcd 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionResult.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetectionResult.cs
@@ -14,5 +14,7 @@ namespace Tango.TCC.BL
public BitmapSource Source { get; set; }
public BitmapSource DetectedBitmap { get; set; }
public DetectionOutput ColorDetectionOutput { get; set; }
+ public double Similarity { get; set; }
+ public String Barcode { get; set; }
}
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs
index c0f827e1b..50bcceeba 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs
@@ -17,6 +17,7 @@ namespace Tango.TCC.BL
private ColorDetector _colorDetector;
private static byte[] _defaultTemplate;
private static List<DetectionBenchmark> _defaultBenchmarks;
+ private byte[] _sourceBitmapBytes;
private bool _canDetect;
public bool CanDetect
@@ -54,14 +55,22 @@ namespace Tango.TCC.BL
CardDetectionResult detectionResult = new CardDetectionResult();
detectionResult.Source = cloned;
+ _sourceBitmapBytes = cloned.ToBytes(PixelFormats.Rgb24);
+
Tango.TCC.CardDetector.CardDetection detector = new TCC.CardDetector.CardDetection();
- var result = detector.Detect(cloned.ToBytes(PixelFormats.Rgb24), new TCC.CardDetector.CardDetectionConfig()
+ var result = detector.Detect(_sourceBitmapBytes, new TCC.CardDetector.CardDetectionConfig()
{
DesiredBitmapWidth = config.DesiredBitmapWidth,
DesiredBitmapHeight = config.DesiredBitmapHeight,
- TemplateBitmap = config.TemplateBitmapBytes != null ? config.TemplateBitmapBytes : _defaultTemplate.ToArray(),
+ TemplateBitmap = config.TemplateBitmapBytes != null ? config.TemplateBitmapBytes : _defaultTemplate,
+ SimilarityTolerance = config.SimilarityTolerance,
+ HistogramMethod = (int)config.HistogramMethod,
+ EnableDoubleChecking = config.EnableDoubleChecking,
});
+ detectionResult.Similarity = result.Similarity;
+ detectionResult.Barcode = result.Barcode;
+
if (result.IsDetected)
{
detectionResult.IsDetected = true;
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/ColorDetector.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/ColorDetector.cs
index a41124c42..d8a7f9dc7 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/ColorDetector.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/ColorDetector.cs
@@ -148,6 +148,25 @@ namespace Tango.TCC.BL
return bmp;
}
+ public static IEnumerable<DetectionColor> EmptyColorMatrixFiducials(DetectionInput detectionInput, DetectionOutput detectionOutput)
+ {
+ List<DetectionColor> colors = new List<DetectionColor>();
+
+ for (int i = 0; i < detectionOutput.ColorMatrix.Count; i++)
+ {
+ if (!IsDetectedColorFiducial(i + 1, detectionInput.Columns, detectionInput.Rows))
+ {
+ colors.Add(detectionOutput.ColorMatrix[i]);
+ }
+ else
+ {
+ colors.Add(new DetectionColor());
+ }
+ }
+
+ return colors;
+ }
+
public static bool IsDetectedColorFiducial(int index, int columns, int rows)
{
return index == 1 || index == columns || index == columns * rows || index == (columns * rows) - columns + 1;
@@ -159,7 +178,7 @@ namespace Tango.TCC.BL
return benchmarks;
}
- public static void SaveBenchmarks(String file,IEnumerable<DetectionBenchmark> benchmarks)
+ public static void SaveBenchmarks(String file, IEnumerable<DetectionBenchmark> benchmarks)
{
CsvFile<DetectionBenchmark> csvFile = new CsvFile<DetectionBenchmark>(new CsvDestination(file));
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Device.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Device.cs
new file mode 100644
index 000000000..8283ef332
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Device.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.TCC.BL.Entities
+{
+ [Table("DEVICES")]
+ public class Device : TCCEntityBase
+ {
+ [Column("DEVICE_ID")]
+ public String DeviceID { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs
new file mode 100644
index 000000000..5770bf1d0
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.TCC.BL.Entities
+{
+ public class TCCContext : DbContext
+ {
+ private DataSource _dataSource;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TCCContext"/> class.
+ /// </summary>
+ public TCCContext()
+ {
+
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TCCContext"/> class.
+ /// </summary>
+ /// <param name="dataSource">The data source.</param>
+ public TCCContext(DataSource dataSource) : base(dataSource.ToConnection(), true)
+ {
+ _dataSource = dataSource;
+ Database.SetInitializer<TCCContext>(null);
+ Configuration.LazyLoadingEnabled = false;
+ }
+
+ /// <summary>
+ /// Gets or sets the devices.
+ /// </summary>
+ public DbSet<Device> Devices
+ {
+ get; set;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs
new file mode 100644
index 000000000..9e3778a3c
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.TCC.BL.Entities
+{
+ public class TCCEntityBase
+ {
+ [Column("ID")]
+ public int ID { get; set; }
+
+ [Column("GUID")]
+ public String Guid { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj b/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj
index bb12c02cc..7d677edc3 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj
@@ -31,12 +31,19 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
<Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
@@ -55,15 +62,24 @@
<Compile Include="CardDetectionResult.cs" />
<Compile Include="CardDetector.cs" />
<Compile Include="ColorDetector.cs" />
+ <Compile Include="CardDetectionHistogramMethods.cs" />
+ <Compile Include="Entities\Device.cs" />
+ <Compile Include="Entities\TCCContext.cs" />
+ <Compile Include="Entities\TCCEntityBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Web\ColorDetectionRequest.cs" />
<Compile Include="Web\ColorDetectionResponse.cs" />
+ <Compile Include="Web\DefinitionRequest.cs" />
+ <Compile Include="Web\DefinitionResponse.cs" />
+ <Compile Include="Web\LoginRequest.cs" />
+ <Compile Include="Web\LoginResponse.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Benchmarks\benchmarks_rgb_lab.csv">
<Link>TCC\benchmarks_rgb_lab.csv</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
@@ -110,6 +126,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionRequest.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionRequest.cs
index 2ee202acc..ba411dda6 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionRequest.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionRequest.cs
@@ -9,7 +9,7 @@ namespace Tango.TCC.BL.Web
{
public class ColorDetectionRequest : WebRequestMessage
{
- public int Number { get; set; }
public String BitmapString { get; set; }
+ public String Barcode { get; set; }
}
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs
index a58d1a414..afc53b26c 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs
@@ -10,8 +10,6 @@ namespace Tango.TCC.BL.Web
{
public class ColorDetectionResponse : WebResponseMessage
{
- public int Number { get; set; }
-
public DetectionColor RawColor { get; set; }
public DetectionColor ProcessedColor { get; set; }
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionRequest.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionRequest.cs
new file mode 100644
index 000000000..6082fedaf
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionRequest.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.TCC.BL.Web
+{
+ public class DefinitionRequest : WebRequestMessage
+ {
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs
new file mode 100644
index 000000000..d6161e738
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/DefinitionResponse.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.TCC.BL.Web
+{
+ public class DefinitionResponse : WebResponseMessage
+ {
+ public String TemplateString { get; set; }
+ public int SampleWidth { get; set; }
+ public int SampleHeight { get; set; }
+ public int CameraWidth { get; set; }
+ public int CameraHeight { get; set; }
+ public double SimilarityTolerance { get; set; }
+ public CardDetectionHistogramMethods HistogramMethod { get; set; }
+ public bool EnableDoubleChecking { get; set; }
+
+ public DefinitionResponse()
+ {
+ SampleWidth = 300;
+ SampleHeight = 330;
+ CameraWidth = 1280;
+ CameraHeight = 720;
+ SimilarityTolerance = 50;
+ HistogramMethod = CardDetectionHistogramMethods.Chi_Square;
+ EnableDoubleChecking = true;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginRequest.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginRequest.cs
new file mode 100644
index 000000000..5f3a66daa
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginRequest.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+
+namespace Tango.TCC.BL.Web
+{
+ public class LoginRequest : WebRequestMessage
+ {
+ public String Email { get; set; }
+ public String Password { get; set; }
+ public String AppID { get; set; }
+
+ public String Device { get; set; }
+ public String DeviceID { get; set; }
+ public String OSVersion { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginResponse.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginResponse.cs
new file mode 100644
index 000000000..054e18ce1
--- /dev/null
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/LoginResponse.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Transport.Web;
+using Tango.Web.Security;
+
+namespace Tango.TCC.BL.Web
+{
+ public class LoginResponse : WebTokenResponse
+ {
+
+ }
+}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/packages.config b/Software/Visual_Studio/TCC/Tango.TCC.BL/packages.config
index fa3c0d58d..08b9dd27c 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.BL/packages.config
+++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/packages.config
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
+ <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
<package id="Google.Protobuf" version="3.4.1" targetFramework="net461" />
</packages> \ No newline at end of file
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/ArucoUtils.cpp b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/ArucoUtils.cpp
index 52721368a..91b38c55c 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/ArucoUtils.cpp
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/ArucoUtils.cpp
@@ -24,6 +24,7 @@ vector<Point> ArucoUtils::getArcusVertices(Mat image)
aruco::DetectorParameters* params = new aruco::DetectorParameters();
params->cornerRefinementMethod = aruco::CORNER_REFINE_SUBPIX;
params->perspectiveRemovePixelPerCell = 50;
+ params->minDistanceToBorder = 0;
aruco::detectMarkers(image, dictionary, corners, ids, &(*params));
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp
index 3f3415e48..174d2d549 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.cpp
Binary files differ
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.h b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.h
index 05b137a7b..0f1a87d45 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.h
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetection.h
Binary files differ
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h
index a6e104b53..86d44ca34 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionConfig.h
@@ -14,6 +14,9 @@ namespace Tango
property double DesiredBitmapWidth;
property double DesiredBitmapHeight;
property cli::array<Byte>^ TemplateBitmap;
+ property double SimilarityTolerance;
+ property int HistogramMethod;
+ property bool EnableDoubleChecking;
};
}
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionResult.h b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionResult.h
index 68507e1f4..ad15b6ae4 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionResult.h
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/CardDetectionResult.h
@@ -14,6 +14,8 @@ namespace Tango
CardDetectionResult();
property bool IsDetected;
property cli::array<Byte>^ DetectedBitmap;
+ property double Similarity;
+ property System::String^ Barcode;
};
}
}
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/Tango.TCC.CardDetector.vcxproj b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/Tango.TCC.CardDetector.vcxproj
index 2ee6e7a2d..11af99029 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/Tango.TCC.CardDetector.vcxproj
+++ b/Software/Visual_Studio/TCC/Tango.TCC.CardDetector/Tango.TCC.CardDetector.vcxproj
@@ -94,11 +94,11 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(ProjectDir)..\Tango.TCC.OpenCV;$(SolutionDir)..\External_Repositories\OpenCV;$(SolutionDir)..\External_Repositories\OpenCV\opencv_contrib-master\modules\aruco\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>$(ProjectDir)..\Tango.TCC.OpenCV;$(SolutionDir)..\External_Repositories\OpenCV;$(SolutionDir)..\External_Repositories\OpenCV\opencv_contrib-master\modules\aruco\include;$(SolutionDir)..\External_Repositories\ZBar\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
- <AdditionalDependencies>opencv_calib3d330d.lib;opencv_core330d.lib;opencv_features2d330d.lib;opencv_flann330d.lib;opencv_highgui330d.lib;opencv_imgproc330d.lib;opencv_imgcodecs330d.lib;opencv_ml330d.lib;opencv_objdetect330d.lib;opencv_photo330d.lib;opencv_stitching330d.lib;opencv_superres330d.lib;opencv_video330d.lib;opencv_videostab330d.lib;opencv_videoio330d.lib;opencv_aruco330d.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>$(SolutionDir)..\External_Repositories\OpenCV\bin;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>opencv_calib3d330d.lib;opencv_core330d.lib;opencv_features2d330d.lib;opencv_flann330d.lib;opencv_highgui330d.lib;opencv_imgproc330d.lib;opencv_imgcodecs330d.lib;opencv_ml330d.lib;opencv_objdetect330d.lib;opencv_photo330d.lib;opencv_stitching330d.lib;opencv_superres330d.lib;opencv_video330d.lib;opencv_videostab330d.lib;opencv_videoio330d.lib;opencv_aruco330d.lib;libzbar-0.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>$(SolutionDir)..\External_Repositories\OpenCV\bin;$(SolutionDir)..\External_Repositories\ZBar\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.OpenCV.DLL/Tango.TCC.OpenCV.DLL.csproj b/Software/Visual_Studio/TCC/Tango.TCC.OpenCV.DLL/Tango.TCC.OpenCV.DLL.csproj
index 1356ad9b7..415d51a6e 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.OpenCV.DLL/Tango.TCC.OpenCV.DLL.csproj
+++ b/Software/Visual_Studio/TCC/Tango.TCC.OpenCV.DLL/Tango.TCC.OpenCV.DLL.csproj
@@ -161,6 +161,42 @@
<Link>ZedGraph.resources.dll</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libiconv-2.dll">
+ <Link>libiconv-2.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libjpeg-7.dll">
+ <Link>libjpeg-7.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libMagickCore-2.dll">
+ <Link>libMagickCore-2.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libMagickWand-2.dll">
+ <Link>libMagickWand-2.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libpng12-0.dll">
+ <Link>libpng12-0.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libtiff-3.dll">
+ <Link>libtiff-3.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libxml2-2.dll">
+ <Link>libxml2-2.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\libzbar-0.dll">
+ <Link>libzbar-0.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="..\..\..\External_Repositories\ZBar\bin\zlib1.dll">
+ <Link>zlib1.dll</Link>
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs
index ade4f72f3..b3a4d4808 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs
@@ -15,25 +15,44 @@ namespace Tango.TCC.Service.Controllers
public class ColorDetectionController : TangoController
{
[HttpPost]
+ public LoginResponse Login(LoginRequest request)
+ {
+ return new LoginResponse();
+ }
+
+ [HttpPost]
+ public DefinitionResponse GetDefinition(DefinitionRequest request)
+ {
+ return new DefinitionResponse()
+ {
+ TemplateString = TCCServiceConfig.TEMPLATE_STRING,
+ SampleWidth = TCCServiceConfig.SAMPLE_WIDTH,
+ SampleHeight = TCCServiceConfig.SAMPLE_HEIGHT,
+ CameraWidth = TCCServiceConfig.CAMERA_WIDTH,
+ CameraHeight = TCCServiceConfig.CAMERA_HEIGHT,
+ HistogramMethod = TCCServiceConfig.HISTOGRAM_METHOD,
+ SimilarityTolerance = TCCServiceConfig.SIMILARITY_TOLERANCE,
+ EnableDoubleChecking = TCCServiceConfig.ENABLE_DOUBLE_CHECKING,
+ };
+ }
+
+ [HttpPost]
public ColorDetectionResponse Detect(ColorDetectionRequest request)
{
- byte[] bitmapBytes = System.Convert.FromBase64String(request.BitmapString);
+ byte[] bitmapBytes = Convert.FromBase64String(request.BitmapString);
using (ColorDetector detector = new ColorDetector())
{
var output = detector.Detect(new DetectionInput()
{
- Number = request.Number,
Bitmap = ByteString.CopyFrom(bitmapBytes),
Columns = TCCServiceConfig.CARD_COLUMNS,
Rows = TCCServiceConfig.CARD_ROWS,
TargetIndex = TCCServiceConfig.CARD_TARGET_INDEX,
- DebugMode = true,
});
return new ColorDetectionResponse()
{
- Number = (int)output.Number,
ProcessedColor = output.ProcessedColor,
RawColor = output.RawColor,
};
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs
index 8cacbe636..8bedaefe9 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs
@@ -3,12 +3,15 @@ using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
+using Tango.TCC.BL;
using Tango.Web;
namespace Tango.TCC.Service
{
public class TCCServiceConfig : WebConfig
{
+ public static String JWT_TOKEN_SECRET => ConfigurationManager.AppSettings[nameof(JWT_TOKEN_SECRET)].ToString();
+
/// <summary>
/// Gets the number of card columns.
/// </summary>
@@ -23,5 +26,50 @@ namespace Tango.TCC.Service
/// Gets the card target index (hole).
/// </summary>
public static int CARD_TARGET_INDEX => int.Parse(ConfigurationManager.AppSettings[nameof(CARD_TARGET_INDEX)].ToString());
+
+ /// <summary>
+ /// Gets the template image base64 string.
+ /// </summary>
+ public static String TEMPLATE_STRING => ConfigurationManager.AppSettings[nameof(TEMPLATE_STRING)].ToString();
+
+ /// <summary>
+ /// Gets the desired width of the sample image.
+ /// </summary>
+ public static int SAMPLE_WIDTH => int.Parse(ConfigurationManager.AppSettings[nameof(SAMPLE_WIDTH)].ToString());
+
+ /// <summary>
+ /// Gets the desired height of the sample image.
+ /// </summary>
+ public static int SAMPLE_HEIGHT => int.Parse(ConfigurationManager.AppSettings[nameof(SAMPLE_HEIGHT)].ToString());
+
+ /// <summary>
+ /// Gets the recommended camera resolution width.
+ /// </summary>
+ public static int CAMERA_WIDTH => int.Parse(ConfigurationManager.AppSettings[nameof(CAMERA_WIDTH)].ToString());
+
+ /// <summary>
+ /// Gets the recommended camera resolution height.
+ /// </summary>
+ public static int CAMERA_HEIGHT => int.Parse(ConfigurationManager.AppSettings[nameof(CAMERA_HEIGHT)].ToString());
+
+ /// <summary>
+ /// Gets the histogram similarity tolerance.
+ /// </summary>
+ public static double SIMILARITY_TOLERANCE => int.Parse(ConfigurationManager.AppSettings[nameof(SIMILARITY_TOLERANCE)].ToString());
+
+ /// <summary>
+ /// Gets the histogram comparison method.
+ /// </summary>
+ public static CardDetectionHistogramMethods HISTOGRAM_METHOD => (CardDetectionHistogramMethods)Enum.Parse(typeof(CardDetectionHistogramMethods), ConfigurationManager.AppSettings[nameof(HISTOGRAM_METHOD)].ToString());
+
+ /// <summary>
+ /// Gets a value indicating whether to perform a double check of the card arucos.
+ /// </summary>
+ public static bool ENABLE_DOUBLE_CHECKING => bool.Parse(ConfigurationManager.AppSettings[nameof(ENABLE_DOUBLE_CHECKING)].ToString());
+
+ /// <summary>
+ /// Gets the mobile application ID.
+ /// </summary>
+ public static String APP_ID => ConfigurationManager.AppSettings[nameof(APP_ID)].ToString();
}
} \ No newline at end of file
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj b/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj
index 43a493f8e..78e13e6d4 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj
@@ -46,6 +46,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
<Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config b/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config
index 754e88280..d2433dc9b 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config
@@ -4,15 +4,43 @@
https://go.microsoft.com/fwlink/?LinkId=301879
-->
<configuration>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
+
+ <add key="DB_ADDRESS" value="twine.database.windows.net" />
+ <add key="DB_USER_NAME" value="Roy" />
+ <add key="DB_PASSWORD" value="Aa123456" />
+ <add key="DB_CATALOG" value="TCC_DEV" />
+ <add key="STORAGE_ACCOUNT" value="DefaultEndpointsProtocol=https;AccountName=tangostorage;AccountKey=S4z/D+Yg6mwMis+bs/VpcDLA9yE1iZaYq23shQlRIi2KmM9E7JY8zdZjeAPOPdG3gONHoNDEpsgH6D4cqQ/bsA==;EndpointSuffix=core.windows.net" />
+ <add key="TENANT_ID" value="2ebd63a5-bc2f-41dc-9066-4409ed5e5dd4" />
+ <add key="CLIENT_ID" value="ec612854-7abc-457b-808a-5d0c5ba80c57" />
+ <add key="APP_SECRET" value="54)019A7wv+#86l*PQcQWYKu%fd4Dv!@G=VhCiDI5rD+H4BTH" />
+ <add key="DEPLOYMENT_SLOT" value="DEV" />
+ <add key="ENVIRONMENT_GROUP" value="Tango DEV" />
+ <add key="JWT_TOKEN_SECRET" value="GQDstcKsx0NHjLOuXOYg5MbeJ1yT0u1iwDVTwine" />
+
<add key="CARD_COLUMNS" value="10" />
<add key="CARD_ROWS" value="11" />
<add key="CARD_TARGET_INDEX" value="99" />
+ <add key="TEMPLATE_STRING" value="PUT TEMPLATE STRING HERE!" />
+ <add key="SAMPLE_WIDTH" value="300" />
+ <add key="SAMPLE_HEIGHT" value="330" />
+ <add key="CAMERA_WIDTH" value="1280" />
+ <add key="CAMERA_HEIGHT" value="720" />
+ <add key="SIMILARITY_TOLERANCE" value="50" />
+ <add key="HISTOGRAM_METHOD" value="Chi_Square" />
+ <add key="ENABLE_DOUBLE_CHECKING" value="True" />
+ <add key="APP_ID" value="Tdf793i4ughsiduf8749509237885ehgfdlkghlT" />
+
+
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
@@ -34,12 +62,13 @@
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
- <handlers>
+ <handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
- </handlers></system.webServer>
+ </handlers>
+ </system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
@@ -49,7 +78,7 @@
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
- </dependentAssembly>
+ </dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
@@ -102,4 +131,10 @@
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
</system.codedom>
-</configuration>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
+</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config b/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config
index 34d59e98c..115c40d26 100644
--- a/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config
+++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/packages.config
@@ -2,6 +2,7 @@
<packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net461" />
<package id="bootstrap" version="3.3.7" targetFramework="net461" />
+ <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
<package id="Google.Protobuf" version="3.4.1" targetFramework="net461" />
<package id="jQuery" version="3.3.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights" version="2.5.1" targetFramework="net461" />
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs
index 85b104aa8..f12a6c322 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/DoubleClickDataGrid.cs
@@ -28,7 +28,7 @@ namespace Tango.SharedUI.Controls
private void DoubleClickDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
- if (SelectedItem != null)
+ if (SelectedItem != null && (e.OriginalSource as UIElement != null) && (e.OriginalSource as FrameworkElement).DataContext == SelectedItem)
{
DoubleClickCommand?.Execute(SelectedItem);
}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs
index ae5c66f6e..59237b4a0 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs
@@ -10,10 +10,12 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
+using Tango.Core;
using Tango.Core.IO;
using Tango.CSV;
using Tango.PMR.TCC;
using Tango.TCC.BL;
+using Tango.TCC.BL.Entities;
namespace Tango.UnitTesting.TCC
{
@@ -82,6 +84,23 @@ namespace Tango.UnitTesting.TCC
}
}
+ [TestMethod]
+ public void Test_Database()
+ {
+ using (TCCContext db = new TCCContext(new DataSource()
+ {
+ Address = "localhost\\SQLEXPRESS",
+ Catalog = "TCC",
+ IntegratedSecurity = true,
+ Type = DataSourceType.SQLServer,
+ }))
+ {
+ var device = db.Devices.FirstOrDefault();
+ Assert.IsNotNull(device);
+ db.SaveChanges();
+ }
+ }
+
private byte[] GetBitmapData(byte[] bitmap)
{
using (MemoryStream ms = new MemoryStream(bitmap))