def apply_lut(self, context, temp_image, temp_pass):
        from colour import read_LUT
        from colour import write_image, read_image
        lut3d = read_LUT(context.scene["lut_import_pass"])
        luminance_map_img = lut3d.apply(read_image(temp_image))

        write_image(luminance_map_img, temp_pass, bit_depth='uint8')
        new_image = bpy.data.images.load(temp_pass, check_existing=True)
        new_image.reload()
    def apply_lut(self, context, temp_image, temp_pass):
        # パスを追加
        path_roaming = os.getenv('APPDATA') + "\\Python"
        for ver in os.listdir(path_roaming):
            sys.path.append(path_roaming + "\\" + ver + "\\site-packages\\")
        from colour import read_LUT
        from colour import write_image, read_image
        lut3d = read_LUT(context.scene["lut_import_pass"])
        luminance_map_img = lut3d.apply(read_image(temp_image))

        write_image(luminance_map_img, temp_pass, bit_depth='uint8')
        new_image = bpy.data.images.load(temp_pass, check_existing=True)
        new_image.reload()
Example #3
0
import os

import colour
from colour.utilities import message_box

RESOURCES_DIRECTORY = os.path.join(os.path.dirname(__file__), '..', '..', 'io',
                                   'luts', 'tests', 'resources')

message_box('Look Up Table (LUT) Data')

message_box('Reading "Iridas" ".cube" 2D LUT file.')
path = os.path.join(RESOURCES_DIRECTORY, 'iridas_cube',
                    'ACES_Proxy_10_to_ACES.cube')
print(colour.io.read_LUT_IridasCube(path))
print('\n')
print(colour.read_LUT(path))

print('\n')

message_box('Reading "Iridas" ".cube" 3D LUT file.')
path = os.path.join(RESOURCES_DIRECTORY, 'iridas_cube', 'ColourCorrect.cube')
print(colour.io.read_LUT_IridasCube(path))
print('\n')
print(colour.read_LUT(path))

print('\n')

message_box('Reading "Sony" ".spi1d" 1D LUT file.')
path = os.path.join(RESOURCES_DIRECTORY, 'sony_spi1d',
                    'oetf_reverse_sRGB_1D.spi1d')
print(colour.io.read_LUT_SonySPI1D(path))
print("\n")

V_xyz = np.random.random((6, 3))
message_box(f'Performing "trilinear" interpolation of given "xyz" values:\n\n'
            f"{V_xyz}\n\n"
            f"using given interpolation table.")
path = os.path.join(
    os.path.dirname(__file__),
    "..",
    "..",
    "io",
    "luts",
    "tests",
    "resources",
    "iridas_cube",
    "Colour_Correct.cube",
)
table = colour.read_LUT(path).table
print(colour.table_interpolation(V_xyz, table, method="Trilinear"))
print(colour.algebra.table_interpolation_trilinear(V_xyz, table))

print("\n")

message_box(
    f'Performing "tetrahedral" interpolation of given "xyz" values:\n\n'
    f"{V_xyz}\n\n"
    f"using given interpolation table.")
print(colour.table_interpolation(V_xyz, table, method="Tetrahedral"))
print(colour.algebra.table_interpolation_tetrahedral(V_xyz, table))
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import numpy as np
import colour
from colour import read_LUT, write_LUT, LUT3D, LUT3x1D, LUTSequence
from colour.models import RGB_to_RGB, BT2020_COLOURSPACE, P3_D65_COLOURSPACE, eotf_inverse_sRGB
from colour.utilities import tstack

Log2_48_nits_Shaper_to_linear = read_LUT(
    '/Library/Application Support/OpenColorIO/aces_1.1/luts/Log2_48_nits_Shaper_to_linear.spi1d'
)
bt2020_cube = read_LUT(
    '/Library/Application Support/OpenColorIO/aces_1.1/luts/Log2_48_nits_Shaper.RRT.Rec.2020__P3D65_Limited_.spi3d'
)

table = bt2020_cube.table**2.4
table = RGB_to_RGB(table, BT2020_COLOURSPACE, P3_D65_COLOURSPACE)
table = eotf_inverse_sRGB(table)
table = np.clip(table, 0, 1)

display_p3_cube = LUT3D(table=table)

samples = np.linspace(0, 1, 4096)

domain = tstack(
    (Log2_48_nits_Shaper_to_linear.table, Log2_48_nits_Shaper_to_linear.table,
     Log2_48_nits_Shaper_to_linear.table))

shaper = LUT3x1D(domain=domain, table=tstack([samples, samples, samples]))
    'x_ticker':
        True,
    'y_ticker':
        True,
    'bounding_box': (min(x_limit_min), max(x_limit_max), min(y_limit_min),
                     max(y_limit_max))
}

render(**settings)

print('\n')

V_xyz = np.random.random((6, 3))
message_box(('Performing "trilinear" interpolation of given "xyz" values:\n'
             '\n{0}\n'
             '\nusing given interpolation table.'.format(V_xyz)))
path = os.path.join(
    os.path.dirname(__file__), '..', '..', 'io', 'luts', 'tests', 'resources',
    'iridas_cube', 'ColourCorrect.cube')
table = colour.read_LUT(path).table
print(colour.table_interpolation(V_xyz, table, method='Trilinear'))
print(colour.algebra.table_interpolation_trilinear(V_xyz, table))

print('\n')

message_box(('Performing "tetrahedral" interpolation of given "xyz" values:\n'
             '\n{0}\n'
             '\nusing given interpolation table.'.format(V_xyz)))
print(colour.table_interpolation(V_xyz, table, method='Tetrahedral'))
print(colour.algebra.table_interpolation_tetrahedral(V_xyz, table))
Example #7
0
import os

import colour
from colour.utilities import message_box

RESOURCES_DIRECTORY = os.path.join(
    os.path.dirname(__file__), '..', '..', 'io', 'luts', 'tests', 'resources')

message_box('Look Up Table (LUT) Data')

message_box('Reading "Iridas" ".cube" 3x1D LUT file.')
path = os.path.join(RESOURCES_DIRECTORY, 'iridas_cube',
                    'ACES_Proxy_10_to_ACES.cube')
print(colour.io.read_LUT_IridasCube(path))
print('\n')
print(colour.read_LUT(path))

print('\n')

message_box('Reading "Iridas" ".cube" 3D LUT file.')
path = os.path.join(RESOURCES_DIRECTORY, 'iridas_cube', 'ColourCorrect.cube')
print(colour.io.read_LUT_IridasCube(path))
print('\n')
print(colour.read_LUT(path))

print('\n')

message_box('Reading "Sony" ".spi1d" 1D LUT file.')
path = os.path.join(RESOURCES_DIRECTORY, 'sony_spi1d',
                    'oetf_reverse_sRGB_1D.spi1d')
print(colour.io.read_LUT_SonySPI1D(path))