From 7ef2f5156e8a7958ee6425f53158f94974762ef9 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 12 May 2019 16:22:55 +0300 Subject: Fixed CircleActionButton on TCC. Prevent continues messages from updating after complete or error. Fixed diagnostics not resuming MS <=> PPC after PPC <=> Machine disconnection. --- .../Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 72e43d7b0..ab5d2ebb1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -405,6 +405,8 @@ namespace Tango.MachineStudio.Technician.ViewModels /// The data. private void PopulateDiagnosticsData(StartDiagnosticsResponse data) { + if (data.Monitors == null) return; + TimeSpan delta_base = DateTime.Now - _start_time; TimeSpan delta = (DateTime.Now - _last_time); double delta_mili = delta.TotalMilliseconds; -- cgit v1.3.1 From 2b8937314aef20b7ebec18c9b0f1f3f7f98541c6 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Wed, 15 May 2019 09:19:16 +0300 Subject: Working on emulated3D.. --- .../Models/Emulated3DModel.cs | 61 +++++++++++++++++++ .../Models/LightingModes.cs | 16 +++++ .../Tango.MachineStudio.ColorCapture.csproj | 2 + .../ViewModels/MainViewVM.cs | 9 +++ .../Views/MainView.xaml | 69 ++++++++++++++++++---- .../Views/MainView.xaml.cs | 16 +++++ 6 files changed, 162 insertions(+), 11 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/Emulated3DModel.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/LightingModes.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/Emulated3DModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/Emulated3DModel.cs new file mode 100644 index 000000000..5153277ce --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/Emulated3DModel.cs @@ -0,0 +1,61 @@ +using HelixToolkit.Wpf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.MachineStudio.ColorCapture.Models +{ + public class Emulated3DModel : ExtendedObject + { + private DefaultLights _defaultLights; + private ThreePointLights _threePointLights; + private DirectionalHeadLight _directionalHeadLights; + private SpotHeadLight _spotHeadLight; + + public Emulated3DModel() + { + _defaultLights = new DefaultLights(); + _threePointLights = new ThreePointLights(); + _directionalHeadLights = new DirectionalHeadLight(); + _spotHeadLight = new SpotHeadLight(); + + CurrentMode = LightingModes.Default; + } + + private LightSetup _currentLight; + public LightSetup CurrentLight + { + get { return _currentLight; } + set { _currentLight = value; RaisePropertyChangedAuto(); } + } + + private LightingModes _currentMode; + public LightingModes CurrentMode + { + get { return _currentMode; } + set { _currentMode = value; RaisePropertyChangedAuto(); OnCurrentModeChanged(); } + } + + private void OnCurrentModeChanged() + { + switch (CurrentMode) + { + case LightingModes.Default: + CurrentLight = _defaultLights; + break; + case LightingModes.DirectionalHeadLight: + CurrentLight = _directionalHeadLights; + break; + case LightingModes.SpotHeadLight: + CurrentLight = _spotHeadLight; + break; + case LightingModes.ThreePointLights: + CurrentLight = _threePointLights; + break; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/LightingModes.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/LightingModes.cs new file mode 100644 index 000000000..84369f90c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Models/LightingModes.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 LightingModes + { + Default, + ThreePointLights, + DirectionalHeadLight, + SpotHeadLight, + } +} 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 1c04917c0..4825f1812 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 @@ -125,6 +125,8 @@ + + Code 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 38c86c297..93fe776bc 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 @@ -244,6 +244,13 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels set { _emulatedImage = value; RaisePropertyChangedAuto(); } } + private Emulated3DModel _emulated3DModel; + public Emulated3DModel Emulated3DModel + { + get { return _emulated3DModel; } + set { _emulated3DModel = value; RaisePropertyChangedAuto(); } + } + public RelayCommand ImportBenchmarksCommand { get; set; } public RelayCommand ExportBenchmarksCommand { get; set; } @@ -285,6 +292,8 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels CaptureModeCommand = new RelayCommand((mode) => CaptureMode = mode); _emulatedActionTimer = new ActionTimer(TimeSpan.FromMilliseconds(100)); + Emulated3DModel = new Emulated3DModel(); + _timer3D = new DispatcherTimer(); _timer3D.Interval = TimeSpan.FromSeconds(1); _timer3D.Tick += _timer3D_Tick; 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 e11ae3fa3..bd26ff008 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 @@ -237,7 +237,8 @@ - + + @@ -249,10 +250,15 @@ - + + + - + + + + @@ -267,24 +273,65 @@ - + - + + - - Light + Lighting + - - - Spectural + + + Specular Brightness - + + + + Specular Power + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs index 0bd0efe31..a35adaa23 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs @@ -17,6 +17,7 @@ using System.Windows.Navigation; using System.Windows.Shapes; using Tango.Core.DI; using Tango.MachineStudio.ColorCapture.Contracts; +using Tango.MachineStudio.ColorCapture.Models; using Tango.MachineStudio.ColorCapture.ViewModels; namespace Tango.MachineStudio.ColorCapture.Views @@ -94,5 +95,20 @@ namespace Tango.MachineStudio.ColorCapture.Views ms.Dispose(); return source; } + + private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + ReplaceLight(); + } + + private async void ReplaceLight() + { + if (_vm != null) + { + await Task.Delay(100); + lightsContainer.Children.Clear(); + lightsContainer.Children.Add(_vm.Emulated3DModel.CurrentLight); + } + } } } -- cgit v1.3.1 From 6cecbdc7b11836807bb53e6874b08dc06113ba18 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 15 May 2019 15:21:33 +0300 Subject: Added experimental perform CLAHE on color detector. --- Software/PMR/Messages/TCC/DetectionInput.proto | 2 +- Software/PMR/Messages/TCC/DetectionOutput.proto | 13 ++-- .../PPC Installer-cache/cacheIndex.txt | Bin 52 -> 52 bytes .../Advanced Installer Projects/PPC Installer.aip | 18 +++-- .../Models/CaptureConfig.cs | 7 ++ .../ViewModels/MainViewVM.cs | 7 +- .../Views/MainView.xaml | 8 ++- .../Views/MainView.xaml.cs | 47 ++++++++++-- .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../Visual_Studio/PPC/Tango.PPC.UI/app.manifest | 2 +- .../TCC/Tango.TCC.BL/CardDetectionConfig.cs | 1 + .../Visual_Studio/TCC/Tango.TCC.BL/CardDetector.cs | 11 +++ .../TCC/Tango.TCC.CardDetector/CardDetection.cpp | Bin 10390 -> 12212 bytes .../TCC/Tango.TCC.CardDetector/CardDetection.h | Bin 1240 -> 1310 bytes .../Tango.TCC.CardDetector/CardDetectionConfig.h | 1 + .../TCC/Tango.TCC.ColorDetector/ColorDetection.cpp | 65 +++++++++-------- .../TCC/Tango.TCC.ColorDetector/ColorDetection.h | 15 +++- .../PMR/TCC/DetectionInput.pb-c.c | 17 +++-- .../PMR/TCC/DetectionInput.pb-c.h | 4 +- .../PMR/TCC/DetectionOutput.pb-c.c | 43 ++++------- .../PMR/TCC/DetectionOutput.pb-c.h | 4 +- .../Controllers/ColorDetectionController.cs | 2 +- .../Visual_Studio/Tango.PMR/TCC/DetectionInput.cs | 45 ++++++------ .../Visual_Studio/Tango.PMR/TCC/DetectionOutput.cs | 80 +++++++-------------- .../Visual_Studio/Tango.UnitTesting/TCC/TCC_TST.cs | 3 - 25 files changed, 219 insertions(+), 178 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/PMR/Messages/TCC/DetectionInput.proto b/Software/PMR/Messages/TCC/DetectionInput.proto index d9332bbd4..a59a45d0f 100644 --- a/Software/PMR/Messages/TCC/DetectionInput.proto +++ b/Software/PMR/Messages/TCC/DetectionInput.proto @@ -14,5 +14,5 @@ message DetectionInput bool RequestDebugImage = 5; bool RequestColorMatrix = 6; repeated DetectionBenchmark Benchmarks = 7; - double number = 10; + bool PerformCLAHE = 8; } \ No newline at end of file diff --git a/Software/PMR/Messages/TCC/DetectionOutput.proto b/Software/PMR/Messages/TCC/DetectionOutput.proto index cbd20ea52..55cf3608d 100644 --- a/Software/PMR/Messages/TCC/DetectionOutput.proto +++ b/Software/PMR/Messages/TCC/DetectionOutput.proto @@ -7,11 +7,10 @@ option java_package = "com.twine.tango.pmr.tcc"; message DetectionOutput { - double number = 1; - DetectionColor RawColor = 2; - DetectionColor ProcessedColor = 3; - bytes DebugBitmap = 4; - repeated DetectionColor ColorMatrix = 5; - bool HasError = 6; - string ErrorMessage = 7; + DetectionColor RawColor = 1; + DetectionColor ProcessedColor = 2; + bytes DebugBitmap = 3; + repeated DetectionColor ColorMatrix = 4; + bool HasError = 5; + string ErrorMessage = 6; } \ No newline at end of file diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt index a603ff06b..6d87e9201 100644 Binary files a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt and b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt differ diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index 35eafa66e..424e66b4d 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -18,10 +18,10 @@ - + - + @@ -115,7 +115,6 @@ - @@ -212,13 +211,16 @@ + + + - + @@ -456,7 +458,7 @@ - + @@ -495,6 +497,9 @@ + + + @@ -510,7 +515,7 @@ - + @@ -577,7 +582,6 @@ - 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 0b74f2b3f..730665263 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 @@ -110,6 +110,13 @@ namespace Tango.MachineStudio.ColorCapture.Models set { _enforceBarcodeDetection = value; RaisePropertyChangedAuto(); } } + private bool _performCLAHE; + public bool PerformCLAHE + { + get { return _performCLAHE; } + set { _performCLAHE = value; RaisePropertyChangedAuto(); } + } + public CaptureConfig() { 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 93fe776bc..2cf3ed63f 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 @@ -548,6 +548,7 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels HistogramMethod = Config.HistogramComparison, EnableDoubleChecking = Config.EnableDoubleChecking, EnforceBarcodeDetection = Config.EnforceBarcodeDetection, + PerformCLAHE = Config.PerformCLAHE, }); if (result.Similarity > 0) @@ -784,7 +785,11 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels if (EmulatedColors != null) { var source = View.GetViewportImage(); - PerformDetection(source); + + if (source != null) + { + PerformDetection(source); + } } } } 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 bd26ff008..96e5fc488 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 @@ -48,7 +48,7 @@ - +