Skip to content
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

Specrtal range and Color-matching functions #12

Open
Roger-Breton opened this issue Mar 29, 2024 · 13 comments
Open

Specrtal range and Color-matching functions #12

Roger-Breton opened this issue Mar 29, 2024 · 13 comments

Comments

@Roger-Breton
Copy link

First, what is the spectral range of the SPD_C and so on variables?
Is it 380 to 730?
Second, what CIE_CMF_X / Y / Z are you using?
Is it the 1931 2 degree CMF or the 1964 10 degree CMF?
Comparing with CIE published data, I can't make where you got the numbers from?

@Roger-Breton
Copy link
Author

OK, I established that the CMF are indeed the 1931/2. But the values are incorrect.
Still, it would help if you disclosed the spectral range.
Right now, I'm going to have to replace your CMFs with the "proper" CIE XYZ CMF. Otherwise, I can't follow your logic.
Also, I looked at SPD_C/M/Y/R/G/B and it appears you used "Block dye" approach.
Again, I'm going to replace those with real pigment information.

@rvanwijnen
Copy link
Owner

Hi Roger,

I'm very interested in the things you are planning to do with real pigment data using the spectral.js library as reference, please keep me posted on your progress.

To get in some more technical details and provide some answers for your questions;
The CMF are CIE 1931 2deg.
The spectral range is 380 to 730 in 10 nm steps.
As this library is specifically aimed for sRGB output the D65 standard illuminant is used.

The CIE CMF arrays are multiplied with the D65 illuminant and then normalized by the summed value of Y to get the tristimulus (XYZ bar) values used for further calculations.
(The summed values for the XYZ bar are 0.95, 1.00 and 1.08 which should be familiar: Standard illuminant - Wikipedia)
This is similar to what ColorPy does: ColorPy.

I have created an online spreadsheet for you to see how I calculated the arrays: Spreadsheet.

The sources I used are coming directly from CIE:
CMF
D65

The SPD's used for the different colors are generated based on work done by Scott Burns and are not representative of real world pigments.
They are 'best fit' for the specific color using the CMF with the D65 illuminant: Generating Reflectance Curves from sRGB Triplets.

@Roger-Breton
Copy link
Author

Hi rvan,

As I searched my file library and CIE documentation for references with regards to your "CMF", it dawned on me that you could have pre-multiplied the functions by the normalization constant "k", in an effort to simplify and speed up the code, since your code is aimed at "performance". But I wasn't entirely sure. Your approach is sound and I will lookup ColorPy for curiosity :-)

My orientation is "graphic arts". I live in a world of Photoshop and ICC profiling color management. I took a seminar at Munsell Color Science Institute in Rochester, many ears ago, and I recently became intersted in "acrylic prigments" mixing. To make a long story short, I ended up on this web site, https://goldenartistcolors.com/mixer/acrylic, where visitors can experiment color mixing based on Kubelka-Monk. I use paints by Liquitex but they seem to have much in common with these guys's paints. The part I was especially interested was the ability to load up an RGB image, click on some pixels and have the system suggest tubes of paints with quanitites of each to match the color. Wow! I still don't know how I am going to introduce this "notion" into my Photoshop class at the university where I teach (www.uqam.com) in Montréal.

At this point, my goal is to understand the application of the Kulbelka-Monk theory in practice and your Spectral.js implementation is the closest thing I found on the internet to step by step application.

You see, when I look at an image and try to match the color, I may get the intuition of which paints to mix but it is not obvious especially with certain colors? That is why I was looking for a way to overcome this lack of experience at mixing artists acrylic paints. One of the ways I think I'm going to introduce this technique to my students is to select a number of colors out of an sRGB image and use the Golden system to figure which paints to mix in order to match the color.

I realize with experience, a person could evolve a way to mix paints without the need to use a computerized matching system. But with my Graphic design Photoshop students, I am trying to come up with approaches that will speed up their learning.

So, one of the things I intend to do is to substite your "block dyes" (CMYRGB) with actual spectral reflectances and I think the best way to experiement would be to use ColorChecker spectral reflectances for the Cyan, Magenta, Yellow, Red, Green and Blue patches.

Another thing I will do is to come up with D50 "CMF" because Photoshop is D50 and all the student's "interactions" with color is through Photoshop. I want to avoid the complications of chromatic adaptation.

I'm curious about your RGB "Spectral Reflectance Estimation" technique?
At the begining of your code, you ask to "spectral_mix([0, 33, 133], [252, 210, 0], 0.5)". In other words, to mix 50% of two RGB colors. I will have to study how the linear_to_reflectance(lrgb) function constructs spectral reflectances from RGB values:
Spectral Estimatino of RGB values

@Roger-Breton
Copy link
Author

Found the Scott Burns "Color Projects" web page.
I think I would use my own custom-measured 1931/2 D50 Munsell spectral reflectances...
But the RGB -> spectral reflectances is incredible!!

@Roger-Breton
Copy link
Author

Roger-Breton commented Apr 4, 2024 via email

@Roger-Breton
Copy link
Author

Roger-Breton commented Apr 4, 2024 via email

@Roger-Breton
Copy link
Author

Roger-Breton commented Apr 4, 2024 via email

@rvanwijnen
Copy link
Owner

Hi Roger,

The images are not showing for me.

A lot of the information for creating this library comes from the Mixbox paper, this can be found on their repositorie: https://github.com/scrtwpns/mixbox

@Roger-Breton
Copy link
Author

Roger-Breton commented Apr 25, 2024 via email

@Roger-Breton
Copy link
Author

Roger-Breton commented Apr 27, 2024 via email

@Roger-Breton
Copy link
Author

Roger-Breton commented Apr 28, 2024 via email

@rvanwijnen
Copy link
Owner

I can’t see the images you posted, I DM’d you on X.

@Roger-Breton
Copy link
Author

Sorry about emailing you directly.
KM vs Adobe
Here is one image that speaks volume.
I suppose, to be able to make a true generalization, I would have to try the comparison using a number of other pigment colors.
Ideally, I would like to write a javascript that runs inside of Adobe InDesign. Adapting your javascript. But I confess I have not wrote much javascript in my life.
When I introduce my students to the concept of "color blending", you can be sure I will send them to "spectral.js" where they will be able to simply enter two RGB colors and use the generated blends in their creations.

I am continuing my KM research with the "Two-Constants" approach. Much harder... But I have you to thank for showing me how "Single-Constant" works.

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

No branches or pull requests

2 participants