YCbCr#

Functions#

kornia.color.rgb_to_ycbcr(image)[source]#

Convert an RGB image to YCbCr.

_images/rgb_to_ycbcr.png
Parameters:

image (Tensor) – RGB Image to be converted to YCbCr with shape \((*, 3, H, W)\).

Return type:

Tensor

Returns:

YCbCr version of the image with shape \((*, 3, H, W)\).

Examples

>>> input = torch.rand(2, 3, 4, 5)
>>> output = rgb_to_ycbcr(input)  # 2x3x4x5
kornia.color.ycbcr_to_rgb(image)[source]#

Convert an YCbCr image to RGB.

The image data is assumed to be in the range of (0, 1).

Parameters:

image (Tensor) – YCbCr Image to be converted to RGB with shape \((*, 3, H, W)\).

Return type:

Tensor

Returns:

RGB version of the image with shape \((*, 3, H, W)\).

Examples

>>> input = torch.rand(2, 3, 4, 5)
>>> output = ycbcr_to_rgb(input)  # 2x3x4x5

Modules#

class kornia.color.RgbToYcbcr(*args, **kwargs)[source]#

Convert an image from RGB to YCbCr.

The image data is assumed to be in the range of (0, 1).

Returns:

YCbCr version of the image.

Shape:
  • image: \((*, 3, H, W)\)

  • output: \((*, 3, H, W)\)

Examples

>>> input = torch.rand(2, 3, 4, 5)
>>> ycbcr = RgbToYcbcr()
>>> output = ycbcr(input)  # 2x3x4x5
class kornia.color.YcbcrToRgb(*args, **kwargs)[source]#

Convert an image from YCbCr to Rgb.

The image data is assumed to be in the range of (0, 1).

Returns:

RGB version of the image.

Shape:
  • image: \((*, 3, H, W)\)

  • output: \((*, 3, H, W)\)

Examples

>>> input = torch.rand(2, 3, 4, 5)
>>> rgb = YcbcrToRgb()
>>> output = rgb(input)  # 2x3x4x5