Exemplo n.º 1
0
        public void RgbToLabConvertTest()
        {
            RGBColor input  = RGBColor.FromRGB8bit(100, 180, 20);
            var      output = ColorConverter.ToLab(input);

            Assert.AreEqual(66.210907448350753d, output.L, "L value invalid");
            Assert.AreEqual(-43.228098886804013d, output.a, "a value invalid");
            Assert.AreEqual(62.622271435015122d, output.b, "b value invalid");
        }
Exemplo n.º 2
0
        public void TheSameColorTest()
        {
            var color1 = RGBColor.FromRGB8bit(100, 150, 105);
            var color2 = RGBColor.FromRGB8bit(100, 150, 105);

            var result =
                ColorDifferenceAnalyzer.ComputeColorDifference(ColorConverter.ToLab(color1),
                                                               ColorConverter.ToLab(color2));

            Assert.AreEqual(0.0d, result);
        }
Exemplo n.º 3
0
        public void MaxDifferenceInColor()
        {
            var color1 = RGBColor.FromRGB8bit(0, 0, 0);
            var color2 = RGBColor.FromRGB8bit(255, 255, 255);

            var result =
                ColorDifferenceAnalyzer.ComputeColorDifference(ColorConverter.ToLab(color1),
                                                               ColorConverter.ToLab(color2));

            Assert.AreEqual(100.0d, result);
        }
Exemplo n.º 4
0
        public void OneHundredPointsDifferenceInColor()
        {
            var color1 = RGBColor.FromRGB8bit(100, 150, 105);
            var color2 = RGBColor.FromRGB8bit(100, 250, 105);

            var result =
                ColorDifferenceAnalyzer.ComputeColorDifference(ColorConverter.ToLab(color1),
                                                               ColorConverter.ToLab(color2));

            Assert.AreEqual(27.275115148843373d, result);
        }
Exemplo n.º 5
0
        public void OnePointDifferenceInColor()
        {
            var color1 = RGBColor.FromRGB8bit(100, 150, 105);
            var color2 = RGBColor.FromRGB8bit(101, 150, 105);

            var result =
                ColorDifferenceAnalyzer.ComputeColorDifference(ColorConverter.ToLab(color1),
                                                               ColorConverter.ToLab(color2));

            Assert.AreEqual(0.20453188911597528d, result);
        }
Exemplo n.º 6
0
 public void AddColor(int x, int y, byte r, byte g, byte b)
 {
     _data[x, y] = ColorConverter.ToLab(RGBColor.FromRGB8bit(r, g, b));
 }