Skip to content

Fix issues, add CIE XYBri support, add Initial PHPUnit tests and Travis support. #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

matthewbaggett
Copy link

No description provided.

@matthewbaggett
Copy link
Author

Fix issues, add CIE XYBri support, add Initial PHPUnit tests and Travis support.

@DeannaGelbart
Copy link

DeannaGelbart commented Jul 19, 2016

getDistanceLabFrom() is not a Euclidean distance since it uses abs() instead of squaring
https://en.wikipedia.org/wiki/Color_difference#CIE76

Once I make the change the result seems to match http://colormine.org/delta-e-calculator (I only checked one color pair in the calculator so I didn't test exhaustively).

Here is my fixed version

public function getEuclideanDistanceLab(Color $color1, Color $color2)
{
    $lab1 = $color1->toLabCie();
    $lab2 = $color2->toLabCie();

    $lDiff = ($lab2['l'] - $lab1['l'])*($lab2['l'] - $lab1['l']);
    $aDiff = ($lab2['a'] - $lab1['a'])*($lab2['a'] - $lab1['a']);
    $bDiff = ($lab2['b'] - $lab1['b'])*($lab2['b'] - $lab1['b']);

    $delta = sqrt($lDiff + $aDiff + $bDiff);

    return $delta;
}

I can submit a PR but I want to check first that this project is still active?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants