"""Showcases *Fairchild (1990)* chromatic adaptation model computations."""

import numpy as np

import colour
from colour.utilities import message_box

message_box('"Fairchild (1990)" Chromatic Adaptation Model Computations')

XYZ_1 = np.array([0.1953, 0.2307, 0.2497])
XYZ_n = np.array([1.1115, 1.0000, 0.3520])
XYZ_r = np.array([0.9481, 1.0000, 1.0730])
Y_n = 200
message_box(
    f'Computing chromatic adaptation using "Fairchild (1990)" chromatic '
    f"adaptation model.\n\n"
    f'\t"XYZ_1": {XYZ_1}\n'
    f'\t"XYZ_n": {XYZ_n}\n'
    f'\t"XYZ_r": {XYZ_r}\n'
    f'\t"Y_n": {Y_n}')
print(
    colour.chromatic_adaptation(XYZ_1,
                                XYZ_n,
                                XYZ_r,
                                method="Fairchild 1990",
                                Y_n=Y_n))
print(
    colour.adaptation.chromatic_adaptation_Fairchild1990(
        XYZ_1 * 100, XYZ_n, XYZ_r, Y_n) / 100)
Ejemplo n.º 2
0
import colour
from colour.utilities import message_box

message_box('"CIE 1994" Chromatic Adaptation Model Computations')

XYZ_1 = np.array([0.2800, 0.2126, 0.0527])
xy_o1 = np.array([0.4476, 0.4074])
xy_o2 = np.array([0.3127, 0.3290])
Y_o = 20
E_o1 = 1000
E_o2 = 1000
message_box(('Computing chromatic adaptation using "CIE 1994" chromatic '
             'adaptation model.\n'
             '\n\t"XYZ_1":\n\t\t{0}\n\t"xy_o1":\n\t\t{1}\n\t"xy_o2":\n\t\t{2}'
             '\n\t"Y_o":\n\t\t{3}\n\t"E_o1":\n\t\t{4}'
             '\n\t"E_o2":\n\t\t{5}\n\n'
             'Warning: The input domain and output range of that definition '
             'are non standard!'.format(XYZ_1, xy_o1, xy_o2, Y_o, E_o1, E_o2)))
print(
    colour.chromatic_adaptation(
        XYZ_1,
        colour.xy_to_XYZ(xy_o1),
        colour.xy_to_XYZ(xy_o2),
        method='CIE 1994',
        Y_o=Y_o,
        E_o1=E_o1,
        E_o2=E_o2))
print(
    colour.adaptation.chromatic_adaptation_CIE1994(XYZ_1 * 100.0, xy_o1, xy_o2,
                                                   Y_o, E_o1, E_o2) / 100.0)
Ejemplo n.º 3
0
print("\n")

message_box(
    "Computing the chromatic adaptation matrix from "
    'the "CIE Standard Illuminant A" to '
    'the "CIE Standard Illuminant D Series D65" using the "Von Kries" CAT.')
A = colour.CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["A"]
D65 = colour.CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"]
print(
    colour.adaptation.matrix_chromatic_adaptation_VonKries(
        colour.xy_to_XYZ(A), colour.xy_to_XYZ(D65), transform="Von Kries"))

print("\n")

XYZ = np.array([1.14176346, 1.00000000, 0.49815206])
message_box(
    f'Adapting given "CIE XYZ" tristimulus values from '
    f'the "CIE Standard Illuminant A" to the '
    f'"CIE Standard Illuminant D Series D65" using the "Sharp" CAT.\n\n'
    f'\t"XYZ": {XYZ}')
print(
    colour.chromatic_adaptation(XYZ,
                                colour.xy_to_XYZ(A),
                                colour.xy_to_XYZ(D65),
                                transform="Sharp"))
print(
    colour.adaptation.chromatic_adaptation_VonKries(XYZ,
                                                    colour.xy_to_XYZ(A),
                                                    colour.xy_to_XYZ(D65),
                                                    transform="Sharp"))
Ejemplo n.º 4
0
XYZ = np.array([0.2248, 0.2274, 0.0854])
XYZ_w = np.array([1.1115, 1.0000, 0.3520])
XYZ_wr = np.array([0.9481, 1.0000, 1.0730])
L_A1 = 200
L_A2 = 200
message_box(('Computing chromatic adaptation using "CMCCAT200" forward '
             'chromatic adaptation model.\n'
             '\n\t"XYZ":\n\t\t{0}\n\t"XYZ_w":\n\t\t{1}\n\t"XYZ_wr":\n\t\t{2}'
             '\n\t"L_A1":\n\t\t{3}\n\t"L_A2":\n\t\t{4}\n\n'
             'Warning: The input domain and output range of that definition '
             'are non standard!'.format(XYZ, XYZ_w, XYZ_wr, L_A1, L_A2)))
print(
    colour.chromatic_adaptation(XYZ,
                                XYZ_w,
                                XYZ_wr,
                                method='CMCCAT2000',
                                L_A1=L_A1,
                                L_A2=L_A2))
print(
    colour.adaptation.chromatic_adaptation_CMCCAT2000(
        XYZ * 100.0, XYZ_w, XYZ_wr, L_A1, L_A2) / 100.0)

print('\n')

XYZ_c = np.array([0.19526983, 0.23068340, 0.24971752])
message_box(('Computing chromatic adaptation using "CMCCAT200" reverse '
             'chromatic adaptation model.\n'
             '\n\t"XYZ_c":\n\t\t{0}\n\t"XYZ_w":\n\t\t{1}\n\t"XYZ_wr":\n\t\t{2}'
             '\n\t"L_A1":\n\t\t{3}\n\t"L_A2":\n\t\t{4}\n\n'
             'Warning: The input domain and output range of that definition '
             'are non standard!'.format(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2)))
Ejemplo n.º 5
0
XYZ_w = np.array([1.1115, 1.0000, 0.3520])
XYZ_wr = np.array([0.9481, 1.0000, 1.0730])
L_A1 = 200
L_A2 = 200
message_box(
    f'Computing chromatic adaptation using "CMCCAT200" forward chromatic '
    f"adaptation model.\n\n"
    f'\t"XYZ":\n\t\t{XYZ}\n'
    f'\t"XYZ_w":\n\t\t{XYZ_w}\n'
    f'\t"XYZ_wr":\n\t\t{XYZ_wr}\n'
    f'\t"L_A1":\n\t\t{L_A1}\n'
    f'\t"L_A2":\n\t\t{L_A2}')
print(
    colour.chromatic_adaptation(XYZ,
                                XYZ_w,
                                XYZ_wr,
                                method="CMCCAT2000",
                                L_A1=L_A1,
                                L_A2=L_A2))
print(
    colour.adaptation.chromatic_adaptation_CMCCAT2000(XYZ * 100, XYZ_w, XYZ_wr,
                                                      L_A1, L_A2) / 100)

print("\n")

XYZ_c = np.array([0.19526983, 0.23068340, 0.24971752])
message_box(
    f'Computing chromatic adaptation using "CMCCAT200" inverse chromatic '
    f"adaptation model.\n\n"
    f'\t"XYZ_c": {XYZ_c}\n'
    f'\t"XYZ_w": {XYZ_w}\n'
    f'\t"XYZ_wr": {XYZ_wr}\n'
# -*- coding: utf-8 -*-
"""
Showcases *Fairchild (1990)* chromatic adaptation model computations.
"""

import numpy as np

import colour
from colour.utilities import message_box

message_box('"Fairchild (1990)" Chromatic Adaptation Model Computations')

XYZ_1 = np.array([0.1953, 0.2307, 0.2497])
XYZ_n = np.array([1.1115, 1.0000, 0.3520])
XYZ_r = np.array([0.9481, 1.0000, 1.0730])
Y_n = 200
message_box(('Computing chromatic adaptation using "Fairchild (1990)" '
             'chromatic adaptation model.\n'
             '\n\t"XYZ_1":\n\t\t{0}\n\t"XYZ_n":\n\t\t{1}\n\t"XYZ_r":\n\t\t{2}'
             '\n\t"Y_n":\n\t\t{3}\n\n'
             'Warning: The input domain and output range of that definition '
             'are non standard!'.format(XYZ_1, XYZ_n, XYZ_r, Y_n)))
print(
    colour.chromatic_adaptation(
        XYZ_1, XYZ_n, XYZ_r, method='Fairchild 1990', Y_n=Y_n))
print(
    colour.adaptation.chromatic_adaptation_Fairchild1990(
        XYZ_1 * 100.0, XYZ_n, XYZ_r, Y_n) / 100.0)
Ejemplo n.º 7
0
message_box('Using "Bradford" CAT.')
print(
    colour.adaptation.chromatic_adaptation_matrix_VonKries(
        XYZ_w, XYZ_wr, transform='Bradford'))

print('\n')

message_box(('Computing the chromatic adaptation matrix from '
             '"CIE Standard Illuminant A" to '
             '"CIE Standard Illuminant D Series D65" using "Von Kries" CAT.'))
A = colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['A']
D65 = colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65']
print(
    colour.adaptation.chromatic_adaptation_matrix_VonKries(
        colour.xy_to_XYZ(A), colour.xy_to_XYZ(D65), transform='Von Kries'))

print('\n')

XYZ = np.array([1.14176346, 1.00000000, 0.49815206])
message_box(('Adapting given "CIE XYZ" tristimulus values from '
             '"CIE Standard Illuminant A" to '
             '"CIE Standard Illuminant D Series D65" using "Sharp" CAT.\n'
             '\n\t"XYZ":\n\t\t{0}'.format(XYZ)))
print(
    colour.chromatic_adaptation(
        XYZ, colour.xy_to_XYZ(A), colour.xy_to_XYZ(D65), transform='Sharp'))
print(
    colour.adaptation.chromatic_adaptation_VonKries(
        XYZ, colour.xy_to_XYZ(A), colour.xy_to_XYZ(D65), transform='Sharp'))
Ejemplo n.º 8
0
message_box('"CMCCAT200" Chromatic Adaptation Model Computations')

XYZ = np.array([0.2248, 0.2274, 0.0854])
XYZ_w = np.array([1.1115, 1.0000, 0.3520])
XYZ_wr = np.array([0.9481, 1.0000, 1.0730])
L_A1 = 200
L_A2 = 200
message_box(('Computing chromatic adaptation using "CMCCAT200" forward '
             'chromatic adaptation model.\n'
             '\n\t"XYZ":\n\t\t{0}\n\t"XYZ_w":\n\t\t{1}\n\t"XYZ_wr":\n\t\t{2}'
             '\n\t"L_A1":\n\t\t{3}\n\t"L_A2":\n\t\t{4}\n\n'
             'Warning: The input domain and output range of that definition '
             'are non standard!'.format(XYZ, XYZ_w, XYZ_wr, L_A1, L_A2)))
print(
    colour.chromatic_adaptation(
        XYZ, XYZ_w, XYZ_wr, method='CMCCAT2000', L_A1=L_A1, L_A2=L_A2))
print(
    colour.adaptation.chromatic_adaptation_CMCCAT2000(
        XYZ * 100.0, XYZ_w, XYZ_wr, L_A1, L_A2) / 100.0)

print('\n')

XYZ_c = np.array([0.19526983, 0.23068340, 0.24971752])
message_box(('Computing chromatic adaptation using "CMCCAT200" reverse '
             'chromatic adaptation model.\n'
             '\n\t"XYZ_c":\n\t\t{0}\n\t"XYZ_w":\n\t\t{1}\n\t"XYZ_wr":\n\t\t{2}'
             '\n\t"L_A1":\n\t\t{3}\n\t"L_A2":\n\t\t{4}\n\n'
             'Warning: The input domain and output range of that definition '
             'are non standard!'.format(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2)))
print(
    colour.chromatic_adaptation(
Ejemplo n.º 9
0
message_box('"Zhai and Luo (2018)" Chromatic Adaptation Model Computations')

XYZ_b = np.array([0.48900, 0.43620, 0.06250])
XYZ_wb = np.array([1.09850, 1, 0.35585])
XYZ_wd = np.array([0.95047, 1, 1.08883])
D_b = 0.9407
D_d = 0.9800
XYZ_wo = np.array([1, 1, 1])
message_box(
    f'Computing chromatic adaptation using "Zhai and Luo (2018)" chromatic '
    f"adaptation model.\n\n"
    f'\t"XYZ_b": {XYZ_b}\n'
    f'\t"XYZ_wb": {XYZ_wb}\n'
    f'\t"XYZ_wd": {XYZ_wd}\n'
    f'\t"D_b": {D_b}\n'
    f'\t"D_d": {D_d}\n'
    f'\t"XYZ_wo": {XYZ_wo}')
print(
    colour.chromatic_adaptation(
        XYZ_b,
        XYZ_wb,
        XYZ_wd,
        method="Zhai 2018",
        D_b=D_b,
        D_d=D_d,
        XYZ_wo=XYZ_wo,
    ))
print(
    colour.adaptation.chromatic_adaptation_Zhai2018(
        XYZ_b * 100, XYZ_wb * 100, XYZ_wd * 100, D_b, D_d, XYZ_wo * 100) / 100)