Ejemplo n.º 1
0
message_box('"CAM16" Colour Appearance Model Computations')

XYZ = np.array([19.01, 20.00, 21.78])
XYZ_w = np.array([95.05, 100.00, 108.88])
L_A = 318.31
Y_b = 20.0
surround = colour.CAM16_VIEWING_CONDITIONS['Average']
message_box(
    ('Converting to "CAM16" colour appearance model specification '
     'using given parameters:\n'
     '\n\tXYZ: {0}\n\tXYZ_w: {1}\n\tL_A: {2}\n\tY_b: {3}'
     '\n\tSurround: {4}\n\n'
     'Warning: The input domain of that definition is non standard!').format(
         XYZ, XYZ_w, L_A, Y_b, surround))
specification = colour.XYZ_to_CAM16(XYZ, XYZ_w, L_A, Y_b, surround)
print(specification)

print('\n')

J = 41.73120791
C = 0.10335574
h = 217.06795977
specification = colour.CAM16_Specification(J, C, h)
message_box(
    ('Converting to "CIE XYZ" tristimulus values using given '
     'parameters:\n'
     '\n\tJ: {0}\n\tC: {1}\n\th: {2}\n\tXYZ_w: {3}\n\tL_A: {4}'
     '\n\tY_b: {5}\n\n'
     'Warning: The output range of that definition is non standard!').format(
         J, C, h, XYZ_w, L_A, Y_b))
Ejemplo n.º 2
0
    )
)

print("\n")

RGB = np.array([0.45675795, 0.30986982, 0.24861924])
message_box(
    f'Converting to the "CAM16-UCS" colourspace from given "Output-Referred" '
    f'"sRGB" colourspace values:\n\n\t{RGB}'
)
print(colour.convert(RGB, "Output-Referred RGB", "CAM16UCS"))
specification = colour.XYZ_to_CAM16(
    colour.sRGB_to_XYZ(RGB) * 100,
    XYZ_w=colour.xy_to_XYZ(
        colour.CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"]
    )
    * 100,
    L_A=64 / np.pi * 0.2,
    Y_b=20,
)
print(
    colour.JMh_CAM16_to_CAM16UCS(
        colour.utilities.tstack(
            [
                specification.J,
                specification.M,
                specification.h,
            ]
        )
    )
    / 100
Ejemplo n.º 3
0
print(colour.convert(sd, 'Spectral Distribution', 'sRGB'))
print(
    colour.XYZ_to_sRGB(
        colour.sd_to_XYZ(sd, illuminant=colour.ILLUMINANTS_SDS['D65']) / 100))

print('\n')

RGB = np.array([0.45675795, 0.30986982, 0.24861924])
message_box(('Converting to "CAM16-UCS" colourspace from given '
             '"Output-Referred" "sRGB" colourspace values:\n'
             '\n\t{0}'.format(RGB)))
print(colour.convert(RGB, 'Output-Referred RGB', 'CAM16UCS'))
specification = colour.XYZ_to_CAM16(
    colour.sRGB_to_XYZ(RGB) * 100,
    XYZ_w=colour.xy_to_XYZ(
        colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65']) *
    100,
    L_A=64 / np.pi * 0.2,
    Y_b=20)
print(
    colour.JMh_CAM16_to_CAM16UCS(
        colour.utilities.tstack([
            specification.J,
            specification.M,
            specification.h,
        ])) / 100)

print('\n')

Jpapbp = np.array([0.39994811, 0.09206558, 0.0812752])
message_box(('Converting to "Output-Referred" "sRGB" colourspace from given '