public void WhiteRgbToLab() { var knownColor = new Rgb { R = 255, G = 255, B = 255, }; var expectedColor = new Lab { L = 100, A = 0.00526, B = -.0104, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void DarkVioletCmykToLab() { var knownColor = new Cmyk { C = .29858, M = 1, Y = 0, K = .17255, }; var expectedColor = new Lab { L = 39.579, A = 76.336, B = -70.378, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void Initialize() { TestData = new Dictionary<KeyValuePair<ILab, ILab>, double>(); var reader = new System.IO.StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"/TestData/CieDe2000TestData.dat"); string line; while ((line = reader.ReadLine()) != null) { if (string.IsNullOrEmpty(line)) continue; if (line.StartsWith("//")) continue; var parts = line.Split('\t'); var a = new Lab { L = Double.Parse(parts[0]), A = Double.Parse(parts[1]), B = Double.Parse(parts[2]) }; var b = new Lab { L = Double.Parse(parts[3]), A = Double.Parse(parts[4]), B = Double.Parse(parts[5]) }; var input = new KeyValuePair<ILab, ILab>(a, b); var expected = Double.Parse(parts[6]); TestData[input] = expected; } }
public bool Equals(Lab other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(other.L == L && other.A == A && other.B == B); }
public void ReturnsKnownValueForDissimilarColors() { // Todo, should be mocking!! var a = new Lab { L = 50, A = 67, B = 88 }; var b = new Lab { L = 50, A = 15, B = 22 }; ReturnsExpectedValueForKnownInput(84.0238, a, b); }
public void ReturnsKnownValueForWhiteAndEggShell1() { // Todo, should be mocking!! var a = new Lab { L = 100, A = 0, B = 0 }; var b = new Lab { L = 89.9490, A = 13.8320, B = 6.8160 }; ReturnsExpectedValueForKnownInput(25.103175, 1, a, b); }
public void ReturnsKnownValueForRedAndMaroon2() { // Todo, should be mocking!! var a = new Lab { L = 24.8290, A = 60.0930, B = 38.1800 }; var b = new Lab { L = 53.2300, A = 80.1090, B = 67.2200 }; ReturnsExpectedValueForKnownInput(24.143033, 2, a, b); }
public void ReturnsKnownValueForSimilarColors() { // Todo, should be mocking!! var a = new Lab { L = 88.17, A = 67, B = 88 }; var b = new Lab { L = 87.16, A = 65, B = 66 }; ReturnsExpectedValueForKnownInput(22.1138, a, b); }
public DeltaEMap Calculate(Lab target, Lab[,] palette) { var height = palette.GetLength(0); var width = palette.GetLength(1); BeginTrack(nameof(Calculate), "Calculating DeltaE"); var results = new double[height, width]; Parallel.For(0, height, i => { for (var j = 0; j < width; j++) results[i, j] = palette[i, j].Compare(target, CieDe2000); }); EndTrack(nameof(Calculate), "Calculated DeltaE map"); return new DeltaEMap(results); }
public void ReturnsKnownValueForGraphicArtsPinks() { // Todo, should be mocking!! var a = new Lab { L = 70.1, A = 53, B = -3.2 }; // Todo, should be mocking!! var b = new Lab { L = 67.4, A = 47.7, B = -5.34 }; ReturnsExpectedValueForKnownInput(3.408967, Cie94Comparison.Application.GraphicArts, a, b); }
public Form1() { InitializeComponent(); rangeValue = Convert.ToInt32(textBoxSensivity.Text); previousBitmaps = new List<BackStepItem>(); pixelDatas = new List<PixelData>(); pixelInfo = new List<PixelInfo>(); labInfo = new List<LabInfo>(); labDatas = new List<Lab>(); var lLab = new Lab(); lLab.L = 100; var aLab = new Lab(); aLab.A = 127; var bLab = new Lab(); bLab.B = 127; redWrap = new ZedGraphWrap(zedGraph, Color.Red, lLab); greenWrap = new ZedGraphWrap(zedGraph1, Color.Green, aLab); blueWrap = new ZedGraphWrap(zedGraph2, Color.Blue, bLab); pictureBoxPick.BackColor = Color.Black; }
private unsafe Lab[,] ToLab() { var lab = new Lab[Height, Width]; var x = 0; var y = 0; fixed (int* scan0 = &Data[0,0]) { for (var i = 0; i < Data.Length; i++) { var ptr = (byte*)scan0 + i * sizeof(int); lab[y, x] = (new Rgb {R = ptr[2], G = ptr[1], B = ptr[0]}).To<Lab>(); if (++x == Width) { x = 0; y++; } } } return lab; }
public void RedLabToCmyk() { var knownColor = new Lab { L = 53.233, A = 80.109, B = 67.220, }; var expectedColor = new Cmyk { C = 0.0039, M = .99970, Y = 1, K = 0, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void MaroonLchToLab() { var knownColor = new Lch { L = 24.829, C = 60.093, H = 38.180, }; var expectedColor = new Lab { L = 25.531, A = 48.055, B = 38.059, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void BlackRgbToLab() { var knownColor = new Rgb { R = 0, G = 0, B = 0, }; var expectedColor = new Lab { L = 0, A = 0, B = 0, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void RedLabToXyz() { var knownColor = new Lab { L = 53.233, A = 80.109, B = 67.220, }; var expectedColor = new Xyz { X = 41.240, Y = 21.260, Z = 1.930, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void RedLabToYxy() { var knownColor = new Lab { L = 53.233, A = 80.109, B = 67.220, }; var expectedColor = new Yxy { Y1 = 21.260, X = 0.64007, Y2 = .32997, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void RedLabToLch() { var knownColor = new Lab { L = 53.233, A = 80.109, B = 67.220, }; var expectedColor = new Lch { L = 53.33, C = 104.575, H = 40, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void RedLabToRgb() { var knownColor = new Lab { L = 53.233, A = 80.109, B = 67.220, }; var expectedColor = new Rgb { R = 255, G = 0, B = 0, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void GoldenrodRgbToLab() { var knownColor = new Rgb { R = 218, G = 165, B = 32, }; var expectedColor = new Lab { L = 70.816, A = 8.525, B = 68.765, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void RivergumXyzToLab() { var knownColor = new Xyz { X = 13.123, Y = 15.372, Z = 13.174, }; var expectedColor = new Lab { L = 46.140, A = -9.421, B = 8.218, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void AliceBlueHslToLab() { var knownColor = new Hsl { H = 208, S = 100, L = 97, }; var expectedColor = new Lab { L = 97.179, A = -1.3688, B = -4.358, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void SteelBlueCmyToLab() { var knownColor = new Cmy { C = .72549, M = .49020, Y = .29412, }; var expectedColor = new Lab { L = 52.467, A = -4.070, B = -32.198, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public ZedGraphWrap(ZedGraphControl graphControl, Color color, Lab lab) { GraphControl = graphControl; Color = color; Lab = lab; }
public void MaroonLchToLab() { var knownColor = new Lch { L = 24.829, C = 60.093, H = 38.180, }; var expectedColor = new Lab { L = 24.829, A = 47.237, B = 37.146, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void AquamarineHsvToLab() { var knownColor = new Hsv { H = 160, S = .5, V = 1, }; var expectedColor = new Lab { L = 92.036, A = -45.521, B = 9.49689, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void SilverLuvToLab() { var knownColor = new Luv { L = 77.704, U = .001, V = -.013, }; var expectedColor = new Lab { L = 77.704, A = .0026, B = -.00696, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }
public void RedLabToHsl() { var knownColor = new Lab { L = 53.233, A = 80.109, B = 67.220, }; var expectedColor = new Hsl { H = 0, S = 100, L = 50, }; ExpectedValuesForKnownColor(knownColor,expectedColor); }