def plot_uv(lines = [], scatter = [], hue_lines = [], white_point = (1.0/3, 1.0/3), show_diagram_colours=False, filename = None, save_only = False): """ Plot uv chromaticities in the CIE1976UCS space. lines and scatters data prepared as in plotAll """ # TODO: Background color colour.plotting.plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS(colourspaces=['sRGB', 'DCI-P3'], standalone=False, show_whitepoints = False, show_diagram_colours=show_diagram_colours) if not white_point is None: wp_uv = colour.xy_to_Luv_uv(np.array(white_point)) plt.scatter(wp_uv[0], wp_uv[1], c='k') for data,label in hue_lines: uv = colour.xy_to_Luv_uv(data) plt.plot(uv[...,0], uv[...,1], label=label, color=hue_line_color, linestyle=hue_line_style, marker=hue_point_style) cnt = 0 for data,label in lines: uv = colour.xy_to_Luv_uv(data) lstyle = lineStyle(cnt) plt.plot(uv[...,0], uv[...,1], label=label, color=lstyle[0], linestyle=lstyle[2], marker=lstyle[1]) cnt += 1 for data,label in scatter: uv = colour.xy_to_Luv_uv(data) c,m = scatterStyle(cnt) plt.scatter(uv[...,0], uv[...,1], label=label, c=c, marker=m) cnt += 1 plt.xlim(-0.05, 0.65) plt.ylim(-0.03, 0.65) if filename: filename = filename.format('uv') fig = colour.plotting.render(standalone=True, x_tighten=True, y_tighten=True, filename=filename, transparent_background=False)
print('\n') uv = np.array([0.1508531, 0.48532971]) message_box(('Converting to "xy" chromaticity coordinates from given ' '"CIE L*u*v*" colourspace "u"v"" chromaticity coordinates:\n' '\n\t{0}'.format(uv))) print(colour.Luv_uv_to_xy(uv)) print('\n') xy = np.array([0.26414771, 0.37770001]) message_box(('Converting to "CIE L*u*v*" colourspace "u"v"" chromaticity ' 'coordinates from given "xy" chromaticity coordinates:\n' '\n\t{0}'.format(xy))) print(colour.xy_to_Luv_uv(xy)) print('\n') message_box(('Converting to "CIE L*C*Huv" colourspace from given "CIE L*u*v*" ' 'colourspace values:\n' '\n\t{0}'.format(Luv))) print(colour.Luv_to_LCHuv(Luv)) print('\n') LCHuv = np.array([37.9856291, 24.67169031, 160.09535205]) message_box(('Converting to "CIE L*u*v*" colourspace from given "CIE L*C*Huv" ' 'colourspace values:\n' '\n\t{0}'.format(LCHuv))) print(colour.LCHuv_to_Luv(LCHuv))
def VAC(xy, xy_wp): uv = colour.xy_to_Luv_uv(xy) wp = colour.xy_to_Luv_uv(xy_wp) theta = math.atan2(uv[1] - wp[1], uv[0] - wp[0]) return 0.4462 * pow( 1.0 + (-0.1340 * q(theta) + 0.0872 * K_Br) * s(uv, wp) + 0.3086, 3)
"""Showcases Helmholtz—Kohlrausch effect estimation computations.""" import colour from colour.plotting import colour_style, plot_multi_colour_swatches from colour.utilities import message_box wp = colour.xy_to_Luv_uv([0.31271, 0.32902]) average_luminance = 0.14 swatches = [ [0.45079660, 0.52288689], [0.19124902, 0.55444488], [0.13128455, 0.51210591], [0.14889223, 0.37091478], [0.28992574, 0.30964533], ] swatches_XYZ = [] for patch in swatches: in_XYZ = colour.Luv_to_XYZ(colour.uv_to_Luv(patch)) swatches_XYZ.append(in_XYZ * (average_luminance / in_XYZ[1])) # Adapting Luminance, 250 cd/m^2 represents a typical modern computer # display peak luminance. L_a = 250 * average_luminance bg_grey = colour.xy_to_XYZ(colour.Luv_uv_to_xy(wp)) * average_luminance swatches_normal = [] swatches_VCC = [] swatches_VAC = []