當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。