From dad69951c0338be70949e823b1b0c321c862d3b9 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 14 May 2019 18:16:11 +0300 Subject: Implemented Display & Export embroidery file to storage on PPC. --- .../Tango.UnitTesting/Pulse/Pulse_TST.cs | 94 ++++++++++++++++++++++ 1 file changed, 94 insertions(+) (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs index 65bb31208..9951d8d10 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs @@ -124,5 +124,99 @@ namespace Tango.UnitTesting.Pulse twnFilePath.Display(); } + + [TestMethod] + public void Compose_Artificial_Twn_File() + { + String dstFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "TCap", "T-CAP.dst"); + String imgSolidFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "TCap", "T_Cap_Solid.png"); + String imgGradientFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "TCap", "T_Cap.png"); + + TwnFile twnFile = new TwnFile(); + twnFile.Version = 1f; + twnFile.Name = "T Cap Solid"; + twnFile.NumberOfCopies = 1; + twnFile.MediaID = 0; + twnFile.SpoolingMethod = SpoolingMethods.SingleSpool; + + twnFile.EmbroideryFile = File.ReadAllBytes(dstFile); + twnFile.EmbroideryFileFormat = "dst"; + + + //Generate solid. + Bitmap thumbnail = new Bitmap(imgSolidFile); + twnFile.Thumbnail = thumbnail; + + twnFile.Segments.Add(CreateSolidSegment(10, 252, 224, 87)); + twnFile.Segments.Add(CreateSolidSegment(10, 251, 168, 45)); + twnFile.Segments.Add(CreateSolidSegment(10, 237, 19, 117)); + twnFile.Segments.Add(CreateSolidSegment(10, 234, 89, 56)); + + var tempFolder = TemporaryManager.Default.CreateFolder(); + twnFile.ToFile(Path.Combine(tempFolder, "t-cap solid.twn")); + + twnFile.Segments.Clear(); + + //Generate gradient. + twnFile.Name = "T Cap Gradient"; + + thumbnail = new Bitmap(imgGradientFile); + twnFile.Thumbnail = thumbnail; + + twnFile.Segments.Add(CreateGradientSegment(10, 237, 19, 117, 251, 168, 45)); + twnFile.Segments.Add(CreateGradientSegment(10, 237, 19, 117, 251, 168, 45)); + twnFile.Segments.Add(CreateGradientSegment(10, 139, 48, 145, 251, 168, 45)); + twnFile.Segments.Add(CreateGradientSegment(10, 139, 48, 145, 242, 141, 172)); + + twnFile.ToFile(Path.Combine(tempFolder, "t-cap gradient.twn")); + + tempFolder.Display(); + } + + private TwnSegment CreateSolidSegment(float meter, byte r, byte g, byte b) + { + var segment = new TwnSegment() + { + Length = meter * 100, + BrushStops = new List() + { + new TwnStop() + { + R = r, + G = g, + B = b + }, + } + }; + + return segment; + } + + private TwnSegment CreateGradientSegment(float meter, byte r1, byte g1, byte b1, byte r2, byte g2, byte b2) + { + var segment = new TwnSegment() + { + Length = meter * 100, + BrushStops = new List() + { + new TwnStop() + { + R = r1, + G = g1, + B = b1, + Offset = 0 + }, + new TwnStop() + { + R = r2, + G = g2, + B = b2, + Offset = 1 + }, + } + }; + + return segment; + } } } -- 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/Tango.UnitTesting') 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 @@ - +