CIE XYZ#
Tip
Learn more: https://en.wikipedia.org/wiki/CIE_1931_color_space
Functions#
- kornia.color.rgb_to_xyz(image)[source]#
Convert a RGB image to XYZ.
- Convention:
This is the D65 linear-RGB-to-XYZ matrix transform. Pass linear RGB, for example from rgb_to_linear_rgb; nonlinear sRGB values are not linearized here.
- Parameters:
image (
Tensor) – RGB Image to be converted to XYZ with shape \((*, 3, H, W)\).- Return type:
- 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.
- Convention:
This is the inverse D65 XYZ-to-linear-RGB matrix transform. Convert its result with linear_rgb_to_rgb when nonlinear sRGB is required.
- Parameters:
image (
Tensor) – XYZ Image to be converted to RGB with shape \((*, 3, H, W)\).- Return type:
- 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.
See the Convention block on
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
- class kornia.color.XyzToRgb(*args, **kwargs)[source]#
Converts an image from XYZ to RGB.
See the Convention block on
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