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


Python color.rgb2ycbcr方法代码示例

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


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

示例1: set_channel

# 需要导入模块: from skimage import color [as 别名]
# 或者: from skimage.color import rgb2ycbcr [as 别名]
def set_channel(*args, n_channels=3):
    def _set_channel(img):
        if img.ndim == 2:
            img = np.expand_dims(img, axis=2)

        c = img.shape[2]
        if n_channels == 1 and c == 3:
            img = np.expand_dims(sc.rgb2ycbcr(img)[:, :, 0], 2)
        elif n_channels == 3 and c == 1:
            img = np.concatenate([img] * n_channels, 2)

        return img

    return [_set_channel(a) for a in args] 
开发者ID:HolmesShuan,项目名称:OISR-PyTorch,代码行数:16,代码来源:common.py

示例2: set_channel

# 需要导入模块: from skimage import color [as 别名]
# 或者: from skimage.color import rgb2ycbcr [as 别名]
def set_channel(l, n_channel):
    def _set_channel(img):
        if img.ndim == 2:
            img = np.expand_dims(img, axis=2)

        c = img.shape[2]
        if n_channel == 1 and c == 3:
            img = np.expand_dims(sc.rgb2ycbcr(img)[:, :, 0], 2)
        elif n_channel == 3 and c == 1:
            img = np.concatenate([img] * n_channel, 2)

        return img

    return [_set_channel(_l) for _l in l] 
开发者ID:ofsoundof,项目名称:3D_Appearance_SR,代码行数:16,代码来源:common.py

示例3: set_channel

# 需要导入模块: from skimage import color [as 别名]
# 或者: from skimage.color import rgb2ycbcr [as 别名]
def set_channel(*args, n_channels=3):
    def _set_channel(img):
        if img.ndim == 2:
            img = np.expand_dims(img, axis=2)

        c = img.shape[2]
        if n_channels == 1 and c == 3:
            img = np.expand_dims(sc.rgb2ycbcr(img)[:, :, 0], 2)
        elif n_channels == 3 and c == 1:
            img = np.concatenate([img] * n_channels, 2)
        return img

    return [_set_channel(a) for a in args] 
开发者ID:ChaofWang,项目名称:AWSRN,代码行数:15,代码来源:common.py

示例4: luminance

# 需要导入模块: from skimage import color [as 别名]
# 或者: from skimage.color import rgb2ycbcr [as 别名]
def luminance(self, image):
    # Get luminance
    lum = rgb2ycbcr(image)[:,:,0]
    # Crop off 4 border pixels
    lum = lum[4:lum.shape[0]-4, 4:lum.shape[1]-4]
    #lum = lum.astype(np.float64)
    return lum 
开发者ID:trevor-m,项目名称:tensorflow-SRGAN,代码行数:9,代码来源:benchmark.py

示例5: eval_psnr_and_ssim

# 需要导入模块: from skimage import color [as 别名]
# 或者: from skimage.color import rgb2ycbcr [as 别名]
def eval_psnr_and_ssim(im1, im2, scale):
    im1_t = np.atleast_3d(img_as_float(im1))
    im2_t = np.atleast_3d(img_as_float(im2))

    if im1_t.shape[2] == 1 or im2_t.shape[2] == 1:
        im1_t = im1_t[..., 0]
        im2_t = im2_t[..., 0]

    else:
        im1_t = rgb2ycbcr(im1_t)[:, :, 0:1] / 255.0
        im2_t = rgb2ycbcr(im2_t)[:, :, 0:1] / 255.0

    if scale > 1:
        im1_t = mod_crop(im1_t, scale)
        im2_t = mod_crop(im2_t, scale)

        # NOTE conventionally, crop scale+6 pixels (EDSR, VDSR etc)
        im1_t = crop_boundaries(im1_t, int(scale) + 6)
        im2_t = crop_boundaries(im2_t, int(scale) + 6)

    psnr_val = compare_psnr(im1_t, im2_t)
    ssim_val = compare_ssim(
        im1_t,
        im2_t,
        win_size=11,
        gaussian_weights=True,
        multichannel=True,
        data_range=1.0,
        K1=0.01,
        K2=0.03,
        sigma=1.5)

    return psnr_val, ssim_val 
开发者ID:fperazzi,项目名称:proSR,代码行数:35,代码来源:metrics.py


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