Beispiel #1
0
Showcases chromatic adaptation computations.
"""

from __future__ import division, unicode_literals

import colour
from colour.utilities.verbose import message_box

message_box('Chromatic Adaptation Computations')

XYZ1 = (1.09923822, 1.000, 0.35445412)
XYZ2 = (0.96907232, 1.000, 1.121792157)
message_box(('Computing the chromatic adaptation matrix from two source '
             '"CIE XYZ" matrices, default CAT is "CAT02".\n'
             '\n\t"XYZ1":\n\t\t{0}\n\t"XYZ2":\n\t\t{1}'.format(XYZ1, XYZ2)))
print(colour.chromatic_adaptation_matrix(XYZ1, XYZ2))

print('\n')

message_box('Using "Bradford" CAT.')
print(colour.chromatic_adaptation_matrix(XYZ1, XYZ2, method='Bradford'))

print('\n')

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

print(colour.chromatic_adaptation_matrix(
colourspace = colour.RGB_COLOURSPACES['ACES RGB']
print('Name:\n"{0}"'.format(colourspace.name))
print('\nPrimaries:\n{0}'.format(colourspace.primaries))
print('\nNormalised primary matrix to "CIE XYZ":\n{0}'.format(
    colourspace.to_XYZ))
print('\nNormalised primary matrix to "ACES RGB":\n{0}'.format(
    colourspace.to_RGB))
print('\nTransfer function from linear to colourspace:\n{0}'.format(
    colourspace.transfer_function))
print('\nInverse transfer function from colourspace to linear:\n{0}'.format(
    colourspace.inverse_transfer_function))

print('\n')

message_box('Computing "ACES RGB" colourspace to "sRGB" colourspace matrix.')
cat = colour.chromatic_adaptation_matrix(
    colour.xy_to_XYZ(colour.RGB_COLOURSPACES['ACES RGB'].whitepoint),
    colour.xy_to_XYZ(colour.RGB_COLOURSPACES['sRGB'].whitepoint))
print(np.dot(colour.RGB_COLOURSPACES['sRGB'].to_RGB,
             np.dot(cat, colour.RGB_COLOURSPACES['ACES RGB'].to_XYZ)))

print('\n')

RGB = [0.35521588, 0.41, 0.24177934]
message_box(('Converting from "sRGB" colourspace to "ProPhoto RGB" '
             'colourspace given "RGB" values:\n'
             '\n\t{0}'.format(RGB)))
print(colour.RGB_to_RGB(RGB,
                        colour.RGB_COLOURSPACES['sRGB'],
                        colour.RGB_COLOURSPACES['ProPhoto RGB']))
Beispiel #3
0
Showcases chromatic adaptation computations.
"""

from __future__ import division, unicode_literals

import colour
from colour.utilities.verbose import message_box

message_box('Chromatic Adaptation Computations')

XYZ1 = (1.09923822, 1.000, 0.35445412)
XYZ2 = (0.96907232, 1.000, 1.121792157)
message_box(('Computing the chromatic adaptation matrix from two source '
             '"CIE XYZ" matrices, default CAT is "CAT02".\n'
             '\n\t"XYZ1":\n\t\t{0}\n\t"XYZ2":\n\t\t{1}'.format(XYZ1, XYZ2)))
print(colour.chromatic_adaptation_matrix(XYZ1, XYZ2))

print('\n')

message_box('Using "Bradford" CAT.')
print(colour.chromatic_adaptation_matrix(XYZ1, XYZ2, method='Bradford'))

print('\n')

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

print(