Color Distance - CSharp System.Drawing

CSharp examples for System.Drawing:Color

Description

Color Distance

Demo Code


using System.Collections.Generic;
using System.Drawing;
using System;//from  w w  w .j  a v a2 s .  c o m

public class Main{
        private static double ColorDistance(Color C1, Color C2)
        {
            double rdiff = C1.R - C2.R;
            double gdiff = C1.G - C2.G;
            double bdiff = C1.B - C2.B;
            return Math.Sqrt(rdiff * rdiff + gdiff * gdiff + bdiff * bdiff);
        }
}

Related Tutorials