嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 3 元微信扫码支付:3 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
将RGB转换成Lab,使用CIE2000公式计算色差
private double CIE2000(double[] lab1, double[] lab2)
{
double L1 = lab1[0], a1 = lab1[1], b1 = lab1[2];
double L2 = lab2[0], a2 = lab2[1], b2 = lab2[2];
double C1 = Math.Sqrt(a1 * a1 b1 * b1), C2 = Math.Sqrt(a2 * a2 b2 * b2);
double LSub_ = L2 - L1;
double LMean = (L1 L2) / 2;
double CMean = (C1 C2) / 2;
double a1_ = a1 a1 / 2 * (1 - Math.Sqrt(Math.Pow(CMean, 7) / (Math.Pow(CMean, 7) Math.Pow(25, 7))));
double a2_ = a2 a2 / 2 * (1 - Math.Sqrt(Math.Pow(CMean, 7) / (Math.Pow(CMean, 7) Math.Pow(25, 7))));
double C1_ = Math.Sqrt(a1_ * a1_ b1 * b1), C2_ = Math.Sqrt(a2_ * a2_ b2 * b2);
double CMean_ = (C1_ C2_) / 2, CSub_ = C2_ - C1_;
double h1_ = Math.Atan2(b1, a1_), h2_ = Math.Atan2(b2, a2_);
double hSub_ = Math.Abs(h1_ - h2_) <= 180 ? h2_ - h1_ : h2_ <= h1_ ? h2_ - h1_ 360 : h2_ - h1_ - 360;
double HSub_ = 2 * Math.Sqrt(C1_ * C2_) * Math.Sin(hSub_ / 2);
double HMean_ = Math.Abs(h1_ - h2_) > 180 ? (h1_ h2_ 360) / 2 : (h1_ h2_) / 2;
double T = 1 - 0.17 * Math.Cos(HMean_ - 30) 0.24 * Math.Cos(2 * HMean_)
0.32 * Math.Cos(3 * HMean_ 6) - 0.2 * Math.Cos(4 * HMean_ - 63);
double SL = 1 0.015 * Math.Pow(LMean - 50, 2) / Math.Sqrt(20 Math.Pow(LMean - 50, 2));
double SC = 1 0.045 * CMean_, SH = 1 0.015 * CMean_ * T;
double RT = -2 * Math.Sqrt(Math.Pow(CMean_, 7) / (Math.Pow(CMean_, 7) Math.Pow(25, 7))) *
Math.Sin(60 * Math.Exp(-Math.Pow((HMean_ - 275) / 25, 2)));
double result = Math.Sqrt(Math.Pow(LSub_ / SL, 2) Math.Pow(CSub_ / SC, 2) Math.Pow(HSub_ / SH, 2)
RT * CSub_ / SC * HSub_ / SH);
return result;
}