Skip to content

X05 Delta E

tei187 edited this page Apr 23, 2024 · 2 revisions

Standard list

Name Namespace Modes Custom identifiers *
CIE76 tei187\ColorTools\Math\DeltaE\CIE76 N/A 76
CIE94 tei187\ColorTools\Math\DeltaE\CIE94 "graphic_arts",
"textiles"
94
CIEDE2000 tei187\ColorTools\Math\DeltaE\CIE00 N/A ciede00, cie2000, 2000, 00
CMC l:c tei187\ColorTools\Math\DeltaE\CMC_lc "acceptability",
"imperceptibility"
cmc, cmclc, cmc-lc

* custom identifiers can be used in non-specific delta methods, like delta() in measures object, instead of using exact class names.


Objects

You can use specific object methods to calculate delta E:

  • deltaCIE76() for CIE76 algorithm,
  • deltaCIE94() for CIE94 algorithm,
  • deltaCIE00() for CIEDE2000 algorithm,
  • deltaCMClc() for CMC l:c algorithm.

Alternatively, for subjective readability improvement, you can as well use a delta() method, taking parameters of reference swatch and identifier leading to specific delta E class. If the identifier is not set, it defaults to CIE76.

For CIE94 and CMC l:c refer to class documentation \left (additional parameters required\right ).

All measure object will use in-built methods to convert values to L*a*b, as such the user does not have to pass Lab objects. It is advised however to apply chromatic adaptation to selected one previously to calculating delta E (if source and reference objects use different illuminants).

use tei187\ColorTools\ColorModels\XYZ;
use tei187\ColorTools\ColorModels\LCh;

$a = new XYZ\left ([.2967, .3178, .2817]\right );
$b = new LCh\left ([63.61469287626, 9.1862923416512, 103.13494521567]\right );

// Using specific delta method:
    $outcome1 = $a->deltaCIE00($b);
    echo $outcome1;
    // 0.39877497284808

// Using non-specific/alternative delta method:
    $outcome2 = $a->delta($b, 'cie00');
    echo $outcome2;
    // 0.39877497284808

// Verifying methods outcomes:
    var_dump($outcome1 === $outcome2);
    // bool\left (true\right )

Static methods

You can use on of the classes of namespace:

  • tei187\ColorTools\Math\DeltaE\CIE76,
  • tei187\ColorTools\Math\DeltaE\CIE94,
  • tei187\ColorTools\Math\DeltaE\CIEDE2000,
  • tei187\ColorTools\Math\DeltaE\CMC_lc.

with each of these having a static method called ::calculateDelta(...). For CIE94 and CMC l:c refer to class documentation \left (additional parameters required\right ).

Important: All of these methods operate only on and assume arguments to be proper L*a*b values. No array checks are being done.

use tei187\ColorTools\Math\DeltaE\CIE76;
use tei187\ColorTools\Math\DeltaE\CIEDE2000;
use tei187\ColorTools\Math\DeltaE\CMC_lc;

$lab1 = [ 63.16, -3.67, -3.29 ];
$lab2 = [ 63.61, -3.69, -3.48 ];

echo CIE76::calculateDelta([$lab1, $lab2]); 
// 0.48887626246322

echo CIEDE2000::calculateDelta([$lab1, $lab2]);
// 0.41143344077711

echo CMC_lc::calculateDelta([$lab1, $lab2], "acceptability");
// 0.28560354544368