File: C:/xampp/htdocs/deltaE/de00T.php
<?php
# ------- The graph values in the form of associative array
function de00T($l1,$a1,$b1,$l2,$a2,$b2) {
$C1 = sqrt(pow($a1,2) + pow($b1,2));
$C2 = sqrt(pow($a2,2) + pow($b2,2));
$meancO = ($C1 + $C2) / 2;
$logmeanc =log10($meancO);
$log25 = log10(25);
$cratio = sqrt(pow(10,($logmeanc*7 - log10((pow(10,($logmeanc*7)) + pow(10,($log25*7)))))));
$g = 0.5 * (1 - $cratio);
$a1 = (1 + $g) * $a1;
$a2 = (1 + $g) * $a2;
$C1 = sqrt(pow($a1,2) + pow($b1,2));
$C2 = sqrt(pow($a2,2) + pow($b2,2));
//';calculate hue angles
If ($b1 == 0) {
If ($a1 >= 0) {
$h1 = 0;}
Else {
$h1 = 180;}}
Else {
$h1 = rad2deg(atan2($b1, $a1));
}
If ($b2 == 0) {
If ($a2 >= 0) {
$h2 = 0;}
Else {
$h2 = 180; }
}
Else {
$h2 = rad2deg(atan2($b2, $a2));
}
If ($h1 < 0) {
$h1 = $h1 + 360;}
If ($h2 < 0) {
$h2 = $h2 + 360;}
/////////////////////////////////
if (abs($h1-$h2)<180) {
$dhm = $h2-$h1;
}
else{
$dhm=360-abs($h1-$h2);
}
$meanh = $h1 + $h2;
If ($dhm > 180) {
$dhm = $dhm - 360;
$meanh = $meanh - 360;
}
If ($dhm < -180) {
$dhm = $dhm + 360;
$meanh = $meanh - 360;
}
$meanh = $meanh / 2;
$T=1-0.17*cos(deg2rad($meanh-30))+0.24*cos(deg2rad(2*$meanh))+0.32*cos(deg2rad(3*$meanh+6))-0.2*cos(deg2rad(4*$meanh-63));
$SH=1+0.015*(($C2+$C1)/2)*$T;
$dH=2*pow(($C2*$C1),0.5)*sin(deg2rad($dhm/2));
$SC=1+0.045*($C1+ $C2)/2;
$dC=$C2 - $C1;
$SL=1+(0.015*pow((($l2+$l1)/2-50),2))/pow((20+pow((($l2+$l1)/2-50),2)),0.5);
$dL=$l1 - $l2;
$KL=1;$KC=1;$KH=1;
$meanc=($C1+$C2)/2;
$theta=30*EXP(-(pow((($meanh-275)/25),2)));
$RC=2*pow(pow($meanc,7)/(pow($meanc,7)+pow(25,7)),0.5);
$RT=-sin(2*deg2rad($theta))*$RC;
$deltaE2000x=pow((pow(($dL/($SL*$KL)),2)+pow(($dC/($SC*$KC)),2)+pow(($dH/($SH*$KH)),2)+$RT*($dC/($SC*$KC))*($dH/($SH*$KH))),0.5);
//echo "de00:".$meanc."<br>";
return $deltaE2000x;
}
?>