コード例 #1
0
def set_primaries_output(colourspace, illuminant,
                         chromatic_adaptation_transform, formatter, decimals):
    """
    Computes and writes the chromatically adapted *primaries *of the given
    *RGB* colourspace model to the given *illuminant* using the given
    *chromatic adaptation transform*to into the output :class:`Pre` class
    instance.

    Parameters
    ----------
    colourspace : unicode
        *RGB* colourspace to chromatically adapt the *primaries*.
    illuminant : unicode
        *CIE 1931 2 Degree Standard Observer* illuminant to adapt the
        *primaries* to.
    chromatic_adaptation_transform : unicode
        *Chromatic adaptation transform* to use.
    formatter : unicode
        Formatter to use, :func:`str` or :func:`repr`.
    decimals : int
        Decimals to use when formatting the chromatically adapted *primaries*.

    Returns
    -------
    unicode
        Chromatically adapted *primaries*.
    """

    P = colour.chromatically_adapted_primaries(
        colour.RGB_COLOURSPACES[colourspace].primaries,
        colour.RGB_COLOURSPACES[colourspace].whitepoint,
        colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][illuminant],
        chromatic_adaptation_transform)

    with colour.utilities.numpy_print_options(
            formatter={'float': ('{{: 0.{0}f}}'.format(decimals)).format},
            threshold=np.nan):
        if formatter == 'str':
            P = str(P)
        elif formatter == 'repr':
            P = repr(P)

        return P
コード例 #2
0
    def set_primaries_Textarea():
        input_colourspace = colour.RGB_COLOURSPACES[
            input_colourspace_Dropdown.value]

        P = colour.chromatically_adapted_primaries(
            input_colourspace.primaries, input_colourspace.whitepoint,
            colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][
                illuminant_Dropdown.value],
            chromatic_adaptation_transforms_Dropdown.value)

        with colour.utilities.numpy_print_options(
                formatter={
                    'float':
                    ('{{:0.{0}f}}'.format(decimals_IntSlider.value)).format
                },
                threshold=np.nan):
            if formatter_Dropdown.value == 'str':
                P = str(P)
            elif formatter_Dropdown.value == 'repr':
                P = repr(P)

            primaries_Textarea.rows = len(P.split('\n'))
            primaries_Textarea.value = P
コード例 #3
0
print('\n')

message_box(('Computing the normalised primary matrix for "ACES2065-1" '
             'colourspace transforming from "CIE XYZ" tristimulus values to '
             '"ACES2065-1" colourspace using colour models dataset.'))
print(np.linalg.inv(colour.normalised_primary_matrix(
    colour.ACES_2065_1_COLOURSPACE.primaries,
    colour.ACES_2065_1_COLOURSPACE.whitepoint)))

print('\n')

message_box(('Computing "sRGB" colourspace primaries chromatically adapted to '
             '"CIE Standard Illuminant D50":\n'))
print(colour.chromatically_adapted_primaries(
    colour.sRGB_COLOURSPACE.primaries,
    colour.sRGB_COLOURSPACE.whitepoint,
    colour.ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50']))

print('\n')

npm = np.array([[0.41238656, 0.35759149, 0.18045049],
                [0.21263682, 0.71518298, 0.07218020],
                [0.01933062, 0.11919716, 0.95037259]])
message_box(('Computing the primaries and whitepoint from given '
             'normalised primary matrix:\n'
             '\n{0}'.format(npm)))
print(colour.primaries_whitepoint(npm))

print('\n')

RGB = (56.00000000, 16.00000000, 100.00000000)
コード例 #4
0
print(
    np.linalg.inv(
        colour.normalised_primary_matrix(
            colour.RGB_COLOURSPACES["ACES2065-1"].primaries,
            colour.RGB_COLOURSPACES["ACES2065-1"].whitepoint,
        )))

print("\n")

message_box(
    'Computing the "sRGB" colourspace primaries chromatically adapted to the '
    '"CIE Standard Illuminant D50":\n')
print(
    colour.chromatically_adapted_primaries(
        colour.RGB_COLOURSPACES["sRGB"].primaries,
        colour.RGB_COLOURSPACES["sRGB"].whitepoint,
        colour.CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D50"],
    ))

print("\n")

npm = np.array([
    [0.41240000, 0.35760000, 0.18050000],
    [0.21260000, 0.71520000, 0.07220000],
    [0.01930000, 0.11920000, 0.95050000],
])
message_box(
    f"Computing the primaries and whitepoint from given normalised primary "
    f"matrix:\n\n{npm}")
print(colour.primaries_whitepoint(npm))
コード例 #5
0
             '"ACES2065-1" colourspace using colour models dataset.'))
print(
    np.linalg.inv(
        colour.normalised_primary_matrix(
            colour.RGB_COLOURSPACES['ACES2065-1'].primaries,
            colour.RGB_COLOURSPACES['ACES2065-1'].whitepoint,
        )))

print('\n')

message_box(('Computing "sRGB" colourspace primaries chromatically adapted to '
             '"CIE Standard Illuminant D50":\n'))
print(
    colour.chromatically_adapted_primaries(
        colour.RGB_COLOURSPACES['sRGB'].primaries,
        colour.RGB_COLOURSPACES['sRGB'].whitepoint,
        colour.CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D50'],
    ))

print('\n')

npm = np.array([
    [0.41240000, 0.35760000, 0.18050000],
    [0.21260000, 0.71520000, 0.07220000],
    [0.01930000, 0.11920000, 0.95050000],
])
message_box(('Computing the primaries and whitepoint from given '
             'normalised primary matrix:\n'
             '\n{0}'.format(npm)))
print(colour.primaries_whitepoint(npm))