📌  相关文章
📜  javascript 比较 2 个阈值颜色 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:49.054000             🧑  作者: Mango

代码示例1
typedef struct {
     unsigned char r, g, b;
} RGB;

double ColourDistance(RGB e1, RGB e2)
{
    long rmean = ( (long)e1.r + (long)e2.r ) / 2;
    long r = (long)e1.r - (long)e2.r;
    long g = (long)e1.g - (long)e2.g;
    long b = (long)e1.b - (long)e2.b;
    return sqrt((((512+rmean)*r*r)>>8) + 4*g*g + (((767-rmean)*b*b)>>8));
}