gtaylor/python-colormath

D50 Spectral Power Distribution

tenberg opened this issue · 6 comments

Greg & | Michael,

I was doing some color conversion testing using colormath and I have a few questions. For example, I took one spectral color, converted it to CIELAB (D50/2) and noticed that the results I calculated in Matlab are slightly different from those of colormath. I double checked my Matlab results with some internal / external software here at work and was able to get agreement in the 2nd/3rd decimal point. Colormath was different in the 1st decimal point in the a_/b_ channels. Long story short, I did some digging and the color matching functions appear correct, but I noticed some differences in the D50 illuminant spectral power distribution that may be causing the differences. I don't have anything conclusive yet, but I was wondering where the colormath D50 spectral values were obtained.

Anyway, here is an example.

spc = SpectralColor(
observer='2', illuminant='d50',
spec_380nm=0.1115, spec_390nm=0.2129, spec_400nm=0.4294,
spec_410nm=0.7099, spec_420nm=0.8188, spec_430nm=0.8461,
spec_440nm=0.8615, spec_450nm=0.8693, spec_460nm=0.8696,
spec_470nm=0.8618, spec_480nm=0.8448, spec_490nm=0.8129,
spec_500nm=0.7708, spec_510nm=0.7251, spec_520nm=0.6752,
spec_530nm=0.6365, spec_540nm=0.6244, spec_550nm=0.6118,
spec_560nm=0.583, spec_570nm=0.5608, spec_580nm=0.5583,
spec_590nm=0.5669, spec_600nm=0.5669, spec_610nm=0.5548,
spec_620nm=0.5444, spec_630nm=0.5475, spec_640nm=0.5697,
spec_650nm=0.6026, spec_660nm=0.6356, spec_670nm=0.6538,
spec_680nm=0.6553, spec_690nm=0.6487, spec_700nm=0.6376,
spec_710nm=0.6261, spec_720nm=0.6123, spec_730nm=0.5997)

LabColor(lab_l=82.70112227758003,lab_a=-1.207624444272526,lab_b=-18.721833945990383)

In Matlab, I'm getting [82.7032 -1.1449 -18.8222] which agrees with software I use at work.

Also, this could due to user error, so don't be afraid to tell me I messed up. I'm still learning python.

(I also noticed some differences in D65 when compared to the data I found on the CIE's website
http://www.cie.co.at/index.php/LEFTMENUE/index.php?i_ca_id=298)

Thanks,

Ed

It's been so long since I added those that I'm not even sure where they
came from anymore. It was much harder to find this stuff back in 2007.

If we can update these from verified sources, I'd be all for a pull request
with corrections.
On Aug 22, 2014 5:00 PM, "tenberg" notifications@github.com wrote:

Greg & | Michael,

I was doing some color conversion testing using colormath and I have a few
questions. For example, I took one spectral color, converted it to CIELAB
(D50/2) and noticed that the results I calculated in Matlab are slightly
different from those of colormath. I double checked my Matlab results with
some internal / external software here at work and was able to get
agreement in the 2nd/3rd decimal point. Colormath was different in the 1st
decimal point in the a_/b_ channels. Long story short, I did some digging
and the color matching functions appear correct, but I noticed some
differences in the D50 illuminant spectral power distribution that may be
causing the differences. I don't have anything conclusive yet, but I was
wondering where the colormath D50 spectral values were obtained.

Anyway, here is an example.

spc = SpectralColor(
observer='2', illuminant='d50',
spec_380nm=0.1115, spec_390nm=0.2129, spec_400nm=0.4294,
spec_410nm=0.7099, spec_420nm=0.8188, spec_430nm=0.8461,
spec_440nm=0.8615, spec_450nm=0.8693, spec_460nm=0.8696,
spec_470nm=0.8618, spec_480nm=0.8448, spec_490nm=0.8129,
spec_500nm=0.7708, spec_510nm=0.7251, spec_520nm=0.6752,
spec_530nm=0.6365, spec_540nm=0.6244, spec_550nm=0.6118,
spec_560nm=0.583, spec_570nm=0.5608, spec_580nm=0.5583,
spec_590nm=0.5669, spec_600nm=0.5669, spec_610nm=0.5548,
spec_620nm=0.5444, spec_630nm=0.5475, spec_640nm=0.5697,
spec_650nm=0.6026, spec_660nm=0.6356, spec_670nm=0.6538,
spec_680nm=0.6553, spec_690nm=0.6487, spec_700nm=0.6376,
spec_710nm=0.6261, spec_720nm=0.6123, spec_730nm=0.5997)

LabColor(lab_l=82.70112227758003,lab_a=-1.207624444272526,lab_b=-18.721833945990383)

In Matlab, I'm getting [82.7032 -1.1449 -18.8222] which agrees with
software I use at work.

Also, this could due to user error, so don't be afraid to tell me I messed
up. I'm still learning python.

(I also noticed some differences in D65 when compared to the data I found
on the CIE's website
http://www.cie.co.at/index.php/LEFTMENUE/index.php?i_ca_id=298)

Thanks,

Ed


Reply to this email directly or view it on GitHub
#47.

Would love some other eyes on this. @MichaelMauderer have any thoughts?

Just had a look at D65 colormath vs CIE. My guess is, that the colormath is a re-sampled version of the CIE one (using less samples).

That seems consistent with the observation of similar, but not quite the same results.

@tenberg Sorry for letting this sit. Would this be something you would be interested in preparing a pull request for? It'd involve updating the definitions, the unit tests, and the changelog.

Greg,

No worries, I have been extremely busy with work. I tried updating the D50
illuminant table and color matching functions in python-colormath with
different spectral data, but I couldn't get it to align with the libraries
here at work. I ended up using the ASTM E308 tables and I'm now getting
exact matches. I think this would be a huge update to python-colormath
since the tables I use are precomputed illuminant*colorMatchingFunctions,
not separate tables as defined in python-colormath.

From what I have seen, the CIELAB differences are small between my code and
python-colormath, so I don't think we need to update it. I wanted perfect
agreement between all of the tools here at work... Ah, the toils of a Color
Scientist.

Thanks for all your help,

Ed

On Tue, Dec 9, 2014 at 5:38 PM, Greg Taylor notifications@github.com
wrote:

@tenberg https://github.com/tenberg Sorry for letting this sit. Would
this be something you would be interested in preparing a pull request for?
It'd involve updating the definitions, the unit tests, and the changelog.


Reply to this email directly or view it on GitHub
#47 (comment)
.

Ed

Unless there are any objections, I'll close this one. I'm open to feedback as to whether this is necessary, but don't have strong enough feelings to take this task on myself.