CIE XYZ#

Functions#

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

Convert a RGB image to XYZ.

_images/rgb_to_xyz.png
Parameters:

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

Return type:

Tensor

Returns:

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

Example

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

Convert a XYZ image to RGB.

Parameters:

image (Tensor) – XYZ 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)\).

Example

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

Modules#

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

Convert an image from RGB to XYZ.

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

Returns:

XYZ version of the image.

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

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

Examples

>>> input = torch.rand(2, 3, 4, 5)
>>> xyz = RgbToXyz()
>>> output = xyz(input)  # 2x3x4x5
Reference:

[1] https://docs.opencv.org/4.0.1/de/d25/imgproc_color_conversions.html

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

Converts an image from XYZ to RGB.

Returns:

RGB version of the image.

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

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

Examples

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

[1] https://docs.opencv.org/4.0.1/de/d25/imgproc_color_conversions.html