Giter VIP home page Giter VIP logo

Comments (2)

tompazourek avatar tompazourek commented on August 25, 2024

Hi Mike, thanks for reaching out! :-)

I'd guess that the values colormine gives you are wrong.

My process for the conversion you specified is following:

  • I assume that the RGB working space is sRGB (note that this can be changed in RGBColor constructor), which is the most commonly used
  • I convert it to linear RGB using the inverse companding process defined in the working space - for sRGB I use the process described here
  • After I got RGB with linear channels, I convert it to XYZ using a conversion matrix that is constructed from the chromaticity primaries of the sRGB color space, the result will be an XYZ color with reference white point D65 (because sRGB has reference white point D65)
  • Then I need to do convert XYZ to LAB color space. But when we talk about LAB color space, we usually mean LAB color space with reference white point D50 (Photoshop uses it as well), so a chromatic adaptation from D65 to D50 needs to be performed
  • For the chromatic adaptation, I use the standard Von Kries chromatic adaptation that transforms the colors to LMS color space inside, and I am using Bradford LMS transform matrix (also used in CMCCAT97) for that
  • After the chromatic adaptation, I have an XYZ color with reference to D50, which I can convert to LAB using this method

This whole process in Colourful is designed based on the information I collected from Bruce Lindbloom's website with some of my own research of the topic (mainly regarding the existing chromatic adaptation methods).

I tested the input values with this calculator: http://www.brucelindbloom.com/index.html?ColorCalculator.html and the values match. Try entering 0, 1, 0 to RGB, the default settings of that calculator should be the same as default settings of ColourfulConverter class, then the LAB coefficients should match the ones generated by Colourful.

For a second test, try Wolfram Alpha, their values also agree with mine.

My process is very thorough there, and I assume that colormine just multiplies the RGB vector with some hardcoded matrix to get the XYZ values, which might not be 100% correct.

If you face any other issues, feel free to ask :-)

from colourful.

tompazourek avatar tompazourek commented on August 25, 2024

Closing this now. Feel free to reopen for a follow-up.

from colourful.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.