Skip to content

Instantly share code, notes, and snippets.

@KelSolaar
Created December 4, 2017 20:45
Show Gist options
  • Save KelSolaar/9b9280c0daf522f82fb40aa3398ff475 to your computer and use it in GitHub Desktop.
Save KelSolaar/9b9280c0daf522f82fb40aa3398ff475 to your computer and use it in GitHub Desktop.
CIE L*a*b* to Munsell Colour
import colour
import numpy as np
# CIE L*a*b* input data
Lab = np.array([79.57, -1.61, 13.05])
# Assumed illuminant used for CIE L*a*b* measurements, could be D65.
illuminant_t = colour.ILLUMINANTS[
'CIE 1931 2 Degree Standard Observer']['D50']
# Munsell Renotation System illuminant.
illuminant_r = colour.ILLUMINANTS[
'CIE 1931 2 Degree Standard Observer']['C']
XYZ = colour.Lab_to_XYZ(Lab, illuminant_t)
XYZ_a = colour.chromatic_adaptation_VonKries(
XYZ, colour.xy_to_XYZ(illuminant_t), colour.xy_to_XYZ(illuminant_r))
xyY = colour.XYZ_to_xyY(XYZ_a)
munsell_colour = colour.xyY_to_munsell_colour(xyY)
print(munsell_colour)
# 7.4Y 7.9/1.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment