def my_HVC2RGB(HVC): xyY = colour.munsell_colour_to_xyY(HVC) XYZ = colour.xyY_to_XYZ(xyY) # The last step will involve using the *Munsell Renotation System* # illuminant which is *CIE Illuminant C*: # http://nbviewer.ipython.org/github/colour-science/colour-ipython/blob/master/notebooks/colorimetry/illuminants.ipynb#CIE-Illuminant-C # It is necessary in order to ensure white stays white when # converting to *sRGB* colourspace and its different whitepoint # (*CIE Standard Illuminant D65*) by performing chromatic # adaptation between the two different illuminant. rgb = colour.XYZ_to_sRGB(XYZ, C) RGB = [np.uint8(round(255 * x)) for x in rgb] return RGB
message_box(('Computing "Munsell" value using McCamy (1987) method for ' 'given "luminance" value:\n' '\n\t{0}'.format(Y))) print(colour.munsell_value_McCamy1987(Y)) print(colour.munsell_value(Y, method='McCamy 1987')) print('\n') message_box(('Computing "Munsell" value using ASTM D1535-08e1 (2008) method ' 'for given "luminance" value:\n' '\n\t{0}'.format(Y))) print(colour.munsell_value_ASTMD153508(Y)) print(colour.munsell_value(Y, method='ASTM D1535-08')) print('\n') xyY = (0.38736945, 0.35751656, 0.59362000) message_box(('Converting to "Munsell" colour from given "CIE xyY" ' 'colourspace values:\n' '\n\t{0}'.format(xyY))) print(colour.xyY_to_munsell_colour(xyY)) print('\n') for munsell_colour in ('4.2YR 8.1/5.3', 'N8.9'): message_box(('Converting to "CIE xyY" colourspace from given "Munsell" ' 'colour:\n' '\n\t{0}'.format(munsell_colour))) print(colour.munsell_colour_to_xyY(munsell_colour)) print('\n')
message_box(('Computing "Munsell" value using "McCamy (1987)" method for ' 'given "luminance" value:\n' '\n\t{0}'.format(Y))) print(colour.munsell_value(Y, method='McCamy 1987')) print(colour.notation.munsell_value_McCamy1987(Y)) print('\n') message_box(('Computing "Munsell" value using "ASTM D1535-08e1" method ' 'for given "luminance" value:\n' '\n\t{0}'.format(Y))) print(colour.munsell_value(Y, method='ASTM D1535-08')) print(colour.notation.munsell_value_ASTMD153508(Y)) print('\n') xyY = np.array([0.38736945, 0.35751656, 0.59362000]) message_box(('Converting to "Munsell" colour from given "CIE xyY" ' 'colourspace values:\n' '\n\t{0}'.format(xyY))) print(colour.xyY_to_munsell_colour(xyY)) print('\n') for munsell_colour in ('4.2YR 8.1/5.3', 'N8.9'): message_box(('Converting to "CIE xyY" colourspace from given "Munsell" ' 'colour:\n' '\n\t{0}'.format(munsell_colour))) print(colour.munsell_colour_to_xyY(munsell_colour)) print('\n')