当前位置: 首页>>代码示例>>Python>>正文


Python ColorSpace.bit_depth方法代码示例

本文整理汇总了Python中aces_ocio.utilities.ColorSpace.bit_depth方法的典型用法代码示例。如果您正苦于以下问题:Python ColorSpace.bit_depth方法的具体用法?Python ColorSpace.bit_depth怎么用?Python ColorSpace.bit_depth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在aces_ocio.utilities.ColorSpace的用法示例。


在下文中一共展示了ColorSpace.bit_depth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_ADX

# 需要导入模块: from aces_ocio.utilities import ColorSpace [as 别名]
# 或者: from aces_ocio.utilities.ColorSpace import bit_depth [as 别名]
def create_ADX(lut_directory,
               bit_depth=10,
               name='ADX'):
    """
    Creates the *ADX* colorspace.

    Parameters
    ----------
    parameter : type
        Parameter description.

    Returns
    -------
    Colorspace
         *ADX* colorspace.
    """

    name = '%s%s' % (name, bit_depth)
    cs = ColorSpace(name)
    cs.description = '%s color space - used for film scans' % name
    cs.aliases = ['adx%s' % str(bit_depth)]
    cs.equality_group = ''
    cs.family = 'ADX'
    cs.is_data = False

    if bit_depth == 10:
        cs.aces_transform_id = 'ACEScsc.ADX10_to_ACES.a1.0.0'

        cs.bit_depth = ocio.Constants.BIT_DEPTH_UINT10
        ADX_to_CDD = [1023 / 500, 0, 0, 0,
                      0, 1023 / 500, 0, 0,
                      0, 0, 1023 / 500, 0,
                      0, 0, 0, 1]
        offset = [-95 / 500, -95 / 500, -95 / 500, 0]
    elif bit_depth == 16:
        cs.aces_transform_id = 'ACEScsc.ADX16_to_ACES.a1.0.0'

        cs.bit_depth = ocio.Constants.BIT_DEPTH_UINT16
        ADX_to_CDD = [65535 / 8000, 0, 0, 0,
                      0, 65535 / 8000, 0, 0,
                      0, 0, 65535 / 8000, 0,
                      0, 0, 0, 1]
        offset = [-1520 / 8000, -1520 / 8000, -1520 / 8000, 0]

    cs.to_reference_transforms = []

    # Converting from *ADX* to *Channel-Dependent Density*.
    cs.to_reference_transforms.append({
        'type': 'matrix',
        'matrix': ADX_to_CDD,
        'offset': offset,
        'direction': 'forward'})

    # Converting from *Channel-Dependent Density* to
    # *Channel-Independent Density*.
    cs.to_reference_transforms.append({
        'type': 'matrix',
        'matrix': [0.75573, 0.22197, 0.02230, 0,
                   0.05901, 0.96928, -0.02829, 0,
                   0.16134, 0.07406, 0.76460, 0,
                   0, 0, 0, 1],
        'direction': 'forward'})

    # Copied from *Alex Fry*'s *adx_cid_to_rle.py*
    def create_CID_to_RLE_LUT():

        def interpolate_1d(x, xp, fp):
            return numpy.interp(x, xp, fp)

        LUT_1D_XP = [-0.190000000000000,
                     0.010000000000000,
                     0.028000000000000,
                     0.054000000000000,
                     0.095000000000000,
                     0.145000000000000,
                     0.220000000000000,
                     0.300000000000000,
                     0.400000000000000,
                     0.500000000000000,
                     0.600000000000000]

        LUT_1D_FP = [-6.000000000000000,
                     -2.721718645000000,
                     -2.521718645000000,
                     -2.321718645000000,
                     -2.121718645000000,
                     -1.921718645000000,
                     -1.721718645000000,
                     -1.521718645000000,
                     -1.321718645000000,
                     -1.121718645000000,
                     -0.926545676714876]

        REF_PT = ((7120 - 1520) / 8000 * (100 / 55) -
                  math.log(0.18, 10))

        def cid_to_rle(x):
            if x <= 0.6:
                return interpolate_1d(x, LUT_1D_XP, LUT_1D_FP)
            return (100 / 55) * x - REF_PT
#.........这里部分代码省略.........
开发者ID:Dithermaster,项目名称:OpenColorIO-Configs,代码行数:103,代码来源:aces.py


注:本文中的aces_ocio.utilities.ColorSpace.bit_depth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。