def YCbCr2100Const(xyz, saturation, white_point): wp = np.array(white_point) bt2020 = colour.RGB_COLOURSPACES['ITU-R BT.2020'] data = 100 * colour.XYZ_to_RGB(xyz, wp, bt2020.whitepoint, bt2020.XYZ_to_RGB_matrix, 'CAT02', cctf_encoding=None) data = colour.RGB_to_ICTCP(data) data[..., 1] = saturation * data[..., 1] data[..., 2] = saturation * data[..., 2] data = colour.ICTCP_to_RGB(data) return 0.01 * colour.RGB_to_XYZ(data, bt2020.whitepoint, wp, bt2020.RGB_to_XYZ_matrix, 'CAT02', cctf_encoding=None)
# -*- coding: utf-8 -*- """ Showcases *ICTCP* *colour encoding* computations. """ import numpy as np import colour from colour.utilities import message_box message_box('"ICTCP" Colour Encoding Computations') RGB = np.array([0.45620519, 0.03081071, 0.04091952]) message_box(('Converting from "ITU-R BT.2020" colourspace to "ICTCP" colour ' 'encoding given "RGB" values:\n' '\n\t{0}'.format(RGB))) print(colour.RGB_to_ICTCP(RGB)) print('\n') ICTCP = np.array([0.07351364, 0.00475253, 0.09351596]) message_box(('Converting from "ICTCP" colour encoding to "ITU-R BT.2020" ' 'colourspace given "ICTCP" values:\n' '\n\t{0}'.format(ICTCP))) print(colour.ICTCP_to_RGB(ICTCP))
def convertData(xyz): data = 100 * colour.XYZ_to_RGB(xyz, wp, bt2020.whitepoint, bt2020.XYZ_to_RGB_matrix, 'CAT02', cctf_encoding=None) return colour.RGB_to_ICTCP(data)
output = np.zeros((resolution ** 3, 3)) divisor = 1.0 / (resolution - 1) for r in range(resolution): for g in range(resolution): for b in range(resolution): idx = r * resolution * resolution + g * resolution + b output[idx, 0] = r * divisor output[idx, 1] = g * divisor output[idx, 2] = b * divisor if not transfer_curve is None: output = transfer_curve(output) return output bt2020 = colour.RGB_COLOURSPACES['ITU-R BT.2020'] itur_bt709_hull = createHull(transfer_curve=lambda x: colour.RGB_to_YCbCr(x, out_legal=False)) ictcp_hull = createHull(transfer_curve=lambda x: colour.RGB_to_ICTCP(colour.models.rgb.transfer_functions.st_2084.eotf_ST2084(x * colour.models.rgb.transfer_functions.st_2084.eotf_inverse_ST2084(1000)))) jzazbz_hull = createHull(transfer_curve=lambda x: colour.XYZ_to_JzAzBz(colour.RGB_to_XYZ(colour.models.rgb.transfer_functions.st_2084.eotf_ST2084(x * colour.models.rgb.transfer_functions.st_2084.eotf_inverse_ST2084(1000)), bt2020.whitepoint, bt2020.whitepoint, bt2020.RGB_to_XYZ_matrix, None, None))) colors = ['r', 'g', 'b', 'c', 'm', 'y'] line_style = ['--', '-.'] line_point_marker = '+' scatter_marker = ['o', '*', 'x'] hue_line_color = '0.65' hue_line_style = ':' hue_point_style = '.'