本文整理汇总了Python中aces_ocio.utilities.ColorSpace.description方法的典型用法代码示例。如果您正苦于以下问题:Python ColorSpace.description方法的具体用法?Python ColorSpace.description怎么用?Python ColorSpace.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aces_ocio.utilities.ColorSpace
的用法示例。
在下文中一共展示了ColorSpace.description方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_ACES
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_ACES():
"""
Object description.
Parameters
----------
parameter : type
Parameter description.
Returns
-------
type
Return value description.
"""
# Defining the reference colorspace.
aces2065_1 = ColorSpace('ACES2065-1')
aces2065_1.description = (
'The Academy Color Encoding System reference color space')
aces2065_1.equality_group = ''
aces2065_1.aliases = ['lin_ap0', 'aces']
aces2065_1.family = 'ACES'
aces2065_1.is_data = False
aces2065_1.allocation_type = ocio.Constants.ALLOCATION_LG2
aces2065_1.allocation_vars = [-8, 5, 0.00390625]
return aces2065_1
示例2: create_transfer_colorspace
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_transfer_colorspace(name='transfer',
transfer_function_name='transfer_function',
transfer_function=lambda x: x,
lut_directory='/tmp',
lut_resolution_1d=1024,
aliases=[]):
"""
Object description.
Parameters
----------
parameter : type
Parameter description.
Returns
-------
type
Return value description.
"""
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = aliases
cs.equality_group = name
cs.family = 'Utility'
cs.is_data = False
# A linear space needs allocation variables
cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM
cs.allocation_vars = [0, 1]
# Sample the transfer function
data = array.array('f', '\0' * lut_resolution_1d * 4)
for c in range(lut_resolution_1d):
data[c] = transfer_function(c / (lut_resolution_1d - 1))
# Write the sampled data to a LUT
lut = '%s_to_linear.spi1d' % transfer_function_name
genlut.write_SPI_1d(
os.path.join(lut_directory, lut),
0,
1,
data,
lut_resolution_1d,
1)
# Create the 'to_reference' transforms
cs.to_reference_transforms = []
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
'direction': 'forward'})
# Create the 'from_reference' transforms
cs.from_reference_transforms = []
return cs
示例3: create_matrix_colorspace
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_matrix_colorspace(name='matrix',
from_reference_values=None,
to_reference_values=None,
aliases=None):
"""
Object description.
Parameters
----------
parameter : type
Parameter description.
Returns
-------
type
Return value description.
"""
if from_reference_values is None:
from_reference_values = []
if to_reference_values is None:
to_reference_values = []
if aliases is None:
aliases = []
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = aliases
cs.equality_group = name
cs.family = 'Utility'
cs.is_data = False
# A linear space needs allocation variables.
cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM
cs.allocation_vars = [0, 1]
cs.to_reference_transforms = []
if to_reference_values:
for matrix in to_reference_values:
cs.to_reference_transforms.append({
'type': 'matrix',
'matrix': mat44_from_mat33(matrix),
'direction': 'forward'})
cs.from_reference_transforms = []
if from_reference_values:
for matrix in from_reference_values:
cs.from_reference_transforms.append({
'type': 'matrix',
'matrix': mat44_from_mat33(matrix),
'direction': 'forward'})
return cs
示例4: create_Dolby_PQ_scaled
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_Dolby_PQ_scaled(aces_ctl_directory,
lut_directory,
lut_resolution_1d,
cleanup,
name='pq',
aliases=None,
min_value=0.0,
max_value=1.0,
input_scale=1.0,
middle_grey=0.18,
min_exposure=-6.0,
max_exposure=6.5):
if aliases is None:
aliases = []
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = aliases
cs.equality_group = name
cs.family = 'Utility'
cs.is_data = False
ctls = [os.path.join(
aces_ctl_directory,
'utilities',
'ACESlib.OCIOShaper_to_lin_param.a1.0.0.ctl')]
lut = '%s_to_linear.spi1d' % name
lut = sanitize(lut)
generate_1d_LUT_from_CTL(
os.path.join(lut_directory, lut),
ctls,
lut_resolution_1d,
'float',
input_scale,
1.0,
{'middleGrey': middle_grey,
'minExposure': min_exposure,
'maxExposure': max_exposure},
cleanup,
aces_ctl_directory,
min_value,
max_value)
cs.to_reference_transforms = []
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
'direction': 'forward'})
cs.from_reference_transforms = []
return cs
示例5: create_raw
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_raw():
# *Raw* utility space
name = "Raw"
raw = ColorSpace(name)
raw.description = 'The %s color space' % name
raw.aliases = []
raw.equality_group = name
raw.family = 'Utility'
raw.is_data = True
return raw
示例6: create_dolbypq_scaled
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_dolbypq_scaled(
aces_CTL_directory,
lut_directory,
lut_resolution_1d,
cleanup,
name="pq",
aliases=[],
min_value=0.0,
max_value=1.0,
input_scale=1.0,
middle_grey=0.18,
min_exposure=-6.0,
max_exposure=6.5,
):
cs = ColorSpace(name)
cs.description = "The %s color space" % name
cs.aliases = aliases
cs.equality_group = name
cs.family = "Utility"
cs.is_data = False
ctls = [os.path.join(aces_CTL_directory, "utilities", "ACESlib.DolbyPQ_to_lin_param.a1.0.0.ctl")]
lut = "%s_to_linear.spi1d" % name
lut = sanitize(lut)
generate_1d_LUT_from_CTL(
os.path.join(lut_directory, lut),
ctls,
lut_resolution_1d,
"float",
input_scale,
1.0,
{"middleGrey": middle_grey, "minExposure": min_exposure, "maxExposure": max_exposure},
cleanup,
aces_CTL_directory,
min_value,
max_value,
)
cs.to_reference_transforms = []
cs.to_reference_transforms.append(
{"type": "lutFile", "path": lut, "interpolation": "linear", "direction": "forward"}
)
cs.from_reference_transforms = []
return cs
示例7: create_dolbypq
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_dolbypq(aces_CTL_directory,
lut_directory,
lut_resolution_1d,
cleanup,
name='pq',
aliases=[],
min_value=0.0,
max_value=1.0,
input_scale=1.0):
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = aliases
cs.equality_group = name
cs.family = 'Utility'
cs.is_data = False
ctls = [os.path.join(
aces_CTL_directory,
'utilities',
'ACESlib.OCIO_shaper_dolbypq_to_lin.a1.0.0.ctl')]
lut = '%s_to_linear.spi1d' % name
lut = sanitize(lut)
generate_1d_LUT_from_CTL(
os.path.join(lut_directory, lut),
ctls,
lut_resolution_1d,
'float',
input_scale,
1.0,
{},
cleanup,
aces_CTL_directory,
min_value,
max_value)
cs.to_reference_transforms = []
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
'direction': 'forward'})
cs.from_reference_transforms = []
return cs
示例8: create_ACEScg
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_ACEScg():
"""
Creates the *ACEScg* colorspace.
Parameters
----------
parameter : type
Parameter description.
Returns
-------
Colorspace
*ACEScg* colorspace.
"""
name = 'ACEScg'
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = ['acescg', 'lin_ap1']
cs.equality_group = ''
cs.family = 'ACES'
cs.is_data = False
cs.allocation_type = ocio.Constants.ALLOCATION_LG2
cs.allocation_vars = [-8, 5, 0.00390625]
cs.aces_transform_id = 'ACEScsc.ACEScg_to_ACES.a1.0.0'
cs.to_reference_transforms = []
# *AP1* primaries to *AP0* primaries
cs.to_reference_transforms.append({
'type': 'matrix',
'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
'direction': 'forward'})
cs.from_reference_transforms = []
# *AP1* primaries to *AP0* primaries
cs.from_reference_transforms.append({
'type': 'matrix',
'matrix': mat44_from_mat33(ACES_AP0_TO_AP1),
'direction': 'forward'})
return cs
示例9: create_ACEScg
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_ACEScg(aces_ctl_directory, lut_directory, lut_resolution_1d, cleanup, name="ACEScg"):
"""
Creates the *ACEScg* colorspace.
Parameters
----------
parameter : type
Parameter description.
Returns
-------
Colorspace
*ACEScg* colorspace.
"""
cs = ColorSpace(name)
cs.description = "The %s color space" % name
cs.aliases = ["acescg", "lin_ap1"]
cs.equality_group = ""
cs.family = "ACES"
cs.is_data = False
cs.allocation_type = ocio.Constants.ALLOCATION_LG2
cs.allocation_vars = [-8, 5, 0.00390625]
cs.aces_transform_id = "ACEScsc.ACEScg_to_ACES.a1.0.0"
cs.to_reference_transforms = []
# *AP1* primaries to *AP0* primaries.
cs.to_reference_transforms.append(
{"type": "matrix", "matrix": mat44_from_mat33(ACES_AP1_TO_AP0), "direction": "forward"}
)
cs.from_reference_transforms = []
# *AP1* primaries to *AP0* primaries.
cs.from_reference_transforms.append(
{"type": "matrix", "matrix": mat44_from_mat33(ACES_AP0_TO_AP1), "direction": "forward"}
)
return cs
示例10: create_ACEScg
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_ACEScg(aces_ctl_directory,
lut_directory,
lut_resolution_1d,
cleanup,
name='ACEScg'):
"""
Creates the *ACEScg* colorspace.
Parameters
----------
parameter : type
Parameter description.
Returns
-------
Colorspace
*ACEScg* colorspace.
"""
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = ["lin_ap1"]
cs.equality_group = ''
cs.family = 'ACES'
cs.is_data = False
cs.allocation_type = ocio.Constants.ALLOCATION_LG2
cs.allocation_vars = [-8, 5, 0.00390625]
cs.to_reference_transforms = []
# *AP1* primaries to *AP0* primaries.
cs.to_reference_transforms.append({
'type': 'matrix',
'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
'direction': 'forward'})
cs.from_reference_transforms = []
return cs
示例11: create_raw
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_raw():
"""
Creates the *raw* color space
Parameters
----------
None
Returns
-------
ColorSpace
*raw* and all its identifying information
"""
# *Raw* utility space
name = 'Raw'
raw = ColorSpace(name)
raw.description = 'The %s color space' % name
raw.aliases = ['raw']
raw.equality_group = name
raw.family = 'Utility'
raw.is_data = True
return raw
示例12: create_c_log
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_c_log(gamut,
transfer_function,
lut_directory,
lut_resolution_1d,
aliases):
"""
Object description.
Canon-Log to ACES.
Parameters
----------
parameter : type
Parameter description.
Returns
-------
type
Return value description.
"""
name = '%s - %s' % (transfer_function, gamut)
if transfer_function == '':
name = 'Linear - Canon %s' % gamut
if gamut == '':
name = 'Curve - %s' % transfer_function
cs = ColorSpace(name)
cs.description = name
cs.aliases = aliases
cs.equality_group = ''
cs.family = 'Input/Canon'
cs.is_data = False
# A linear space needs allocation variables.
if transfer_function == '':
cs.allocation_type = ocio.Constants.ALLOCATION_LG2
cs.allocation_vars = [-8, 5, 0.00390625]
def legal_to_full(code_value):
return (code_value - 64) / (940 - 64)
def c_log_to_linear(code_value):
# log = fullToLegal(c1 * log10(c2*linear + 1) + c3)
# linear = (pow(10, (legalToFul(log) - c3)/c1) - 1)/c2
c1 = 0.529136
c2 = 10.1596
c3 = 0.0730597
linear = (pow(10, (legal_to_full(code_value) - c3) / c1) - 1) / c2
linear *= 0.9
return linear
cs.to_reference_transforms = []
if transfer_function == 'Canon-Log':
data = array.array('f', '\0' * lut_resolution_1d * 4)
for c in range(lut_resolution_1d):
data[c] = c_log_to_linear(1023 * c / (lut_resolution_1d - 1))
lut = '%s_to_linear.spi1d' % transfer_function
genlut.write_SPI_1d(
os.path.join(lut_directory, lut),
0,
1,
data,
lut_resolution_1d,
1)
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
'direction': 'forward'})
if gamut == 'Rec. 709 Daylight':
cs.to_reference_transforms.append({
'type': 'matrix',
'matrix': [0.561538969, 0.402060105, 0.036400926, 0,
0.092739623, 0.924121198, -0.016860821, 0,
0.084812961, 0.006373835, 0.908813204, 0,
0, 0, 0, 1],
'direction': 'forward'})
elif gamut == 'Rec. 709 Tungsten':
cs.to_reference_transforms.append({
'type': 'matrix',
'matrix': [0.566996399, 0.365079418, 0.067924183, 0,
0.070901044, 0.880331008, 0.048767948, 0,
0.073013542, -0.066540862, 0.99352732, 0,
0, 0, 0, 1],
'direction': 'forward'})
elif gamut == 'DCI-P3 Daylight':
cs.to_reference_transforms.append({
'type': 'matrix',
'matrix': [0.607160575, 0.299507286, 0.093332140, 0,
0.004968120, 1.050982224, -0.055950343, 0,
-0.007839939, 0.000809127, 1.007030813, 0,
0, 0, 0, 1],
'direction': 'forward'})
#.........这里部分代码省略.........
示例13: create_matrix_plus_transfer_colorspace
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_matrix_plus_transfer_colorspace(
name='matrix_plus_transfer',
transfer_function_name='transfer_function',
transfer_function=lambda x: x,
lut_directory='/tmp',
lut_resolution_1d=1024,
from_reference_values=None,
to_reference_values=None,
aliases=None):
"""
Creates a ColorSpace that uses transfer functions encoded as 1D LUTs and
matrice
Parameters
----------
name : str, optional
Aliases for this colorspace
transfer_function_name : str, optional
The name of the transfer function
transfer_function : function, optional
The transfer function to be evaluated
lut_directory : str or unicode
The directory to use when generating LUTs
lut_resolution_1d : int
The resolution of generated 1D LUTs
from_reference_values : list of matrices
List of matrices to convert from the reference colorspace to this space
to_reference_values : list of matrices
List of matrices to convert to the reference colorspace from this space
aliases : list of str
Aliases for this colorspace
Returns
-------
ColorSpace
A *Matrx and LUT1D Transform*-based ColorSpace representing a transfer
function and matrix
"""
if from_reference_values is None:
from_reference_values = []
if to_reference_values is None:
to_reference_values = []
if aliases is None:
aliases = []
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = aliases
cs.equality_group = name
cs.family = 'Utility'
cs.is_data = False
# A linear space needs allocation variables.
cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM
cs.allocation_vars = [0, 1]
# Sampling the transfer function.
data = array.array('f', '\0' * lut_resolution_1d * 4)
for c in range(lut_resolution_1d):
data[c] = transfer_function(c / (lut_resolution_1d - 1))
# Writing the sampled data to a *LUT*.
lut = '%s_to_linear.spi1d' % transfer_function_name
genlut.write_SPI_1d(
os.path.join(lut_directory, lut),
0,
1,
data,
lut_resolution_1d,
1)
# Creating the *to_reference* transforms.
cs.to_reference_transforms = []
if to_reference_values:
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
'direction': 'forward'})
for matrix in to_reference_values:
cs.to_reference_transforms.append({
'type': 'matrix',
'matrix': mat44_from_mat33(matrix),
'direction': 'forward'})
# Creating the *from_reference* transforms.
cs.from_reference_transforms = []
if from_reference_values:
for matrix in from_reference_values:
cs.from_reference_transforms.append({
'type': 'matrix',
'matrix': mat44_from_mat33(matrix),
'direction': 'forward'})
cs.from_reference_transforms.append({
'type': 'lutFile',
#.........这里部分代码省略.........
示例14: create_ACEScc
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_ACEScc(aces_ctl_directory,
lut_directory,
lut_resolution_1d,
cleanup,
name='ACEScc',
min_value=0,
max_value=1,
input_scale=1):
"""
Creates the *ACEScc* colorspace.
Parameters
----------
parameter : type
Parameter description.
Returns
-------
Colorspace
*ACEScc* colorspace.
"""
cs = ColorSpace(name)
cs.description = 'The %s color space' % name
cs.aliases = ["acescc_ap1"]
cs.equality_group = ''
cs.family = 'ACES'
cs.is_data = False
cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM
cs.allocation_vars = [min_value, max_value]
ctls = [os.path.join(aces_ctl_directory,
'ACEScc',
'ACEScsc.ACEScc_to_ACES.a1.0.0.ctl')]
lut = '%s_to_linear.spi1d' % name
lut = sanitize(lut)
generate_1d_LUT_from_CTL(
os.path.join(lut_directory, lut),
ctls,
lut_resolution_1d,
'float',
input_scale,
1,
{'transferFunctionOnly':1},
cleanup,
aces_ctl_directory,
min_value,
max_value,
1)
cs.to_reference_transforms = []
cs.to_reference_transforms.append({
'type': 'lutFile',
'path': lut,
'interpolation': 'linear',
'direction': 'forward'})
# *AP1* primaries to *AP0* primaries.
cs.to_reference_transforms.append({
'type': 'matrix',
'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
'direction': 'forward'})
cs.from_reference_transforms = []
return cs
示例15: create_log_c
# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import description [as 别名]
def create_log_c(gamut,
transfer_function,
exposure_index,
name,
lut_directory,
lut_resolution_1d,
aliases):
"""
Object description.
LogC to ACES.
Parameters
----------
parameter : type
Parameter description.
Returns
-------
type
Return value description.
"""
name = '%s (EI%s) - %s' % (transfer_function, exposure_index, gamut)
if transfer_function == '':
name = 'Linear - ARRI %s' % gamut
if gamut == '':
name = '%s (EI%s)' % (transfer_function, exposure_index)
cs = ColorSpace(name)
cs.description = name
cs.aliases = aliases
cs.equality_group = ''
cs.family = 'Input/ARRI'
cs.is_data = False
# A linear space needs allocation variables
if transfer_function == '':
cs.allocation_type = ocio.Constants.ALLOCATION_LG2
cs.allocation_vars = [-8, 5, 0.00390625]
# Globals.
IDT_maker_version = '0.08'
nominal_EI = 400
black_signal = 0.003907
mid_gray_signal = 0.01
encoding_gain = 0.256598
encoding_offset = 0.391007
def gain_for_EI(EI):
return (math.log(EI / nominal_EI) / math.log(2) * (
0.89 - 1) / 3 + 1) * encoding_gain
def log_c_inverse_parameters_for_EI(EI):
cut = 1 / 9
slope = 1 / (cut * math.log(10))
offset = math.log10(cut) - slope * cut
gain = EI / nominal_EI
gray = mid_gray_signal / gain
# The higher the EI, the lower the gamma.
enc_gain = gain_for_EI(EI)
enc_offset = encoding_offset
for i in range(0, 3):
nz = ((95 / 1023 - enc_offset) / enc_gain - offset) / slope
enc_offset = encoding_offset - math.log10(1 + nz) * enc_gain
a = 1 / gray
b = nz - black_signal / gray
e = slope * a * enc_gain
f = enc_gain * (slope * b + offset) + enc_offset
# Ensuring we can return relative exposure.
s = 4 / (0.18 * EI)
t = black_signal
b += a * t
a *= s
f += e * t
e *= s
return {'a': a,
'b': b,
'cut': (cut - b) / a,
'c': enc_gain,
'd': enc_offset,
'e': e,
'f': f}
def log_c_to_linear(code_value, exposure_index):
p = log_c_inverse_parameters_for_EI(exposure_index)
breakpoint = p['e'] * p['cut'] + p['f']
if code_value > breakpoint:
linear = ((pow(10, (code_value / 1023 - p['d']) / p['c']) -
p['b']) / p['a'])
else:
linear = (code_value / 1023 - p['f']) / p['e']
return linear
cs.to_reference_transforms = []
#.........这里部分代码省略.........