aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-04-01 00:14:28 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-04-01 00:14:28 +0300
commitf53099c8fddc7374857d29ee5521c00d91ec6d70 (patch)
tree4945687b08c716788666a6466a03cdab4becb733 /Software/Visual_Studio/MachineStudio/Modules
parentdf688ddc3e919acd254d79b73eaa22bd73d92062 (diff)
parent09eea5f5f8ab13a98fd4f106180230916d4885b8 (diff)
downloadTango-f53099c8fddc7374857d29ee5521c00d91ec6d70.tar.gz
Tango-f53099c8fddc7374857d29ee5521c00d91ec6d70.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.config2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ColorLabModule.cs63
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/ColorMatrixControl.cs55
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/IndexedUniformGrid.cs47
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Graph/WpfGraphController.cs36
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomLeft.bmpbin0 -> 3678 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomRight.bmpbin0 -> 3678 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/colorcapture_module.pngbin0 -> 706 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topRight.bmpbin0 -> 3678 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topleft.bmpbin0 -> 3678 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/video-frame.pngbin0 -> 97254 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/AssemblyInfo.cs19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.Designer.cs62
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.resx117
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.Designer.cs30
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.settings7
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj185
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Themes/Generic.xaml44
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModelLocator.cs29
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs185
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml199
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs36
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/packages.config10
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs5
24 files changed, 1131 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.config
new file mode 100644
index 000000000..a6a2b7fa9
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/App.config
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration /> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ColorLabModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ColorLabModule.cs
new file mode 100644
index 000000000..ef616daca
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ColorLabModule.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media.Imaging;
+using Tango.BL.Enumerations;
+using Tango.MachineStudio.ColorCapture.Views;
+using Tango.MachineStudio.Common;
+using Tango.SharedUI.Helpers;
+
+namespace Tango.MachineStudio.ColorCapture
+{
+ [StudioModule(15)]
+ public class ColorLabModule : StudioModuleBase
+ {
+ public override string Name
+ {
+ get
+ {
+ return "Color Capture";
+ }
+ }
+
+ public override string Description
+ {
+ get
+ {
+ return "Exposes Twine's color calibration technology through a real-time video capturing engine.";
+ }
+ }
+
+ public override BitmapSource Image
+ {
+ get
+ {
+ return ResourceHelper.GetImageFromResources("Images/colorcapture_module.png");
+ }
+ }
+
+ public override Type MainViewType
+ {
+ get
+ {
+ return typeof(MainView);
+ }
+ }
+
+ public override Permissions Permission
+ {
+ get
+ {
+ return Permissions.RunColorLabModule;
+ }
+ }
+
+ public override void Dispose()
+ {
+
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/ColorMatrixControl.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/ColorMatrixControl.cs
new file mode 100644
index 000000000..7ea8681ab
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/ColorMatrixControl.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.MachineStudio.ColorCapture.Controls
+{
+ public class ColorMatrixControl : Control
+ {
+ public ObservableCollection<Color> Colors
+ {
+ get { return (ObservableCollection<Color>)GetValue(ColorsProperty); }
+ set { SetValue(ColorsProperty, value); }
+ }
+ public static readonly DependencyProperty ColorsProperty =
+ DependencyProperty.Register("Colors", typeof(ObservableCollection<Color>), typeof(ColorMatrixControl), new PropertyMetadata(null));
+
+ public int Columns
+ {
+ get { return (int)GetValue(ColumnsProperty); }
+ set { SetValue(ColumnsProperty, value); }
+ }
+ public static readonly DependencyProperty ColumnsProperty =
+ DependencyProperty.Register("Columns", typeof(int), typeof(ColorMatrixControl), new PropertyMetadata(10));
+
+ public int Rows
+ {
+ get { return (int)GetValue(RowsProperty); }
+ set { SetValue(RowsProperty, value); }
+ }
+ public static readonly DependencyProperty RowsProperty =
+ DependencyProperty.Register("Rows", typeof(int), typeof(ColorMatrixControl), new PropertyMetadata(11));
+
+ public ColorMatrixControl()
+ {
+ Colors = new ObservableCollection<Color>();
+ }
+
+ static ColorMatrixControl()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorMatrixControl), new FrameworkPropertyMetadata(typeof(ColorMatrixControl)));
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/IndexedUniformGrid.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/IndexedUniformGrid.cs
new file mode 100644
index 000000000..af34e038d
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Controls/IndexedUniformGrid.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Tango.MachineStudio.ColorCapture.Controls
+{
+ public class IndexedUniformGrid : Grid
+ {
+ public int Columns
+ {
+ get { return (int)GetValue(ColumnsProperty); }
+ set { SetValue(ColumnsProperty, value); }
+ }
+ public static readonly DependencyProperty ColumnsProperty =
+ DependencyProperty.Register("Columns", typeof(int), typeof(IndexedUniformGrid), new PropertyMetadata(0));
+
+ public int Rows
+ {
+ get { return (int)GetValue(RowsProperty); }
+ set { SetValue(RowsProperty, value); }
+ }
+ public static readonly DependencyProperty RowsProperty =
+ DependencyProperty.Register("Rows", typeof(int), typeof(IndexedUniformGrid), new PropertyMetadata(0));
+
+ public IndexedUniformGrid()
+ {
+ Loaded += IndexedUniformGrid_Loaded;
+ }
+
+ private void IndexedUniformGrid_Loaded(object sender, RoutedEventArgs e)
+ {
+ for (int i = 0; i < Columns; i++)
+ {
+ ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
+ }
+
+ for (int i = 0; i < Rows; i++)
+ {
+ RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Graph/WpfGraphController.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Graph/WpfGraphController.cs
new file mode 100644
index 000000000..dd32cde93
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Graph/WpfGraphController.cs
@@ -0,0 +1,36 @@
+using RealTimeGraphX;
+using RealTimeGraphX.DataPoints;
+using RealTimeGraphX.Renderers;
+using RealTimeGraphX.WPF.DataSeries;
+using RealTimeGraphX.WPF.Painters;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace Tango.MachineStudio.ColorCapture.Graph
+{
+ public class WpfGraphController : GraphControllerBase<WpfDataSeries, DoubleDataPoint, DoubleDataPoint>
+ {
+ public WpfGraphController(int refreshRate = 50)
+ {
+ AddDataSeries(new WpfDataSeries()
+ {
+ StrokeThickness = 1,
+ Stroke = Colors.Black,
+ });
+
+ var renderer = new GraphScrollingRenderer<WpfDataSeries, DoubleDataPoint, DoubleDataPoint>()
+ {
+ RefreshRate = TimeSpan.FromMilliseconds(refreshRate)
+ };
+
+ var painter = new WpfScrollingGraphPainter();
+
+ ConnectOutput(renderer);
+ renderer.ConnectOutput(painter);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomLeft.bmp b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomLeft.bmp
new file mode 100644
index 000000000..13b33704b
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomLeft.bmp
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomRight.bmp b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomRight.bmp
new file mode 100644
index 000000000..d2116fad2
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/bottomRight.bmp
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/colorcapture_module.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/colorcapture_module.png
new file mode 100644
index 000000000..b6b8b53be
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/colorcapture_module.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topRight.bmp b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topRight.bmp
new file mode 100644
index 000000000..f008d454d
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topRight.bmp
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topleft.bmp b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topleft.bmp
new file mode 100644
index 000000000..8115cf359
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/topleft.bmp
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/video-frame.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/video-frame.png
new file mode 100644
index 000000000..9c29dc438
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Images/video-frame.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..b86e2231d
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/AssemblyInfo.cs
@@ -0,0 +1,19 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+[assembly: AssemblyTitle("Tango - Machine Studio Color Capture Module")]
+[assembly: AssemblyVersion("2.0.12.1608")]
+
+[assembly: ComVisible(false)]
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..80918eb2e
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.Designer.cs
@@ -0,0 +1,62 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Tango.MachineStudio.ColorCapture.Properties {
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if ((resourceMan == null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.MachineStudio.ColorCapture.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.resx b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.resx
new file mode 100644
index 000000000..af7dbebba
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.Designer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..fccfa223f
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Tango.MachineStudio.ColorCapture.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.settings b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.settings
new file mode 100644
index 000000000..033d7a5e9
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile> \ No newline at end of file
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
new file mode 100644
index 000000000..4d0c0fae5
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{1B87CA53-50BD-4C48-A8C7-FBB9F1419AFF}</ProjectGuid>
+ <OutputType>library</OutputType>
+ <RootNamespace>Tango.MachineStudio.ColorCapture</RootNamespace>
+ <AssemblyName>Tango.MachineStudio.ColorCapture</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <WarningLevel>4</WarningLevel>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\Build\Machine Studio\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\..\..\Build\Machine Studio\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <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="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath>
+ </Reference>
+ <Reference Include="MaterialDesignColors, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll</HintPath>
+ </Reference>
+ <Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Xml" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xaml">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="WindowsBase" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ </ItemGroup>
+ <ItemGroup>
+ <Page Include="Themes\Generic.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Include="Views\MainView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs">
+ <Link>GlobalVersionInfo.cs</Link>
+ </Compile>
+ <Compile Include="ColorLabModule.cs" />
+ <Compile Include="Controls\ColorMatrixControl.cs" />
+ <Compile Include="Controls\IndexedUniformGrid.cs" />
+ <Compile Include="Graph\WpfGraphController.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <Compile Include="ViewModelLocator.cs" />
+ <Compile Include="ViewModels\MainViewVM.cs" />
+ <Compile Include="Views\MainView.xaml.cs">
+ <DependentUpon>MainView.xaml</DependentUpon>
+ </Compile>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <None Include="packages.config" />
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\SideChains\ColorMine\ColorMine.csproj">
+ <Project>{37e4ceab-b54b-451f-b535-04cf7da9c459}</Project>
+ <Name>ColorMine</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX.WPF\RealTimeGraphX.WPF.csproj">
+ <Project>{99d233c5-fee7-418e-9c25-d4584cb52e28}</Project>
+ <Name>RealTimeGraphX.WPF</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX\RealTimeGraphX.csproj">
+ <Project>{6d55a3b8-46d3-493a-a143-aebd2b98d683}</Project>
+ <Name>RealTimeGraphX</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj">
+ <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project>
+ <Name>Tango.BL</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj">
+ <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project>
+ <Name>Tango.PMR</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj">
+ <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project>
+ <Name>Tango.Settings</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj">
+ <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project>
+ <Name>Tango.SharedUI</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.Video\Tango.Video.csproj">
+ <Project>{9652f972-2bd1-4283-99cb-fc6240434c17}</Project>
+ <Name>Tango.Video</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\TCC\Tango.TCC.BL\Tango.TCC.BL.csproj">
+ <Project>{f209fae8-73f9-441b-97f4-0844a0279390}</Project>
+ <Name>Tango.TCC.BL</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\TCC\Tango.TCC.OpenCV.DLL\Tango.TCC.OpenCV.DLL.csproj">
+ <Project>{5d0d4053-cab3-4a4a-929e-37a76483bc22}</Project>
+ <Name>Tango.TCC.OpenCV.DLL</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.MachineStudio.Common\Tango.MachineStudio.Common.csproj">
+ <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project>
+ <Name>Tango.MachineStudio.Common</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\video-frame.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\colorcapture_module.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\bottomLeft.bmp" />
+ <Resource Include="Images\bottomRight.bmp" />
+ <Resource Include="Images\topleft.bmp" />
+ <Resource Include="Images\topRight.bmp" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Themes/Generic.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Themes/Generic.xaml
new file mode 100644
index 000000000..0a2ebbca8
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Themes/Generic.xaml
@@ -0,0 +1,44 @@
+<ResourceDictionary
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="clr-namespace:Tango.MachineStudio.ColorCapture.Controls"
+ xmlns:local="clr-namespace:Tango.MachineStudio.ColorCapture">
+
+
+ <Style TargetType="{x:Type controls:ColorMatrixControl}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type controls:ColorMatrixControl}">
+ <Border Background="{TemplateBinding Background}"
+ BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{TemplateBinding BorderThickness}">
+ <Grid>
+ <ItemsControl ItemsSource="{TemplateBinding Colors}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <UniformGrid Columns="{Binding RelativeSource={RelativeSource AncestorType=controls:ColorMatrixControl},Path=Columns}" Rows="{Binding RelativeSource={RelativeSource AncestorType=controls:ColorMatrixControl},Path=Rows}" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Rectangle>
+ <Rectangle.Fill>
+ <SolidColorBrush Color="{Binding}"></SolidColorBrush>
+ </Rectangle.Fill>
+ </Rectangle>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ <controls:IndexedUniformGrid Columns="{TemplateBinding Columns}" Rows="{TemplateBinding Rows}">
+ <Image Source="Images/topLeft.bmp" Stretch="Fill" Grid.Column="0" Grid.Row="0" />
+ <Image Source="Images/topRight.bmp" Stretch="Fill" Grid.Column="{TemplateBinding Columns}" Grid.Row="0" />
+ <Image Source="Images/bottomLeft.bmp" Stretch="Fill" Grid.Column="0" Grid.Row="{TemplateBinding Rows}" />
+ <Image Source="Images/bottomRight.bmp" Stretch="Fill" Grid.Column="{TemplateBinding Columns}" Grid.Row="{TemplateBinding Rows}" />
+ </controls:IndexedUniformGrid>
+ </Grid>
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+</ResourceDictionary>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModelLocator.cs
new file mode 100644
index 000000000..75cb5fad6
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModelLocator.cs
@@ -0,0 +1,29 @@
+using Tango.Core.DI;
+using Tango.MachineStudio.ColorCapture.ViewModels;
+using Tango.MachineStudio.ColorCapture.Views;
+
+namespace Tango.MachineStudio.ColorCapture
+{
+ /// <summary>
+ /// This class contains static references to all the view models in the
+ /// application and provides an entry point for the bindings.
+ /// </summary>
+ public static class ViewModelLocator
+ {
+ /// <summary>
+ /// Initializes a new instance of the ViewModelLocator class.
+ /// </summary>
+ static ViewModelLocator()
+ {
+ TangoIOC.Default.Register<MainViewVM>();
+ }
+
+ public static MainViewVM MainViewVM
+ {
+ get
+ {
+ return TangoIOC.Default.GetInstance<MainViewVM>();
+ }
+ }
+ }
+} \ No newline at end of file
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
new file mode 100644
index 000000000..f21c403de
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs
@@ -0,0 +1,185 @@
+using ColorMine.ColorSpaces;
+using ColorMine.ColorSpaces.Comparisons;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using Tango.Core.Commands;
+using Tango.MachineStudio.ColorCapture.Graph;
+using Tango.MachineStudio.Common;
+using Tango.MachineStudio.Common.Notifications;
+using Tango.MachineStudio.Common.Video;
+using Tango.TCC.BL;
+using Tango.Video.DirectCapture;
+
+namespace Tango.MachineStudio.ColorCapture.ViewModels
+{
+ public class MainViewVM : StudioViewModel
+ {
+ private INotificationProvider _notification;
+ private CardDetector _cardDetector;
+ private int _sampleCounter;
+
+ public IVideoCaptureProvider VideoProvider { get; set; }
+
+ private CaptureDevice _selectedVideoDevice;
+ public CaptureDevice SelectedVideoDevice
+ {
+ get { return _selectedVideoDevice; }
+ set
+ {
+ var oldValue = _selectedVideoDevice;
+ _selectedVideoDevice = value;
+ RaisePropertyChangedAuto();
+ OnSelectedVideoDeviceChanged(oldValue, _selectedVideoDevice);
+ }
+ }
+
+ private BitmapSource _detectedSource;
+ public BitmapSource DetectedSource
+ {
+ get { return _detectedSource; }
+ set { _detectedSource = value; RaisePropertyChangedAuto(); }
+ }
+
+ private ObservableCollection<Color> _colors;
+ public ObservableCollection<Color> Colors
+ {
+ get { return _colors; }
+ set { _colors = value; RaisePropertyChangedAuto(); RaisePropertyChangedAuto(); }
+ }
+
+ private Color _processedColor;
+ public Color ProcessedColor
+ {
+ get { return _processedColor; }
+ set { _processedColor = value; RaisePropertyChangedAuto(); }
+ }
+
+ private Color _capturedColor;
+ public Color CapturedColor
+ {
+ get { return _capturedColor; }
+ set { _capturedColor = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _measureL;
+ public double MeasureL
+ {
+ get { return _measureL; }
+ set { _measureL = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _measureA;
+ public double MeasureA
+ {
+ get { return _measureA; }
+ set { _measureA = value; RaisePropertyChangedAuto(); }
+ }
+
+ private double _measureB;
+ public double MeasureB
+ {
+ get { return _measureB; }
+ set { _measureB = value; RaisePropertyChangedAuto(); }
+ }
+
+
+ public WpfGraphController CaptureDeltaEController { get; set; }
+
+ public RelayCommand ToggleCameraCommand { get; set; }
+
+ public MainViewVM()
+ {
+ _cardDetector = new CardDetector();
+ ToggleCameraCommand = new RelayCommand(ToggleCamera);
+ CaptureDeltaEController = new WpfGraphController();
+ CaptureDeltaEController.Range.AutoY = true;
+ CaptureDeltaEController.Range.MaximumX = 1000;
+ }
+
+ public MainViewVM(IVideoCaptureProvider videoProvider, INotificationProvider notificationProvider) : this()
+ {
+ _notification = notificationProvider;
+ VideoProvider = videoProvider;
+ SelectedVideoDevice = videoProvider.AvailableCaptureDevices.FirstOrDefault();
+ }
+
+ private void ToggleCamera()
+ {
+ if (SelectedVideoDevice != null)
+ {
+ if (SelectedVideoDevice.IsStarted)
+ {
+ SelectedVideoDevice.Stop();
+ }
+ else
+ {
+ SelectedVideoDevice.Resolution = new Resolution(1280, 720);
+ SelectedVideoDevice.Start();
+ }
+ }
+ }
+
+ private void OnSelectedVideoDeviceChanged(CaptureDevice previousDevice, CaptureDevice newDevice)
+ {
+ if (previousDevice != null)
+ {
+ previousDevice.FrameReceived -= OnVideoFrameReceived;
+ }
+
+ if (newDevice != null)
+ {
+ newDevice.RaiseFrameReceivedEvent = true;
+ newDevice.FrameReceived += OnVideoFrameReceived;
+ }
+ }
+
+ double deltaE = 0;
+ private async void OnVideoFrameReceived(object sender, Video.DirectShow.EventArguments.FrameReceivedEventArgs args)
+ {
+ if (_cardDetector.CanDetect)
+ {
+ var result = await _cardDetector.Detect(args.BitmapSource);
+
+ if (result.IsDetected)
+ {
+ DetectedSource = result.DetectedBitmap;
+
+ if (Colors == null)
+ {
+ Colors = new ObservableCollection<Color>(Enumerable.Range(0, result.ColorDetectionOutput.ColorMatrix.Count).Select(x => new Color()));
+ }
+
+ InvokeUI(() =>
+ {
+ for (int i = 0; i < result.ColorDetectionOutput.ColorMatrix.Count; i++)
+ {
+ var detectedColor = result.ColorDetectionOutput.ColorMatrix[i];
+ Colors[i] = Color.FromArgb(255, (byte)detectedColor.R, (byte)detectedColor.G, (byte)detectedColor.B);
+ }
+
+ CapturedColor = Color.FromArgb(255, (byte)result.ColorDetectionOutput.RawColor.R, (byte)result.ColorDetectionOutput.RawColor.G, (byte)result.ColorDetectionOutput.RawColor.B);
+ ProcessedColor = Color.FromArgb(255, (byte)result.ColorDetectionOutput.ProcessedColor.R, (byte)result.ColorDetectionOutput.ProcessedColor.G, (byte)result.ColorDetectionOutput.ProcessedColor.B);
+ });
+
+ //calculate delta E.
+ Lab measureLab = new Lab(MeasureL, MeasureA, MeasureB);
+ deltaE = measureLab.Compare(new Rgb(ProcessedColor.R, ProcessedColor.G, ProcessedColor.B), new CieDe2000Comparison());
+ }
+ }
+
+ CaptureDeltaEController.PushData(_sampleCounter++, deltaE);
+ }
+
+ public override void OnApplicationReady()
+ {
+
+ }
+ }
+}
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
new file mode 100644
index 000000000..259e3160e
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml
@@ -0,0 +1,199 @@
+<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:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ 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"
+ xmlns:graphX="clr-namespace:RealTimeGraphX.WPF.Surfaces;assembly=RealTimeGraphX.WPF"
+ xmlns:componentsX="clr-namespace:RealTimeGraphX.WPF.Components;assembly=RealTimeGraphX.WPF"
+ xmlns:controls="clr-namespace:Tango.MachineStudio.ColorCapture.Controls"
+ 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"
+ mc:Ignorable="d"
+ d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+ <Grid Margin="20">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="247*"/>
+ <RowDefinition Height="113*"/>
+ </Grid.RowDefinitions>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*"/>
+ <ColumnDefinition Width="1*"/>
+ </Grid.ColumnDefinitions>
+
+ <Border RenderOptions.BitmapScalingMode="Fant">
+ <Grid>
+ <DockPanel>
+ <DockPanel DockPanel.Dock="Bottom" Margin="60 0" TextElement.FontSize="25">
+ <TextBlock VerticalAlignment="Center">Capture Device</TextBlock>
+ <Button DockPanel.Dock="Right" Command="{Binding ToggleCameraCommand}" CommandParameter="{Binding}" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Width="60" Height="60" Padding="0">
+ <materialDesign:PackIcon Width="40" Height="40">
+ <materialDesign:PackIcon.Style>
+ <Style TargetType="materialDesign:PackIcon">
+ <Setter Property="Kind" Value="Play"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="True">
+ <Setter Property="Kind" Value="Stop"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding SelectedVideoDevice.IsStarted}" Value="False">
+ <Setter Property="Kind" Value="Play"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </materialDesign:PackIcon.Style>
+ </materialDesign:PackIcon>
+ </Button>
+ <ComboBox FontWeight="SemiBold" Margin="20 0 20 0" ItemsSource="{Binding VideoProvider.AvailableCaptureDevices}" SelectedItem="{Binding SelectedVideoDevice}" DisplayMemberPath="Device"></ComboBox>
+ </DockPanel>
+
+ <Border BorderThickness="3" BorderBrush="#202020" Margin="40">
+ <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>
+ </Border>
+ </DockPanel>
+ </Grid>
+ </Border>
+
+ <Grid Grid.Column="1">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="180*"/>
+ <RowDefinition Height="130*"/>
+ </Grid.RowDefinitions>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*"/>
+ <ColumnDefinition Width="1*"/>
+ </Grid.ColumnDefinitions>
+
+ <Border Margin="0 40 0 0" VerticalAlignment="Top" Width="300" Height="310" BorderThickness="3" BorderBrush="#202020">
+ <Image Source="{Binding DetectedSource,Mode=OneWay,IsAsync=True}" Stretch="Fill"></Image>
+ </Border>
+
+ <Border Margin="0 40 0 0" VerticalAlignment="Top" Width="300" Height="310" BorderThickness="3" BorderBrush="#202020" Grid.Column="1">
+ <controls:ColorMatrixControl Colors="{Binding Colors,Mode=OneWay}" Columns="10" Rows="11" />
+ </Border>
+ </Grid>
+
+ <Grid Grid.Row="1">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*"/>
+ <ColumnDefinition Width="1*"/>
+ </Grid.ColumnDefinitions>
+
+ <Grid Width="300" Height="190" VerticalAlignment="Top">
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top" FontSize="20">Captured Color</TextBlock>
+ <DockPanel Margin="0 10 0 0" TextElement.FontSize="20">
+ <UniformGrid DockPanel.Dock="Right" Rows="3" Margin="10 0 0 0" Width="55">
+ <TextBlock><Run Text="R:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding CapturedColor.R,Mode=OneWay}"></Run></TextBlock>
+ <TextBlock><Run Text="G:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding CapturedColor.G,Mode=OneWay}"></Run></TextBlock>
+ <TextBlock><Run Text="B:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding CapturedColor.B,Mode=OneWay}"></Run></TextBlock>
+ </UniformGrid>
+ <Border BorderThickness="1" BorderBrush="#202020">
+ <Border.Background>
+ <SolidColorBrush Color="{Binding CapturedColor,Mode=OneWay}" />
+ </Border.Background>
+ </Border>
+ </DockPanel>
+ </DockPanel>
+ </Grid>
+
+ <Grid Width="300" Height="190" VerticalAlignment="Top" Grid.Column="1">
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top" FontSize="20">Processed Color</TextBlock>
+ <DockPanel Margin="0 10 0 0" TextElement.FontSize="20">
+ <UniformGrid DockPanel.Dock="Right" Rows="3" Margin="10 0 0 0" Width="55">
+ <TextBlock><Run Text="R:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding ProcessedColor.R,Mode=OneWay}"></Run></TextBlock>
+ <TextBlock><Run Text="G:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding ProcessedColor.G,Mode=OneWay}"></Run></TextBlock>
+ <TextBlock><Run Text="B:"></Run> <Run FontWeight="SemiBold" FontStyle="Italic" Text="{Binding ProcessedColor.B,Mode=OneWay}"></Run></TextBlock>
+ </UniformGrid>
+ <Border BorderThickness="1" BorderBrush="#202020">
+ <Border.Background>
+ <SolidColorBrush Color="{Binding ProcessedColor,Mode=OneWay}" />
+ </Border.Background>
+ </Border>
+ </DockPanel>
+ </DockPanel>
+ </Grid>
+ </Grid>
+ </Grid>
+ </Grid>
+
+ <Grid Grid.Row="1" Margin="0 10 0 0">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="1*"/>
+ <ColumnDefinition Width="1*"/>
+ </Grid.ColumnDefinitions>
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top">HISTORY</TextBlock>
+ <DataGrid Margin="0 10 0 0" Background="Transparent" Grid.ColumnSpan="2">
+ <DataGrid.Columns>
+ <DataGridTextColumn Header="TIME" />
+ <DataGridTextColumn Header="CAPTURED COLOR" />
+ <DataGridTextColumn Header="PROCESSED COLOR" />
+ </DataGrid.Columns>
+ </DataGrid>
+ </DockPanel>
+
+ <DockPanel Grid.Column="1" Margin="75 0 110 0">
+ <Grid DockPanel.Dock="Top" TextElement.FontSize="20" Margin="0 0 0 10">
+ <DockPanel>
+ <TextBlock HorizontalAlignment="Center">Delta E Reference Point</TextBlock>
+ <StackPanel Orientation="Horizontal" Margin="20 0 0 0">
+ <TextBlock FontWeight="SemiBold">L:</TextBlock>
+ <mahapps:NumericUpDown MinWidth="120" HorizontalContentAlignment="Left" Value="{Binding MeasureL,UpdateSourceTrigger=PropertyChanged}" Minimum="0" Maximum="100" Margin="5 0 0 0" HasDecimals="True" HideUpDownButtons="True" Background="Transparent" BorderThickness="1" />
+
+ <TextBlock Margin="20 0 0 0" FontWeight="SemiBold">A:</TextBlock>
+ <mahapps:NumericUpDown MinWidth="120" HorizontalContentAlignment="Left" Value="{Binding MeasureA,UpdateSourceTrigger=PropertyChanged}" Minimum="-127" Maximum="128" Margin="5 0 0 0" HasDecimals="True" HideUpDownButtons="True" Background="Transparent" BorderThickness="1" />
+
+ <TextBlock Margin="20 0 0 0" FontWeight="SemiBold">B:</TextBlock>
+ <mahapps:NumericUpDown MinWidth="120" HorizontalContentAlignment="Left" Value="{Binding MeasureB,UpdateSourceTrigger=PropertyChanged}" Minimum="-127" Maximum="128" Margin="5 0 0 0" HasDecimals="True" HideUpDownButtons="True" Background="Transparent" BorderThickness="1" />
+ </StackPanel>
+ </DockPanel>
+ </Grid>
+ <Grid>
+ <Border Padding="20" BorderThickness="1" BorderBrush="#202020">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="55"/>
+ <ColumnDefinition Width="438*"/>
+ </Grid.ColumnDefinitions>
+
+ <Border Margin="0 1 0 2">
+ <componentsX:GraphAxisControl Orientation="Vertical" FontSize="10" Surface="{Binding ElementName=Graph}" StringFormat="Δ 0.00;-#" />
+ </Border>
+ <Border Grid.Column="1" BorderThickness="1" BorderBrush="Silver" Margin="1 0 0 0">
+ <Grid>
+
+ <componentsX:GraphGridLines Foreground="Silver" />
+
+ <graphX:WpfGraphSurface x:Name="Graph"></graphX:WpfGraphSurface>
+ </Grid>
+ </Border>
+ </Grid>
+ </Border>
+ </Grid>
+ </DockPanel>
+ </Grid>
+ </Grid>
+ </Grid>
+</UserControl>
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
new file mode 100644
index 000000000..05b5daf7e
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Tango.MachineStudio.ColorCapture.ViewModels;
+
+namespace Tango.MachineStudio.ColorCapture.Views
+{
+ /// <summary>
+ /// Interaction logic for MainView.xaml
+ /// </summary>
+ public partial class MainView : UserControl
+ {
+ private MainViewVM _vm;
+
+ public MainView()
+ {
+ InitializeComponent();
+ Loaded += (_, __) =>
+ {
+ _vm = DataContext as MainViewVM;
+ _vm.CaptureDeltaEController.Output.Output.ConnectOutput(Graph);
+ };
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/packages.config
new file mode 100644
index 000000000..37e4dd902
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/packages.config
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="CommonServiceLocator" version="1.3" targetFramework="net461" />
+ <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
+ <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net461" />
+ <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" />
+ <package id="MahApps.Metro" version="1.5.0" targetFramework="net461" />
+ <package id="MaterialDesignColors" version="1.1.2" targetFramework="net461" />
+ <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net461" />
+</packages> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs
index 3d282367a..bbe5432e9 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/ViewModels/MainViewVM.cs
@@ -174,6 +174,11 @@ namespace Tango.MachineStudio.DataCapture.ViewModels
#region Constructors
+ public MainViewVM()
+ {
+
+ }
+
/// <summary>
/// Initializes a new instance of the <see cref="MainViewVM"/> class.
/// </summary>