コード例 #1
0
        public static int DoFullCompare(int R1, int G1, int B1, int R2, int G2, int B2)
        {
            DeltaECalculation oColor1 = new DeltaECalculation(R1, G1, B1);
            DeltaECalculation oColor2 = new DeltaECalculation(R2, G2, B2);

            return(oColor1.CompareTo(oColor2));
        }
コード例 #2
0
        ///
        /// The smaller the number returned by this, the closer the colors are
        ///
        ///
        ///
        public int CompareTo(DeltaECalculation oComparisionColor)
        {
            // Based upon the Delta-E (1976) formula at easyrgb.com (http://www.easyrgb.com/index.php?X=DELT&H=03#text3)
            double DeltaE = Math.Sqrt(Math.Pow((CieL - oComparisionColor.CieL), 2) + Math.Pow((CieA - oComparisionColor.CieA), 2) + Math.Pow((CieB - oComparisionColor.CieB), 2));

            return(Convert.ToInt16(Math.Round(DeltaE)));
        }